metaflow-stubs 2.11.7__py2.py3-none-any.whl → 2.11.8__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metaflow-stubs/__init__.pyi +479 -479
- metaflow-stubs/cards.pyi +5 -5
- metaflow-stubs/cli.pyi +3 -3
- metaflow-stubs/client/__init__.pyi +3 -3
- metaflow-stubs/client/core.pyi +7 -7
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/clone_util.pyi +2 -2
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +3 -3
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +5 -5
- metaflow-stubs/metadata/metadata.pyi +3 -3
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +18 -18
- metaflow-stubs/mflog/mflog.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow.pyi +3 -3
- metaflow-stubs/plugins/airflow/airflow_cli.pyi +3 -3
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_cli.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_cli.pyi +4 -4
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +3 -3
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +3 -3
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +4 -4
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +4 -4
- metaflow-stubs/plugins/datatools/s3/s3.pyi +6 -6
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/tag_cli.pyi +5 -5
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/procpoll.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.11.7.dist-info → metaflow_stubs-2.11.8.dist-info}/METADATA +2 -2
- metaflow_stubs-2.11.8.dist-info/RECORD +132 -0
- metaflow_stubs-2.11.7.dist-info/RECORD +0 -132
- {metaflow_stubs-2.11.7.dist-info → metaflow_stubs-2.11.8.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.11.7.dist-info → metaflow_stubs-2.11.8.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.11.
|
4
|
-
# Generated on 2024-03-
|
3
|
+
# MF version: 2.11.8 #
|
4
|
+
# Generated on 2024-03-29T12:37:59.184463 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import metaflow.datastore.inputs
|
12
|
-
import metaflow.metaflow_current
|
13
|
-
import metaflow.parameters
|
14
|
-
import typing
|
15
|
-
import metaflow.client.core
|
16
|
-
import io
|
17
11
|
import metaflow.events
|
18
|
-
import datetime
|
19
12
|
import metaflow.plugins.datatools.s3.s3
|
20
13
|
import metaflow._vendor.click.types
|
14
|
+
import metaflow.client.core
|
15
|
+
import metaflow.datastore.inputs
|
16
|
+
import typing
|
17
|
+
import metaflow.parameters
|
18
|
+
import datetime
|
19
|
+
import io
|
20
|
+
import metaflow.metaflow_current
|
21
21
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
22
22
|
StepFlag = typing.NewType("StepFlag", bool)
|
23
23
|
|
@@ -725,6 +725,90 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
725
725
|
"""
|
726
726
|
...
|
727
727
|
|
728
|
+
@typing.overload
|
729
|
+
def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
730
|
+
"""
|
731
|
+
Specifies environment variables to be set prior to the execution of a step.
|
732
|
+
|
733
|
+
Parameters
|
734
|
+
----------
|
735
|
+
vars : Dict[str, str], default {}
|
736
|
+
Dictionary of environment variables to set.
|
737
|
+
"""
|
738
|
+
...
|
739
|
+
|
740
|
+
@typing.overload
|
741
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
742
|
+
...
|
743
|
+
|
744
|
+
@typing.overload
|
745
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
746
|
+
...
|
747
|
+
|
748
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
749
|
+
"""
|
750
|
+
Specifies environment variables to be set prior to the execution of a step.
|
751
|
+
|
752
|
+
Parameters
|
753
|
+
----------
|
754
|
+
vars : Dict[str, str], default {}
|
755
|
+
Dictionary of environment variables to set.
|
756
|
+
"""
|
757
|
+
...
|
758
|
+
|
759
|
+
@typing.overload
|
760
|
+
def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
761
|
+
"""
|
762
|
+
Specifies the number of times the task corresponding
|
763
|
+
to a step needs to be retried.
|
764
|
+
|
765
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
766
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
767
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
768
|
+
|
769
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
770
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
771
|
+
ensuring that the flow execution can continue.
|
772
|
+
|
773
|
+
Parameters
|
774
|
+
----------
|
775
|
+
times : int, default 3
|
776
|
+
Number of times to retry this task.
|
777
|
+
minutes_between_retries : int, default 2
|
778
|
+
Number of minutes between retries.
|
779
|
+
"""
|
780
|
+
...
|
781
|
+
|
782
|
+
@typing.overload
|
783
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
784
|
+
...
|
785
|
+
|
786
|
+
@typing.overload
|
787
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
788
|
+
...
|
789
|
+
|
790
|
+
def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
|
791
|
+
"""
|
792
|
+
Specifies the number of times the task corresponding
|
793
|
+
to a step needs to be retried.
|
794
|
+
|
795
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
796
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
797
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
798
|
+
|
799
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
800
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
801
|
+
ensuring that the flow execution can continue.
|
802
|
+
|
803
|
+
Parameters
|
804
|
+
----------
|
805
|
+
times : int, default 3
|
806
|
+
Number of times to retry this task.
|
807
|
+
minutes_between_retries : int, default 2
|
808
|
+
Number of minutes between retries.
|
809
|
+
"""
|
810
|
+
...
|
811
|
+
|
728
812
|
@typing.overload
|
729
813
|
def resources(*, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
730
814
|
"""
|
@@ -803,84 +887,51 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
803
887
|
...
|
804
888
|
|
805
889
|
@typing.overload
|
806
|
-
def
|
807
|
-
"""
|
808
|
-
Specifies environment variables to be set prior to the execution of a step.
|
809
|
-
|
810
|
-
Parameters
|
811
|
-
----------
|
812
|
-
vars : Dict[str, str], default {}
|
813
|
-
Dictionary of environment variables to set.
|
814
|
-
"""
|
815
|
-
...
|
816
|
-
|
817
|
-
@typing.overload
|
818
|
-
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
819
|
-
...
|
820
|
-
|
821
|
-
@typing.overload
|
822
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
823
|
-
...
|
824
|
-
|
825
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
826
|
-
"""
|
827
|
-
Specifies environment variables to be set prior to the execution of a step.
|
828
|
-
|
829
|
-
Parameters
|
830
|
-
----------
|
831
|
-
vars : Dict[str, str], default {}
|
832
|
-
Dictionary of environment variables to set.
|
833
|
-
"""
|
834
|
-
...
|
835
|
-
|
836
|
-
@typing.overload
|
837
|
-
def card(*, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
890
|
+
def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
838
891
|
"""
|
839
|
-
|
892
|
+
Specifies that the step will success under all circumstances.
|
840
893
|
|
841
|
-
|
894
|
+
The decorator will create an optional artifact, specified by `var`, which
|
895
|
+
contains the exception raised. You can use it to detect the presence
|
896
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
897
|
+
are missing.
|
842
898
|
|
843
899
|
Parameters
|
844
900
|
----------
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
timeout : int, default 45
|
852
|
-
Interrupt reporting if it takes more than this many seconds.
|
853
|
-
|
854
|
-
|
901
|
+
var : str, optional, default None
|
902
|
+
Name of the artifact in which to store the caught exception.
|
903
|
+
If not specified, the exception is not stored.
|
904
|
+
print_exception : bool, default True
|
905
|
+
Determines whether or not the exception is printed to
|
906
|
+
stdout when caught.
|
855
907
|
"""
|
856
908
|
...
|
857
909
|
|
858
910
|
@typing.overload
|
859
|
-
def
|
911
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
860
912
|
...
|
861
913
|
|
862
914
|
@typing.overload
|
863
|
-
def
|
915
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
864
916
|
...
|
865
917
|
|
866
|
-
def
|
918
|
+
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
867
919
|
"""
|
868
|
-
|
920
|
+
Specifies that the step will success under all circumstances.
|
869
921
|
|
870
|
-
|
922
|
+
The decorator will create an optional artifact, specified by `var`, which
|
923
|
+
contains the exception raised. You can use it to detect the presence
|
924
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
925
|
+
are missing.
|
871
926
|
|
872
927
|
Parameters
|
873
928
|
----------
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
timeout : int, default 45
|
881
|
-
Interrupt reporting if it takes more than this many seconds.
|
882
|
-
|
883
|
-
|
929
|
+
var : str, optional, default None
|
930
|
+
Name of the artifact in which to store the caught exception.
|
931
|
+
If not specified, the exception is not stored.
|
932
|
+
print_exception : bool, default True
|
933
|
+
Determines whether or not the exception is printed to
|
934
|
+
stdout when caught.
|
884
935
|
"""
|
885
936
|
...
|
886
937
|
|
@@ -1032,173 +1083,61 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1032
1083
|
...
|
1033
1084
|
|
1034
1085
|
@typing.overload
|
1035
|
-
def
|
1086
|
+
def card(*, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1036
1087
|
"""
|
1037
|
-
|
1088
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1038
1089
|
|
1039
|
-
|
1040
|
-
contains the exception raised. You can use it to detect the presence
|
1041
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1042
|
-
are missing.
|
1090
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1043
1091
|
|
1044
1092
|
Parameters
|
1045
1093
|
----------
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1094
|
+
type : str, default 'default'
|
1095
|
+
Card type.
|
1096
|
+
id : str, optional, default None
|
1097
|
+
If multiple cards are present, use this id to identify this card.
|
1098
|
+
options : Dict[str, Any], default {}
|
1099
|
+
Options passed to the card. The contents depend on the card type.
|
1100
|
+
timeout : int, default 45
|
1101
|
+
Interrupt reporting if it takes more than this many seconds.
|
1102
|
+
|
1103
|
+
|
1052
1104
|
"""
|
1053
1105
|
...
|
1054
1106
|
|
1055
1107
|
@typing.overload
|
1056
|
-
def
|
1108
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1057
1109
|
...
|
1058
1110
|
|
1059
1111
|
@typing.overload
|
1060
|
-
def
|
1112
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1061
1113
|
...
|
1062
1114
|
|
1063
|
-
def
|
1115
|
+
def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
|
1064
1116
|
"""
|
1065
|
-
|
1117
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1066
1118
|
|
1067
|
-
|
1068
|
-
contains the exception raised. You can use it to detect the presence
|
1069
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1070
|
-
are missing.
|
1119
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1071
1120
|
|
1072
1121
|
Parameters
|
1073
1122
|
----------
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1123
|
+
type : str, default 'default'
|
1124
|
+
Card type.
|
1125
|
+
id : str, optional, default None
|
1126
|
+
If multiple cards are present, use this id to identify this card.
|
1127
|
+
options : Dict[str, Any], default {}
|
1128
|
+
Options passed to the card. The contents depend on the card type.
|
1129
|
+
timeout : int, default 45
|
1130
|
+
Interrupt reporting if it takes more than this many seconds.
|
1131
|
+
|
1132
|
+
|
1080
1133
|
"""
|
1081
1134
|
...
|
1082
1135
|
|
1083
1136
|
@typing.overload
|
1084
|
-
def
|
1137
|
+
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1085
1138
|
"""
|
1086
|
-
Specifies
|
1087
|
-
|
1088
|
-
Information in this decorator will augment any
|
1089
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1090
|
-
you can use `@conda_base` to set packages required by all
|
1091
|
-
steps and use `@conda` to specify step-specific overrides.
|
1092
|
-
|
1093
|
-
Parameters
|
1094
|
-
----------
|
1095
|
-
packages : Dict[str, str], default {}
|
1096
|
-
Packages to use for this step. The key is the name of the package
|
1097
|
-
and the value is the version to use.
|
1098
|
-
libraries : Dict[str, str], default {}
|
1099
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1100
|
-
python : str, optional, default None
|
1101
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1102
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1103
|
-
disabled : bool, default False
|
1104
|
-
If set to True, disables @conda.
|
1105
|
-
"""
|
1106
|
-
...
|
1107
|
-
|
1108
|
-
@typing.overload
|
1109
|
-
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1110
|
-
...
|
1111
|
-
|
1112
|
-
@typing.overload
|
1113
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1114
|
-
...
|
1115
|
-
|
1116
|
-
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1117
|
-
"""
|
1118
|
-
Specifies the Conda environment for the step.
|
1119
|
-
|
1120
|
-
Information in this decorator will augment any
|
1121
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1122
|
-
you can use `@conda_base` to set packages required by all
|
1123
|
-
steps and use `@conda` to specify step-specific overrides.
|
1124
|
-
|
1125
|
-
Parameters
|
1126
|
-
----------
|
1127
|
-
packages : Dict[str, str], default {}
|
1128
|
-
Packages to use for this step. The key is the name of the package
|
1129
|
-
and the value is the version to use.
|
1130
|
-
libraries : Dict[str, str], default {}
|
1131
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1132
|
-
python : str, optional, default None
|
1133
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1134
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1135
|
-
disabled : bool, default False
|
1136
|
-
If set to True, disables @conda.
|
1137
|
-
"""
|
1138
|
-
...
|
1139
|
-
|
1140
|
-
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1141
|
-
"""
|
1142
|
-
Specifies that this step should execute on Kubernetes.
|
1143
|
-
|
1144
|
-
Parameters
|
1145
|
-
----------
|
1146
|
-
cpu : int, default 1
|
1147
|
-
Number of CPUs required for this step. If `@resources` is
|
1148
|
-
also present, the maximum value from all decorators is used.
|
1149
|
-
memory : int, default 4096
|
1150
|
-
Memory size (in MB) required for this step. If
|
1151
|
-
`@resources` is also present, the maximum value from all decorators is
|
1152
|
-
used.
|
1153
|
-
disk : int, default 10240
|
1154
|
-
Disk size (in MB) required for this step. If
|
1155
|
-
`@resources` is also present, the maximum value from all decorators is
|
1156
|
-
used.
|
1157
|
-
image : str, optional, default None
|
1158
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
1159
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1160
|
-
not, a default Docker image mapping to the current version of Python is used.
|
1161
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1162
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1163
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1164
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
1165
|
-
secrets : List[str], optional, default None
|
1166
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1167
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1168
|
-
in Metaflow configuration.
|
1169
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1170
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
1171
|
-
gpu : int, optional, default None
|
1172
|
-
Number of GPUs required for this step. A value of zero implies that
|
1173
|
-
the scheduled node should not have GPUs.
|
1174
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1175
|
-
The vendor of the GPUs to be used for this step.
|
1176
|
-
tolerations : List[str], default []
|
1177
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1178
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1179
|
-
use_tmpfs : bool, default False
|
1180
|
-
This enables an explicit tmpfs mount for this step.
|
1181
|
-
tmpfs_tempdir : bool, default True
|
1182
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1183
|
-
tmpfs_size : int, optional, default: None
|
1184
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1185
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1186
|
-
memory allocated for this step.
|
1187
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
1188
|
-
Path to tmpfs mount for this step.
|
1189
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
1190
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1191
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1192
|
-
shared_memory: int, optional
|
1193
|
-
Shared memory size (in MiB) required for this step
|
1194
|
-
"""
|
1195
|
-
...
|
1196
|
-
|
1197
|
-
@typing.overload
|
1198
|
-
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1199
|
-
"""
|
1200
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
1201
|
-
the execution of a step.
|
1139
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1140
|
+
the execution of a step.
|
1202
1141
|
|
1203
1142
|
Parameters
|
1204
1143
|
----------
|
@@ -1227,108 +1166,6 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
1227
1166
|
"""
|
1228
1167
|
...
|
1229
1168
|
|
1230
|
-
@typing.overload
|
1231
|
-
def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1232
|
-
"""
|
1233
|
-
Specifies the PyPI packages for the step.
|
1234
|
-
|
1235
|
-
Information in this decorator will augment any
|
1236
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1237
|
-
you can use `@pypi_base` to set packages required by all
|
1238
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1239
|
-
|
1240
|
-
Parameters
|
1241
|
-
----------
|
1242
|
-
packages : Dict[str, str], default: {}
|
1243
|
-
Packages to use for this step. The key is the name of the package
|
1244
|
-
and the value is the version to use.
|
1245
|
-
python : str, optional, default: None
|
1246
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1247
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1248
|
-
"""
|
1249
|
-
...
|
1250
|
-
|
1251
|
-
@typing.overload
|
1252
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1253
|
-
...
|
1254
|
-
|
1255
|
-
@typing.overload
|
1256
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1257
|
-
...
|
1258
|
-
|
1259
|
-
def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1260
|
-
"""
|
1261
|
-
Specifies the PyPI packages for the step.
|
1262
|
-
|
1263
|
-
Information in this decorator will augment any
|
1264
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1265
|
-
you can use `@pypi_base` to set packages required by all
|
1266
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1267
|
-
|
1268
|
-
Parameters
|
1269
|
-
----------
|
1270
|
-
packages : Dict[str, str], default: {}
|
1271
|
-
Packages to use for this step. The key is the name of the package
|
1272
|
-
and the value is the version to use.
|
1273
|
-
python : str, optional, default: None
|
1274
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1275
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1276
|
-
"""
|
1277
|
-
...
|
1278
|
-
|
1279
|
-
@typing.overload
|
1280
|
-
def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1281
|
-
"""
|
1282
|
-
Specifies the number of times the task corresponding
|
1283
|
-
to a step needs to be retried.
|
1284
|
-
|
1285
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1286
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1287
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1288
|
-
|
1289
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1290
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1291
|
-
ensuring that the flow execution can continue.
|
1292
|
-
|
1293
|
-
Parameters
|
1294
|
-
----------
|
1295
|
-
times : int, default 3
|
1296
|
-
Number of times to retry this task.
|
1297
|
-
minutes_between_retries : int, default 2
|
1298
|
-
Number of minutes between retries.
|
1299
|
-
"""
|
1300
|
-
...
|
1301
|
-
|
1302
|
-
@typing.overload
|
1303
|
-
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1304
|
-
...
|
1305
|
-
|
1306
|
-
@typing.overload
|
1307
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1308
|
-
...
|
1309
|
-
|
1310
|
-
def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
|
1311
|
-
"""
|
1312
|
-
Specifies the number of times the task corresponding
|
1313
|
-
to a step needs to be retried.
|
1314
|
-
|
1315
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1316
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1317
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1318
|
-
|
1319
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1320
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1321
|
-
ensuring that the flow execution can continue.
|
1322
|
-
|
1323
|
-
Parameters
|
1324
|
-
----------
|
1325
|
-
times : int, default 3
|
1326
|
-
Number of times to retry this task.
|
1327
|
-
minutes_between_retries : int, default 2
|
1328
|
-
Number of minutes between retries.
|
1329
|
-
"""
|
1330
|
-
...
|
1331
|
-
|
1332
1169
|
@typing.overload
|
1333
1170
|
def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1334
1171
|
"""
|
@@ -1387,65 +1224,19 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
1387
1224
|
...
|
1388
1225
|
|
1389
1226
|
@typing.overload
|
1390
|
-
def
|
1391
|
-
"""
|
1392
|
-
Specifies the times when the flow should be run when running on a
|
1393
|
-
production scheduler.
|
1394
|
-
|
1395
|
-
Parameters
|
1396
|
-
----------
|
1397
|
-
hourly : bool, default False
|
1398
|
-
Run the workflow hourly.
|
1399
|
-
daily : bool, default True
|
1400
|
-
Run the workflow daily.
|
1401
|
-
weekly : bool, default False
|
1402
|
-
Run the workflow weekly.
|
1403
|
-
cron : str, optional, default None
|
1404
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1405
|
-
specified by this expression.
|
1406
|
-
timezone : str, optional, default None
|
1407
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1408
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1409
|
-
"""
|
1410
|
-
...
|
1411
|
-
|
1412
|
-
@typing.overload
|
1413
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1414
|
-
...
|
1415
|
-
|
1416
|
-
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1417
|
-
"""
|
1418
|
-
Specifies the times when the flow should be run when running on a
|
1419
|
-
production scheduler.
|
1420
|
-
|
1421
|
-
Parameters
|
1422
|
-
----------
|
1423
|
-
hourly : bool, default False
|
1424
|
-
Run the workflow hourly.
|
1425
|
-
daily : bool, default True
|
1426
|
-
Run the workflow daily.
|
1427
|
-
weekly : bool, default False
|
1428
|
-
Run the workflow weekly.
|
1429
|
-
cron : str, optional, default None
|
1430
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1431
|
-
specified by this expression.
|
1432
|
-
timezone : str, optional, default None
|
1433
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1434
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1435
|
-
"""
|
1436
|
-
...
|
1437
|
-
|
1438
|
-
@typing.overload
|
1439
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1227
|
+
def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1440
1228
|
"""
|
1441
|
-
Specifies the PyPI packages for
|
1229
|
+
Specifies the PyPI packages for the step.
|
1442
1230
|
|
1443
|
-
|
1231
|
+
Information in this decorator will augment any
|
1232
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1233
|
+
you can use `@pypi_base` to set packages required by all
|
1444
1234
|
steps and use `@pypi` to specify step-specific overrides.
|
1235
|
+
|
1445
1236
|
Parameters
|
1446
1237
|
----------
|
1447
1238
|
packages : Dict[str, str], default: {}
|
1448
|
-
Packages to use for this
|
1239
|
+
Packages to use for this step. The key is the name of the package
|
1449
1240
|
and the value is the version to use.
|
1450
1241
|
python : str, optional, default: None
|
1451
1242
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
@@ -1454,19 +1245,26 @@ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[s
|
|
1454
1245
|
...
|
1455
1246
|
|
1456
1247
|
@typing.overload
|
1457
|
-
def
|
1248
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1458
1249
|
...
|
1459
1250
|
|
1460
|
-
|
1251
|
+
@typing.overload
|
1252
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1253
|
+
...
|
1254
|
+
|
1255
|
+
def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1461
1256
|
"""
|
1462
|
-
Specifies the PyPI packages for
|
1257
|
+
Specifies the PyPI packages for the step.
|
1463
1258
|
|
1464
|
-
|
1259
|
+
Information in this decorator will augment any
|
1260
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1261
|
+
you can use `@pypi_base` to set packages required by all
|
1465
1262
|
steps and use `@pypi` to specify step-specific overrides.
|
1263
|
+
|
1466
1264
|
Parameters
|
1467
1265
|
----------
|
1468
1266
|
packages : Dict[str, str], default: {}
|
1469
|
-
Packages to use for this
|
1267
|
+
Packages to use for this step. The key is the name of the package
|
1470
1268
|
and the value is the version to use.
|
1471
1269
|
python : str, optional, default: None
|
1472
1270
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
@@ -1474,120 +1272,77 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
1474
1272
|
"""
|
1475
1273
|
...
|
1476
1274
|
|
1477
|
-
def
|
1478
|
-
"""
|
1479
|
-
Specifies what flows belong to the same project.
|
1480
|
-
|
1481
|
-
A project-specific namespace is created for all flows that
|
1482
|
-
use the same `@project(name)`.
|
1483
|
-
|
1484
|
-
Parameters
|
1485
|
-
----------
|
1486
|
-
name : str
|
1487
|
-
Project name. Make sure that the name is unique amongst all
|
1488
|
-
projects that use the same production scheduler. The name may
|
1489
|
-
contain only lowercase alphanumeric characters and underscores.
|
1490
|
-
|
1491
|
-
|
1492
|
-
"""
|
1493
|
-
...
|
1494
|
-
|
1495
|
-
def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1496
|
-
"""
|
1497
|
-
The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
|
1498
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1499
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1500
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1501
|
-
starts only after all sensors finish.
|
1502
|
-
|
1503
|
-
Parameters
|
1504
|
-
----------
|
1505
|
-
timeout : int
|
1506
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1507
|
-
poke_interval : int
|
1508
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1509
|
-
mode : str
|
1510
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1511
|
-
exponential_backoff : bool
|
1512
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1513
|
-
pool : str
|
1514
|
-
the slot pool this task should run in,
|
1515
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1516
|
-
soft_fail : bool
|
1517
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1518
|
-
name : str
|
1519
|
-
Name of the sensor on Airflow
|
1520
|
-
description : str
|
1521
|
-
Description of sensor in the Airflow UI
|
1522
|
-
bucket_key : Union[str, List[str]]
|
1523
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1524
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1525
|
-
bucket_name : str
|
1526
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1527
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1528
|
-
wildcard_match : bool
|
1529
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1530
|
-
aws_conn_id : str
|
1531
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1532
|
-
verify : bool
|
1533
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1534
|
-
"""
|
1535
|
-
...
|
1536
|
-
|
1537
|
-
def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1275
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1538
1276
|
"""
|
1539
|
-
|
1540
|
-
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1277
|
+
Specifies that this step should execute on Kubernetes.
|
1541
1278
|
|
1542
1279
|
Parameters
|
1543
1280
|
----------
|
1544
|
-
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
the
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1281
|
+
cpu : int, default 1
|
1282
|
+
Number of CPUs required for this step. If `@resources` is
|
1283
|
+
also present, the maximum value from all decorators is used.
|
1284
|
+
memory : int, default 4096
|
1285
|
+
Memory size (in MB) required for this step. If
|
1286
|
+
`@resources` is also present, the maximum value from all decorators is
|
1287
|
+
used.
|
1288
|
+
disk : int, default 10240
|
1289
|
+
Disk size (in MB) required for this step. If
|
1290
|
+
`@resources` is also present, the maximum value from all decorators is
|
1291
|
+
used.
|
1292
|
+
image : str, optional, default None
|
1293
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
1294
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1295
|
+
not, a default Docker image mapping to the current version of Python is used.
|
1296
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1297
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1298
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1299
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
1300
|
+
secrets : List[str], optional, default None
|
1301
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1302
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1303
|
+
in Metaflow configuration.
|
1304
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1305
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
1306
|
+
gpu : int, optional, default None
|
1307
|
+
Number of GPUs required for this step. A value of zero implies that
|
1308
|
+
the scheduled node should not have GPUs.
|
1309
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1310
|
+
The vendor of the GPUs to be used for this step.
|
1311
|
+
tolerations : List[str], default []
|
1312
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1313
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1314
|
+
use_tmpfs : bool, default False
|
1315
|
+
This enables an explicit tmpfs mount for this step.
|
1316
|
+
tmpfs_tempdir : bool, default True
|
1317
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1318
|
+
tmpfs_size : int, optional, default: None
|
1319
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
1320
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1321
|
+
memory allocated for this step.
|
1322
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
1323
|
+
Path to tmpfs mount for this step.
|
1324
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
1325
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1326
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1327
|
+
shared_memory: int, optional
|
1328
|
+
Shared memory size (in MiB) required for this step
|
1576
1329
|
"""
|
1577
1330
|
...
|
1578
1331
|
|
1579
1332
|
@typing.overload
|
1580
|
-
def
|
1333
|
+
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1581
1334
|
"""
|
1582
|
-
Specifies the Conda environment for
|
1335
|
+
Specifies the Conda environment for the step.
|
1583
1336
|
|
1584
|
-
|
1585
|
-
|
1337
|
+
Information in this decorator will augment any
|
1338
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1339
|
+
you can use `@conda_base` to set packages required by all
|
1340
|
+
steps and use `@conda` to specify step-specific overrides.
|
1586
1341
|
|
1587
1342
|
Parameters
|
1588
1343
|
----------
|
1589
1344
|
packages : Dict[str, str], default {}
|
1590
|
-
Packages to use for this
|
1345
|
+
Packages to use for this step. The key is the name of the package
|
1591
1346
|
and the value is the version to use.
|
1592
1347
|
libraries : Dict[str, str], default {}
|
1593
1348
|
Supported for backward compatibility. When used with packages, packages will take precedence.
|
@@ -1595,25 +1350,31 @@ def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[s
|
|
1595
1350
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1596
1351
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1597
1352
|
disabled : bool, default False
|
1598
|
-
If set to True, disables
|
1353
|
+
If set to True, disables @conda.
|
1599
1354
|
"""
|
1600
1355
|
...
|
1601
1356
|
|
1602
1357
|
@typing.overload
|
1603
|
-
def
|
1358
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1359
|
+
...
|
1360
|
+
|
1361
|
+
@typing.overload
|
1362
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1604
1363
|
...
|
1605
1364
|
|
1606
|
-
def
|
1365
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1607
1366
|
"""
|
1608
|
-
Specifies the Conda environment for
|
1367
|
+
Specifies the Conda environment for the step.
|
1609
1368
|
|
1610
|
-
|
1611
|
-
|
1369
|
+
Information in this decorator will augment any
|
1370
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1371
|
+
you can use `@conda_base` to set packages required by all
|
1372
|
+
steps and use `@conda` to specify step-specific overrides.
|
1612
1373
|
|
1613
1374
|
Parameters
|
1614
1375
|
----------
|
1615
1376
|
packages : Dict[str, str], default {}
|
1616
|
-
Packages to use for this
|
1377
|
+
Packages to use for this step. The key is the name of the package
|
1617
1378
|
and the value is the version to use.
|
1618
1379
|
libraries : Dict[str, str], default {}
|
1619
1380
|
Supported for backward compatibility. When used with packages, packages will take precedence.
|
@@ -1621,7 +1382,7 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1621
1382
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1622
1383
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1623
1384
|
disabled : bool, default False
|
1624
|
-
If set to True, disables
|
1385
|
+
If set to True, disables @conda.
|
1625
1386
|
"""
|
1626
1387
|
...
|
1627
1388
|
|
@@ -1823,6 +1584,245 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1823
1584
|
"""
|
1824
1585
|
...
|
1825
1586
|
|
1587
|
+
@typing.overload
|
1588
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1589
|
+
"""
|
1590
|
+
Specifies the PyPI packages for all steps of the flow.
|
1591
|
+
|
1592
|
+
Use `@pypi_base` to set common packages required by all
|
1593
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1594
|
+
Parameters
|
1595
|
+
----------
|
1596
|
+
packages : Dict[str, str], default: {}
|
1597
|
+
Packages to use for this flow. The key is the name of the package
|
1598
|
+
and the value is the version to use.
|
1599
|
+
python : str, optional, default: None
|
1600
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1601
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1602
|
+
"""
|
1603
|
+
...
|
1604
|
+
|
1605
|
+
@typing.overload
|
1606
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1607
|
+
...
|
1608
|
+
|
1609
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1610
|
+
"""
|
1611
|
+
Specifies the PyPI packages for all steps of the flow.
|
1612
|
+
|
1613
|
+
Use `@pypi_base` to set common packages required by all
|
1614
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1615
|
+
Parameters
|
1616
|
+
----------
|
1617
|
+
packages : Dict[str, str], default: {}
|
1618
|
+
Packages to use for this flow. The key is the name of the package
|
1619
|
+
and the value is the version to use.
|
1620
|
+
python : str, optional, default: None
|
1621
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1622
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1623
|
+
"""
|
1624
|
+
...
|
1625
|
+
|
1626
|
+
@typing.overload
|
1627
|
+
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1628
|
+
"""
|
1629
|
+
Specifies the times when the flow should be run when running on a
|
1630
|
+
production scheduler.
|
1631
|
+
|
1632
|
+
Parameters
|
1633
|
+
----------
|
1634
|
+
hourly : bool, default False
|
1635
|
+
Run the workflow hourly.
|
1636
|
+
daily : bool, default True
|
1637
|
+
Run the workflow daily.
|
1638
|
+
weekly : bool, default False
|
1639
|
+
Run the workflow weekly.
|
1640
|
+
cron : str, optional, default None
|
1641
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1642
|
+
specified by this expression.
|
1643
|
+
timezone : str, optional, default None
|
1644
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1645
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1646
|
+
"""
|
1647
|
+
...
|
1648
|
+
|
1649
|
+
@typing.overload
|
1650
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1651
|
+
...
|
1652
|
+
|
1653
|
+
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1654
|
+
"""
|
1655
|
+
Specifies the times when the flow should be run when running on a
|
1656
|
+
production scheduler.
|
1657
|
+
|
1658
|
+
Parameters
|
1659
|
+
----------
|
1660
|
+
hourly : bool, default False
|
1661
|
+
Run the workflow hourly.
|
1662
|
+
daily : bool, default True
|
1663
|
+
Run the workflow daily.
|
1664
|
+
weekly : bool, default False
|
1665
|
+
Run the workflow weekly.
|
1666
|
+
cron : str, optional, default None
|
1667
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1668
|
+
specified by this expression.
|
1669
|
+
timezone : str, optional, default None
|
1670
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1671
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1672
|
+
"""
|
1673
|
+
...
|
1674
|
+
|
1675
|
+
def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1676
|
+
"""
|
1677
|
+
The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
|
1678
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1679
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1680
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1681
|
+
starts only after all sensors finish.
|
1682
|
+
|
1683
|
+
Parameters
|
1684
|
+
----------
|
1685
|
+
timeout : int
|
1686
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1687
|
+
poke_interval : int
|
1688
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1689
|
+
mode : str
|
1690
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1691
|
+
exponential_backoff : bool
|
1692
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1693
|
+
pool : str
|
1694
|
+
the slot pool this task should run in,
|
1695
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1696
|
+
soft_fail : bool
|
1697
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1698
|
+
name : str
|
1699
|
+
Name of the sensor on Airflow
|
1700
|
+
description : str
|
1701
|
+
Description of sensor in the Airflow UI
|
1702
|
+
bucket_key : Union[str, List[str]]
|
1703
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1704
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1705
|
+
bucket_name : str
|
1706
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1707
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1708
|
+
wildcard_match : bool
|
1709
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1710
|
+
aws_conn_id : str
|
1711
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1712
|
+
verify : bool
|
1713
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1714
|
+
"""
|
1715
|
+
...
|
1716
|
+
|
1717
|
+
def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1718
|
+
"""
|
1719
|
+
The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
|
1720
|
+
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1721
|
+
|
1722
|
+
Parameters
|
1723
|
+
----------
|
1724
|
+
timeout : int
|
1725
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1726
|
+
poke_interval : int
|
1727
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1728
|
+
mode : str
|
1729
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1730
|
+
exponential_backoff : bool
|
1731
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1732
|
+
pool : str
|
1733
|
+
the slot pool this task should run in,
|
1734
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1735
|
+
soft_fail : bool
|
1736
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1737
|
+
name : str
|
1738
|
+
Name of the sensor on Airflow
|
1739
|
+
description : str
|
1740
|
+
Description of sensor in the Airflow UI
|
1741
|
+
external_dag_id : str
|
1742
|
+
The dag_id that contains the task you want to wait for.
|
1743
|
+
external_task_ids : List[str]
|
1744
|
+
The list of task_ids that you want to wait for.
|
1745
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1746
|
+
allowed_states : List[str]
|
1747
|
+
Iterable of allowed states, (Default: ['success'])
|
1748
|
+
failed_states : List[str]
|
1749
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1750
|
+
execution_delta : datetime.timedelta
|
1751
|
+
time difference with the previous execution to look at,
|
1752
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1753
|
+
check_existence: bool
|
1754
|
+
Set to True to check if the external task exists or check if
|
1755
|
+
the DAG to wait for exists. (Default: True)
|
1756
|
+
"""
|
1757
|
+
...
|
1758
|
+
|
1759
|
+
@typing.overload
|
1760
|
+
def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1761
|
+
"""
|
1762
|
+
Specifies the Conda environment for all steps of the flow.
|
1763
|
+
|
1764
|
+
Use `@conda_base` to set common libraries required by all
|
1765
|
+
steps and use `@conda` to specify step-specific additions.
|
1766
|
+
|
1767
|
+
Parameters
|
1768
|
+
----------
|
1769
|
+
packages : Dict[str, str], default {}
|
1770
|
+
Packages to use for this flow. The key is the name of the package
|
1771
|
+
and the value is the version to use.
|
1772
|
+
libraries : Dict[str, str], default {}
|
1773
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1774
|
+
python : str, optional, default None
|
1775
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1776
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1777
|
+
disabled : bool, default False
|
1778
|
+
If set to True, disables Conda.
|
1779
|
+
"""
|
1780
|
+
...
|
1781
|
+
|
1782
|
+
@typing.overload
|
1783
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1784
|
+
...
|
1785
|
+
|
1786
|
+
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1787
|
+
"""
|
1788
|
+
Specifies the Conda environment for all steps of the flow.
|
1789
|
+
|
1790
|
+
Use `@conda_base` to set common libraries required by all
|
1791
|
+
steps and use `@conda` to specify step-specific additions.
|
1792
|
+
|
1793
|
+
Parameters
|
1794
|
+
----------
|
1795
|
+
packages : Dict[str, str], default {}
|
1796
|
+
Packages to use for this flow. The key is the name of the package
|
1797
|
+
and the value is the version to use.
|
1798
|
+
libraries : Dict[str, str], default {}
|
1799
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1800
|
+
python : str, optional, default None
|
1801
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1802
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1803
|
+
disabled : bool, default False
|
1804
|
+
If set to True, disables Conda.
|
1805
|
+
"""
|
1806
|
+
...
|
1807
|
+
|
1808
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1809
|
+
"""
|
1810
|
+
Specifies what flows belong to the same project.
|
1811
|
+
|
1812
|
+
A project-specific namespace is created for all flows that
|
1813
|
+
use the same `@project(name)`.
|
1814
|
+
|
1815
|
+
Parameters
|
1816
|
+
----------
|
1817
|
+
name : str
|
1818
|
+
Project name. Make sure that the name is unique amongst all
|
1819
|
+
projects that use the same production scheduler. The name may
|
1820
|
+
contain only lowercase alphanumeric characters and underscores.
|
1821
|
+
|
1822
|
+
|
1823
|
+
"""
|
1824
|
+
...
|
1825
|
+
|
1826
1826
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1827
1827
|
"""
|
1828
1828
|
Switch namespace to the one provided.
|