@@ -491,29 +491,22 @@ def list_flows(self) -> List[Dict[str, str]]:
491
491
492
492
def flow (
493
493
self ,
494
- flow_id : Optional [Union [str , uuid .UUID ]] = None ,
495
- flow_name : Optional [str ] = None ,
494
+ flow_identifier : Optional [Union [str , uuid .UUID ]] = None ,
496
495
) -> Flow :
497
496
"""Fetches a flow corresponding to the given flow id.
498
497
499
498
Args:
500
- flow_id:
501
- Used to identify the flow to fetch from the system.
502
- Between `flow_id` and `flow_name`, at least one must be provided.
503
- If both are specified, they must correspond to the same flow.
504
- flow_name:
499
+ flow_identifier:
505
500
Used to identify the flow to fetch from the system.
501
+ Use either the flow name or id as identifier to fetch
502
+ from the system.
506
503
507
504
Raises:
508
505
InvalidUserArgumentException:
509
506
If the provided flow id or name does not correspond to a flow the client knows about.
510
507
"""
511
508
flows = [(flow .id , flow .name ) for flow in globals .__GLOBAL_API_CLIENT__ .list_workflows ()]
512
- flow_id = find_flow_with_user_supplied_id_and_name (
513
- flows ,
514
- flow_id ,
515
- flow_name ,
516
- )
509
+ flow_id = find_flow_with_user_supplied_id_and_name (flows , flow_identifier )
517
510
518
511
return Flow (
519
512
flow_id ,
@@ -774,19 +767,14 @@ def publish_flow(
774
767
775
768
def trigger (
776
769
self ,
777
- flow_id : Optional [Union [str , uuid .UUID ]] = None ,
778
- flow_name : Optional [str ] = None ,
770
+ flow_identifier : Optional [Union [str , uuid .UUID ]] = None ,
779
771
parameters : Optional [Dict [str , Any ]] = None ,
780
772
) -> None :
781
773
"""Immediately triggers another run of the provided flow.
782
774
783
775
Args:
784
- flow_id:
785
- The id of the flow to delete.
786
- Between `flow_id` and `flow_name`, at least one must be provided.
787
- If both are specified, they must correspond to the same flow.
788
- flow_name:
789
- The name of the flow to delete.
776
+ flow_identifier:
777
+ The uuid or name of the flow to delete.
790
778
parameters:
791
779
A map containing custom values to use for the designated parameters. The mapping
792
780
is expected to be from parameter name to the custom value. These custom values
@@ -802,7 +790,7 @@ def trigger(
802
790
"""
803
791
param_specs : Dict [str , ParamSpec ] = {}
804
792
if parameters is not None :
805
- flow = self .flow (flow_id )
793
+ flow = self .flow (flow_identifier )
806
794
latest_run = flow .latest ()
807
795
808
796
# NOTE: this is a defense check against triggering runs that haven't run yet.
@@ -818,17 +806,12 @@ def trigger(
818
806
param_specs [name ] = construct_param_spec (new_val , artifact_type )
819
807
820
808
flows = [(flow .id , flow .name ) for flow in globals .__GLOBAL_API_CLIENT__ .list_workflows ()]
821
- flow_id = find_flow_with_user_supplied_id_and_name (
822
- flows ,
823
- flow_id ,
824
- flow_name ,
825
- )
809
+ flow_id = find_flow_with_user_supplied_id_and_name (flows , flow_identifier )
826
810
globals .__GLOBAL_API_CLIENT__ .refresh_workflow (flow_id , param_specs )
827
811
828
812
def delete_flow (
829
813
self ,
830
- flow_id : Optional [Union [str , uuid .UUID ]] = None ,
831
- flow_name : Optional [str ] = None ,
814
+ flow_identifier : Optional [Union [str , uuid .UUID ]] = None ,
832
815
saved_objects_to_delete : Optional [
833
816
DefaultDict [Union [str , BaseResource ], List [SavedObjectUpdate ]]
834
817
] = None ,
@@ -837,12 +820,8 @@ def delete_flow(
837
820
"""Deletes a flow object.
838
821
839
822
Args:
840
- flow_id:
841
- The id of the flow to delete.
842
- Between `flow_id` and `flow_name`, at least one must be provided.
843
- If both are specified, they must correspond to the same flow.
844
- flow_name:
845
- The name of the flow to delete.
823
+ flow_identifier:
824
+ The id of the flow to delete. Must be name or uuid
846
825
saved_objects_to_delete:
847
826
The tables or storage paths to delete grouped by integration name.
848
827
force:
@@ -859,11 +838,7 @@ def delete_flow(
859
838
saved_objects_to_delete = defaultdict ()
860
839
861
840
flows = [(flow .id , flow .name ) for flow in globals .__GLOBAL_API_CLIENT__ .list_workflows ()]
862
- flow_id = find_flow_with_user_supplied_id_and_name (
863
- flows ,
864
- flow_id ,
865
- flow_name ,
866
- )
841
+ flow_id = find_flow_with_user_supplied_id_and_name (flows , flow_identifier )
867
842
868
843
# TODO(ENG-410): This method gives no indication as to whether the flow
869
844
# was successfully deleted.
0 commit comments