metaflow-stubs 2.12.26__py2.py3-none-any.whl → 2.12.27__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 +529 -529
- metaflow-stubs/cards.pyi +4 -4
- metaflow-stubs/cli.pyi +3 -3
- metaflow-stubs/client/__init__.pyi +4 -4
- metaflow-stubs/client/core.pyi +9 -7
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/clone_util.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata/metadata.pyi +6 -3
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +26 -26
- metaflow-stubs/mflog/mflog.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +4 -4
- metaflow-stubs/plugins/__init__.pyi +3 -3
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow.pyi +2 -2
- 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 +5 -5
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +5 -5
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- 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 +5 -5
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
- 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 +3 -3
- 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/aws/step_functions/step_functions_deployer.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
- 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 +2 -2
- 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 +3 -3
- 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 +2 -2
- 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 +3 -3
- 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 +3 -3
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +4 -4
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
- 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/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +5 -5
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/logs_cli.pyi +4 -4
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +3 -3
- metaflow-stubs/plugins/project_decorator.pyi +3 -3
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
- 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 +3 -3
- 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 +3 -3
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/procpoll.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +3 -3
- metaflow-stubs/runner/metaflow_runner.pyi +4 -32
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +3 -3
- metaflow-stubs/system/system_logger.pyi +3 -3
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.12.26.dist-info → metaflow_stubs-2.12.27.dist-info}/METADATA +2 -2
- metaflow_stubs-2.12.27.dist-info/RECORD +152 -0
- metaflow_stubs-2.12.26.dist-info/RECORD +0 -152
- {metaflow_stubs-2.12.26.dist-info → metaflow_stubs-2.12.27.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.12.26.dist-info → metaflow_stubs-2.12.27.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-10-
|
3
|
+
# MF version: 2.12.27 #
|
4
|
+
# Generated on 2024-10-24T19:27:17.873106 #
|
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
|
11
12
|
import metaflow.flowspec
|
13
|
+
import metaflow.events
|
12
14
|
import metaflow.client.core
|
13
|
-
import metaflow.parameters
|
14
|
-
import metaflow.runner.metaflow_runner
|
15
|
-
import datetime
|
16
|
-
import io
|
17
|
-
import metaflow.datastore.inputs
|
18
|
-
import typing
|
19
15
|
import metaflow._vendor.click.types
|
20
|
-
import
|
21
|
-
import
|
16
|
+
import typing
|
17
|
+
import datetime
|
18
|
+
import metaflow.runner.metaflow_runner
|
22
19
|
import metaflow.plugins.datatools.s3.s3
|
20
|
+
import metaflow.parameters
|
21
|
+
import metaflow.metaflow_current
|
22
|
+
import io
|
23
23
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
24
24
|
StepFlag = typing.NewType("StepFlag", bool)
|
25
25
|
|
@@ -855,84 +855,21 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
855
855
|
...
|
856
856
|
|
857
857
|
@typing.overload
|
858
|
-
def
|
859
|
-
"""
|
860
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
861
|
-
|
862
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
863
|
-
|
864
|
-
Parameters
|
865
|
-
----------
|
866
|
-
type : str, default 'default'
|
867
|
-
Card type.
|
868
|
-
id : str, optional, default None
|
869
|
-
If multiple cards are present, use this id to identify this card.
|
870
|
-
options : Dict[str, Any], default {}
|
871
|
-
Options passed to the card. The contents depend on the card type.
|
872
|
-
timeout : int, default 45
|
873
|
-
Interrupt reporting if it takes more than this many seconds.
|
874
|
-
|
875
|
-
|
876
|
-
"""
|
877
|
-
...
|
878
|
-
|
879
|
-
@typing.overload
|
880
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
881
|
-
...
|
882
|
-
|
883
|
-
@typing.overload
|
884
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
885
|
-
...
|
886
|
-
|
887
|
-
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):
|
888
|
-
"""
|
889
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
890
|
-
|
891
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
892
|
-
|
893
|
-
Parameters
|
894
|
-
----------
|
895
|
-
type : str, default 'default'
|
896
|
-
Card type.
|
897
|
-
id : str, optional, default None
|
898
|
-
If multiple cards are present, use this id to identify this card.
|
899
|
-
options : Dict[str, Any], default {}
|
900
|
-
Options passed to the card. The contents depend on the card type.
|
901
|
-
timeout : int, default 45
|
902
|
-
Interrupt reporting if it takes more than this many seconds.
|
903
|
-
|
904
|
-
|
905
|
-
"""
|
906
|
-
...
|
907
|
-
|
908
|
-
@typing.overload
|
909
|
-
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]]]:
|
858
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
910
859
|
"""
|
911
|
-
|
912
|
-
|
913
|
-
Parameters
|
914
|
-
----------
|
915
|
-
vars : Dict[str, str], default {}
|
916
|
-
Dictionary of environment variables to set.
|
860
|
+
Decorator prototype for all step decorators. This function gets specialized
|
861
|
+
and imported for all decorators types by _import_plugin_decorators().
|
917
862
|
"""
|
918
863
|
...
|
919
864
|
|
920
865
|
@typing.overload
|
921
|
-
def
|
922
|
-
...
|
923
|
-
|
924
|
-
@typing.overload
|
925
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
866
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
926
867
|
...
|
927
868
|
|
928
|
-
def
|
869
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
929
870
|
"""
|
930
|
-
|
931
|
-
|
932
|
-
Parameters
|
933
|
-
----------
|
934
|
-
vars : Dict[str, str], default {}
|
935
|
-
Dictionary of environment variables to set.
|
871
|
+
Decorator prototype for all step decorators. This function gets specialized
|
872
|
+
and imported for all decorators types by _import_plugin_decorators().
|
936
873
|
"""
|
937
874
|
...
|
938
875
|
|
@@ -986,55 +923,122 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
986
923
|
...
|
987
924
|
|
988
925
|
@typing.overload
|
989
|
-
def
|
926
|
+
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]]]:
|
990
927
|
"""
|
991
|
-
|
992
|
-
to a step needs to be retried.
|
993
|
-
|
994
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
995
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
996
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
928
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
997
929
|
|
998
|
-
|
999
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1000
|
-
ensuring that the flow execution can continue.
|
930
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1001
931
|
|
1002
932
|
Parameters
|
1003
933
|
----------
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
934
|
+
type : str, default 'default'
|
935
|
+
Card type.
|
936
|
+
id : str, optional, default None
|
937
|
+
If multiple cards are present, use this id to identify this card.
|
938
|
+
options : Dict[str, Any], default {}
|
939
|
+
Options passed to the card. The contents depend on the card type.
|
940
|
+
timeout : int, default 45
|
941
|
+
Interrupt reporting if it takes more than this many seconds.
|
942
|
+
|
943
|
+
|
1008
944
|
"""
|
1009
945
|
...
|
1010
946
|
|
1011
947
|
@typing.overload
|
1012
|
-
def
|
948
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1013
949
|
...
|
1014
950
|
|
1015
951
|
@typing.overload
|
1016
|
-
def
|
952
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1017
953
|
...
|
1018
954
|
|
1019
|
-
def
|
955
|
+
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):
|
1020
956
|
"""
|
1021
|
-
|
1022
|
-
to a step needs to be retried.
|
957
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1023
958
|
|
1024
|
-
|
1025
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1026
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
959
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1027
960
|
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
961
|
+
Parameters
|
962
|
+
----------
|
963
|
+
type : str, default 'default'
|
964
|
+
Card type.
|
965
|
+
id : str, optional, default None
|
966
|
+
If multiple cards are present, use this id to identify this card.
|
967
|
+
options : Dict[str, Any], default {}
|
968
|
+
Options passed to the card. The contents depend on the card type.
|
969
|
+
timeout : int, default 45
|
970
|
+
Interrupt reporting if it takes more than this many seconds.
|
971
|
+
|
972
|
+
|
973
|
+
"""
|
974
|
+
...
|
975
|
+
|
976
|
+
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, node_selector: typing.Union[typing.Dict[str, str], str, None] = 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, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600) -> 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]]]:
|
977
|
+
"""
|
978
|
+
Specifies that this step should execute on Kubernetes.
|
1031
979
|
|
1032
980
|
Parameters
|
1033
981
|
----------
|
1034
|
-
|
1035
|
-
Number of
|
1036
|
-
|
1037
|
-
|
982
|
+
cpu : int, default 1
|
983
|
+
Number of CPUs required for this step. If `@resources` is
|
984
|
+
also present, the maximum value from all decorators is used.
|
985
|
+
memory : int, default 4096
|
986
|
+
Memory size (in MB) required for this step. If
|
987
|
+
`@resources` is also present, the maximum value from all decorators is
|
988
|
+
used.
|
989
|
+
disk : int, default 10240
|
990
|
+
Disk size (in MB) required for this step. If
|
991
|
+
`@resources` is also present, the maximum value from all decorators is
|
992
|
+
used.
|
993
|
+
image : str, optional, default None
|
994
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
995
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
996
|
+
not, a default Docker image mapping to the current version of Python is used.
|
997
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
998
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
999
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1000
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
1001
|
+
secrets : List[str], optional, default None
|
1002
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1003
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1004
|
+
in Metaflow configuration.
|
1005
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
1006
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
1007
|
+
Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
|
1008
|
+
or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
|
1009
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1010
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
1011
|
+
gpu : int, optional, default None
|
1012
|
+
Number of GPUs required for this step. A value of zero implies that
|
1013
|
+
the scheduled node should not have GPUs.
|
1014
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1015
|
+
The vendor of the GPUs to be used for this step.
|
1016
|
+
tolerations : List[str], default []
|
1017
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1018
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1019
|
+
use_tmpfs : bool, default False
|
1020
|
+
This enables an explicit tmpfs mount for this step.
|
1021
|
+
tmpfs_tempdir : bool, default True
|
1022
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1023
|
+
tmpfs_size : int, optional, default: None
|
1024
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
1025
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1026
|
+
memory allocated for this step.
|
1027
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
1028
|
+
Path to tmpfs mount for this step.
|
1029
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
1030
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1031
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1032
|
+
shared_memory: int, optional
|
1033
|
+
Shared memory size (in MiB) required for this step
|
1034
|
+
port: int, optional
|
1035
|
+
Port number to specify in the Kubernetes job object
|
1036
|
+
compute_pool : str, optional, default None
|
1037
|
+
Compute pool to be used for for this step.
|
1038
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
1039
|
+
hostname_resolution_timeout: int, default 10 * 60
|
1040
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
1041
|
+
Only applicable when @parallel is used.
|
1038
1042
|
"""
|
1039
1043
|
...
|
1040
1044
|
|
@@ -1096,306 +1100,163 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
1096
1100
|
...
|
1097
1101
|
|
1098
1102
|
@typing.overload
|
1099
|
-
def
|
1103
|
+
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, 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]]]:
|
1100
1104
|
"""
|
1101
|
-
Specifies
|
1105
|
+
Specifies the resources needed when executing this step.
|
1102
1106
|
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
+
Use `@resources` to specify the resource requirements
|
1108
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1109
|
+
|
1110
|
+
You can choose the compute layer on the command line by executing e.g.
|
1111
|
+
```
|
1112
|
+
python myflow.py run --with batch
|
1113
|
+
```
|
1114
|
+
or
|
1115
|
+
```
|
1116
|
+
python myflow.py run --with kubernetes
|
1117
|
+
```
|
1118
|
+
which executes the flow on the desired system using the
|
1119
|
+
requirements specified in `@resources`.
|
1107
1120
|
|
1108
1121
|
Parameters
|
1109
1122
|
----------
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1123
|
+
cpu : int, default 1
|
1124
|
+
Number of CPUs required for this step.
|
1125
|
+
gpu : int, optional, default None
|
1126
|
+
Number of GPUs required for this step.
|
1127
|
+
disk : int, optional, default None
|
1128
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1129
|
+
memory : int, default 4096
|
1130
|
+
Memory size (in MB) required for this step.
|
1131
|
+
shared_memory : int, optional, default None
|
1132
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1133
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1116
1134
|
"""
|
1117
1135
|
...
|
1118
1136
|
|
1119
1137
|
@typing.overload
|
1120
|
-
def
|
1138
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1121
1139
|
...
|
1122
1140
|
|
1123
1141
|
@typing.overload
|
1124
|
-
def
|
1142
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1125
1143
|
...
|
1126
1144
|
|
1127
|
-
def
|
1145
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
1128
1146
|
"""
|
1129
|
-
Specifies
|
1130
|
-
|
1131
|
-
The decorator will create an optional artifact, specified by `var`, which
|
1132
|
-
contains the exception raised. You can use it to detect the presence
|
1133
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1134
|
-
are missing.
|
1147
|
+
Specifies the resources needed when executing this step.
|
1135
1148
|
|
1136
|
-
|
1137
|
-
|
1138
|
-
var : str, optional, default None
|
1139
|
-
Name of the artifact in which to store the caught exception.
|
1140
|
-
If not specified, the exception is not stored.
|
1141
|
-
print_exception : bool, default True
|
1142
|
-
Determines whether or not the exception is printed to
|
1143
|
-
stdout when caught.
|
1144
|
-
"""
|
1145
|
-
...
|
1146
|
-
|
1147
|
-
@typing.overload
|
1148
|
-
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]]]:
|
1149
|
-
"""
|
1150
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
1151
|
-
the execution of a step.
|
1149
|
+
Use `@resources` to specify the resource requirements
|
1150
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1152
1151
|
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
@typing.overload
|
1165
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1166
|
-
...
|
1167
|
-
|
1168
|
-
def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
|
1169
|
-
"""
|
1170
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
1171
|
-
the execution of a step.
|
1152
|
+
You can choose the compute layer on the command line by executing e.g.
|
1153
|
+
```
|
1154
|
+
python myflow.py run --with batch
|
1155
|
+
```
|
1156
|
+
or
|
1157
|
+
```
|
1158
|
+
python myflow.py run --with kubernetes
|
1159
|
+
```
|
1160
|
+
which executes the flow on the desired system using the
|
1161
|
+
requirements specified in `@resources`.
|
1172
1162
|
|
1173
1163
|
Parameters
|
1174
1164
|
----------
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
...
|
1187
|
-
|
1188
|
-
@typing.overload
|
1189
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1190
|
-
...
|
1191
|
-
|
1192
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1193
|
-
"""
|
1194
|
-
Decorator prototype for all step decorators. This function gets specialized
|
1195
|
-
and imported for all decorators types by _import_plugin_decorators().
|
1165
|
+
cpu : int, default 1
|
1166
|
+
Number of CPUs required for this step.
|
1167
|
+
gpu : int, optional, default None
|
1168
|
+
Number of GPUs required for this step.
|
1169
|
+
disk : int, optional, default None
|
1170
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1171
|
+
memory : int, default 4096
|
1172
|
+
Memory size (in MB) required for this step.
|
1173
|
+
shared_memory : int, optional, default None
|
1174
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1175
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1196
1176
|
"""
|
1197
1177
|
...
|
1198
1178
|
|
1199
1179
|
@typing.overload
|
1200
|
-
def
|
1180
|
+
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]]]:
|
1201
1181
|
"""
|
1202
|
-
Specifies
|
1203
|
-
|
1204
|
-
Information in this decorator will augment any
|
1205
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1206
|
-
you can use `@conda_base` to set packages required by all
|
1207
|
-
steps and use `@conda` to specify step-specific overrides.
|
1182
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1208
1183
|
|
1209
1184
|
Parameters
|
1210
1185
|
----------
|
1211
|
-
|
1212
|
-
|
1213
|
-
and the value is the version to use.
|
1214
|
-
libraries : Dict[str, str], default {}
|
1215
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1216
|
-
python : str, optional, default None
|
1217
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1218
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1219
|
-
disabled : bool, default False
|
1220
|
-
If set to True, disables @conda.
|
1186
|
+
vars : Dict[str, str], default {}
|
1187
|
+
Dictionary of environment variables to set.
|
1221
1188
|
"""
|
1222
1189
|
...
|
1223
1190
|
|
1224
1191
|
@typing.overload
|
1225
|
-
def
|
1192
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1226
1193
|
...
|
1227
1194
|
|
1228
1195
|
@typing.overload
|
1229
|
-
def
|
1196
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1230
1197
|
...
|
1231
1198
|
|
1232
|
-
def
|
1199
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1233
1200
|
"""
|
1234
|
-
Specifies
|
1235
|
-
|
1236
|
-
Information in this decorator will augment any
|
1237
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1238
|
-
you can use `@conda_base` to set packages required by all
|
1239
|
-
steps and use `@conda` to specify step-specific overrides.
|
1201
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1240
1202
|
|
1241
1203
|
Parameters
|
1242
1204
|
----------
|
1243
|
-
|
1244
|
-
|
1245
|
-
and the value is the version to use.
|
1246
|
-
libraries : Dict[str, str], default {}
|
1247
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1248
|
-
python : str, optional, default None
|
1249
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1250
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1251
|
-
disabled : bool, default False
|
1252
|
-
If set to True, disables @conda.
|
1205
|
+
vars : Dict[str, str], default {}
|
1206
|
+
Dictionary of environment variables to set.
|
1253
1207
|
"""
|
1254
1208
|
...
|
1255
1209
|
|
1256
1210
|
@typing.overload
|
1257
|
-
def
|
1211
|
+
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]]]:
|
1258
1212
|
"""
|
1259
|
-
Specifies the
|
1213
|
+
Specifies the number of times the task corresponding
|
1214
|
+
to a step needs to be retried.
|
1260
1215
|
|
1261
|
-
|
1262
|
-
|
1216
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1217
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1218
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1263
1219
|
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
```
|
1268
|
-
or
|
1269
|
-
```
|
1270
|
-
python myflow.py run --with kubernetes
|
1271
|
-
```
|
1272
|
-
which executes the flow on the desired system using the
|
1273
|
-
requirements specified in `@resources`.
|
1220
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1221
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1222
|
+
ensuring that the flow execution can continue.
|
1274
1223
|
|
1275
1224
|
Parameters
|
1276
1225
|
----------
|
1277
|
-
|
1278
|
-
Number of
|
1279
|
-
|
1280
|
-
Number of
|
1281
|
-
disk : int, optional, default None
|
1282
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1283
|
-
memory : int, default 4096
|
1284
|
-
Memory size (in MB) required for this step.
|
1285
|
-
shared_memory : int, optional, default None
|
1286
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1287
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1226
|
+
times : int, default 3
|
1227
|
+
Number of times to retry this task.
|
1228
|
+
minutes_between_retries : int, default 2
|
1229
|
+
Number of minutes between retries.
|
1288
1230
|
"""
|
1289
1231
|
...
|
1290
1232
|
|
1291
1233
|
@typing.overload
|
1292
|
-
def
|
1234
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1293
1235
|
...
|
1294
1236
|
|
1295
1237
|
@typing.overload
|
1296
|
-
def
|
1238
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1297
1239
|
...
|
1298
1240
|
|
1299
|
-
def
|
1241
|
+
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):
|
1300
1242
|
"""
|
1301
|
-
Specifies the
|
1302
|
-
|
1303
|
-
Use `@resources` to specify the resource requirements
|
1304
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1243
|
+
Specifies the number of times the task corresponding
|
1244
|
+
to a step needs to be retried.
|
1305
1245
|
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
```
|
1310
|
-
or
|
1311
|
-
```
|
1312
|
-
python myflow.py run --with kubernetes
|
1313
|
-
```
|
1314
|
-
which executes the flow on the desired system using the
|
1315
|
-
requirements specified in `@resources`.
|
1246
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1247
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1248
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1316
1249
|
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
Number of CPUs required for this step.
|
1321
|
-
gpu : int, default 0
|
1322
|
-
Number of GPUs required for this step.
|
1323
|
-
disk : int, optional, default None
|
1324
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1325
|
-
memory : int, default 4096
|
1326
|
-
Memory size (in MB) required for this step.
|
1327
|
-
shared_memory : int, optional, default None
|
1328
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1329
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1330
|
-
"""
|
1331
|
-
...
|
1332
|
-
|
1333
|
-
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, node_selector: typing.Union[typing.Dict[str, str], str, None] = 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, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600) -> 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
|
-
"""
|
1335
|
-
Specifies that this step should execute on Kubernetes.
|
1250
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1251
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1252
|
+
ensuring that the flow execution can continue.
|
1336
1253
|
|
1337
1254
|
Parameters
|
1338
1255
|
----------
|
1339
|
-
|
1340
|
-
Number of
|
1341
|
-
|
1342
|
-
|
1343
|
-
Memory size (in MB) required for this step. If
|
1344
|
-
`@resources` is also present, the maximum value from all decorators is
|
1345
|
-
used.
|
1346
|
-
disk : int, default 10240
|
1347
|
-
Disk size (in MB) required for this step. If
|
1348
|
-
`@resources` is also present, the maximum value from all decorators is
|
1349
|
-
used.
|
1350
|
-
image : str, optional, default None
|
1351
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
1352
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1353
|
-
not, a default Docker image mapping to the current version of Python is used.
|
1354
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1355
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1356
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1357
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
1358
|
-
secrets : List[str], optional, default None
|
1359
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1360
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1361
|
-
in Metaflow configuration.
|
1362
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
1363
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
1364
|
-
Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
|
1365
|
-
or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
|
1366
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1367
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
1368
|
-
gpu : int, optional, default None
|
1369
|
-
Number of GPUs required for this step. A value of zero implies that
|
1370
|
-
the scheduled node should not have GPUs.
|
1371
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1372
|
-
The vendor of the GPUs to be used for this step.
|
1373
|
-
tolerations : List[str], default []
|
1374
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1375
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1376
|
-
use_tmpfs : bool, default False
|
1377
|
-
This enables an explicit tmpfs mount for this step.
|
1378
|
-
tmpfs_tempdir : bool, default True
|
1379
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1380
|
-
tmpfs_size : int, optional, default: None
|
1381
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1382
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1383
|
-
memory allocated for this step.
|
1384
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
1385
|
-
Path to tmpfs mount for this step.
|
1386
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
1387
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1388
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1389
|
-
shared_memory: int, optional
|
1390
|
-
Shared memory size (in MiB) required for this step
|
1391
|
-
port: int, optional
|
1392
|
-
Port number to specify in the Kubernetes job object
|
1393
|
-
compute_pool : str, optional, default None
|
1394
|
-
Compute pool to be used for for this step.
|
1395
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
1396
|
-
hostname_resolution_timeout: int, default 10 * 60
|
1397
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
1398
|
-
Only applicable when @parallel is used.
|
1256
|
+
times : int, default 3
|
1257
|
+
Number of times to retry this task.
|
1258
|
+
minutes_between_retries : int, default 2
|
1259
|
+
Number of minutes between retries.
|
1399
1260
|
"""
|
1400
1261
|
...
|
1401
1262
|
|
@@ -1546,6 +1407,296 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1546
1407
|
"""
|
1547
1408
|
...
|
1548
1409
|
|
1410
|
+
@typing.overload
|
1411
|
+
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]]]:
|
1412
|
+
"""
|
1413
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1414
|
+
the execution of a step.
|
1415
|
+
|
1416
|
+
Parameters
|
1417
|
+
----------
|
1418
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1419
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1420
|
+
"""
|
1421
|
+
...
|
1422
|
+
|
1423
|
+
@typing.overload
|
1424
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1425
|
+
...
|
1426
|
+
|
1427
|
+
@typing.overload
|
1428
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1429
|
+
...
|
1430
|
+
|
1431
|
+
def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
|
1432
|
+
"""
|
1433
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1434
|
+
the execution of a step.
|
1435
|
+
|
1436
|
+
Parameters
|
1437
|
+
----------
|
1438
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1439
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1440
|
+
"""
|
1441
|
+
...
|
1442
|
+
|
1443
|
+
@typing.overload
|
1444
|
+
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]]]:
|
1445
|
+
"""
|
1446
|
+
Specifies the Conda environment for the step.
|
1447
|
+
|
1448
|
+
Information in this decorator will augment any
|
1449
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1450
|
+
you can use `@conda_base` to set packages required by all
|
1451
|
+
steps and use `@conda` to specify step-specific overrides.
|
1452
|
+
|
1453
|
+
Parameters
|
1454
|
+
----------
|
1455
|
+
packages : Dict[str, str], default {}
|
1456
|
+
Packages to use for this step. The key is the name of the package
|
1457
|
+
and the value is the version to use.
|
1458
|
+
libraries : Dict[str, str], default {}
|
1459
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1460
|
+
python : str, optional, default None
|
1461
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1462
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1463
|
+
disabled : bool, default False
|
1464
|
+
If set to True, disables @conda.
|
1465
|
+
"""
|
1466
|
+
...
|
1467
|
+
|
1468
|
+
@typing.overload
|
1469
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1470
|
+
...
|
1471
|
+
|
1472
|
+
@typing.overload
|
1473
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1474
|
+
...
|
1475
|
+
|
1476
|
+
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):
|
1477
|
+
"""
|
1478
|
+
Specifies the Conda environment for the step.
|
1479
|
+
|
1480
|
+
Information in this decorator will augment any
|
1481
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1482
|
+
you can use `@conda_base` to set packages required by all
|
1483
|
+
steps and use `@conda` to specify step-specific overrides.
|
1484
|
+
|
1485
|
+
Parameters
|
1486
|
+
----------
|
1487
|
+
packages : Dict[str, str], default {}
|
1488
|
+
Packages to use for this step. The key is the name of the package
|
1489
|
+
and the value is the version to use.
|
1490
|
+
libraries : Dict[str, str], default {}
|
1491
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1492
|
+
python : str, optional, default None
|
1493
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1494
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1495
|
+
disabled : bool, default False
|
1496
|
+
If set to True, disables @conda.
|
1497
|
+
"""
|
1498
|
+
...
|
1499
|
+
|
1500
|
+
@typing.overload
|
1501
|
+
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]]]:
|
1502
|
+
"""
|
1503
|
+
Specifies that the step will success under all circumstances.
|
1504
|
+
|
1505
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1506
|
+
contains the exception raised. You can use it to detect the presence
|
1507
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1508
|
+
are missing.
|
1509
|
+
|
1510
|
+
Parameters
|
1511
|
+
----------
|
1512
|
+
var : str, optional, default None
|
1513
|
+
Name of the artifact in which to store the caught exception.
|
1514
|
+
If not specified, the exception is not stored.
|
1515
|
+
print_exception : bool, default True
|
1516
|
+
Determines whether or not the exception is printed to
|
1517
|
+
stdout when caught.
|
1518
|
+
"""
|
1519
|
+
...
|
1520
|
+
|
1521
|
+
@typing.overload
|
1522
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1523
|
+
...
|
1524
|
+
|
1525
|
+
@typing.overload
|
1526
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1527
|
+
...
|
1528
|
+
|
1529
|
+
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):
|
1530
|
+
"""
|
1531
|
+
Specifies that the step will success under all circumstances.
|
1532
|
+
|
1533
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1534
|
+
contains the exception raised. You can use it to detect the presence
|
1535
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1536
|
+
are missing.
|
1537
|
+
|
1538
|
+
Parameters
|
1539
|
+
----------
|
1540
|
+
var : str, optional, default None
|
1541
|
+
Name of the artifact in which to store the caught exception.
|
1542
|
+
If not specified, the exception is not stored.
|
1543
|
+
print_exception : bool, default True
|
1544
|
+
Determines whether or not the exception is printed to
|
1545
|
+
stdout when caught.
|
1546
|
+
"""
|
1547
|
+
...
|
1548
|
+
|
1549
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1550
|
+
"""
|
1551
|
+
Specifies what flows belong to the same project.
|
1552
|
+
|
1553
|
+
A project-specific namespace is created for all flows that
|
1554
|
+
use the same `@project(name)`.
|
1555
|
+
|
1556
|
+
Parameters
|
1557
|
+
----------
|
1558
|
+
name : str
|
1559
|
+
Project name. Make sure that the name is unique amongst all
|
1560
|
+
projects that use the same production scheduler. The name may
|
1561
|
+
contain only lowercase alphanumeric characters and underscores.
|
1562
|
+
|
1563
|
+
|
1564
|
+
"""
|
1565
|
+
...
|
1566
|
+
|
1567
|
+
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]]:
|
1568
|
+
"""
|
1569
|
+
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.
|
1570
|
+
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.
|
1571
|
+
|
1572
|
+
Parameters
|
1573
|
+
----------
|
1574
|
+
timeout : int
|
1575
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1576
|
+
poke_interval : int
|
1577
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1578
|
+
mode : str
|
1579
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1580
|
+
exponential_backoff : bool
|
1581
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1582
|
+
pool : str
|
1583
|
+
the slot pool this task should run in,
|
1584
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1585
|
+
soft_fail : bool
|
1586
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1587
|
+
name : str
|
1588
|
+
Name of the sensor on Airflow
|
1589
|
+
description : str
|
1590
|
+
Description of sensor in the Airflow UI
|
1591
|
+
external_dag_id : str
|
1592
|
+
The dag_id that contains the task you want to wait for.
|
1593
|
+
external_task_ids : List[str]
|
1594
|
+
The list of task_ids that you want to wait for.
|
1595
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1596
|
+
allowed_states : List[str]
|
1597
|
+
Iterable of allowed states, (Default: ['success'])
|
1598
|
+
failed_states : List[str]
|
1599
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1600
|
+
execution_delta : datetime.timedelta
|
1601
|
+
time difference with the previous execution to look at,
|
1602
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1603
|
+
check_existence: bool
|
1604
|
+
Set to True to check if the external task exists or check if
|
1605
|
+
the DAG to wait for exists. (Default: True)
|
1606
|
+
"""
|
1607
|
+
...
|
1608
|
+
|
1609
|
+
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]]:
|
1610
|
+
"""
|
1611
|
+
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)
|
1612
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1613
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1614
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1615
|
+
starts only after all sensors finish.
|
1616
|
+
|
1617
|
+
Parameters
|
1618
|
+
----------
|
1619
|
+
timeout : int
|
1620
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1621
|
+
poke_interval : int
|
1622
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1623
|
+
mode : str
|
1624
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1625
|
+
exponential_backoff : bool
|
1626
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1627
|
+
pool : str
|
1628
|
+
the slot pool this task should run in,
|
1629
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1630
|
+
soft_fail : bool
|
1631
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1632
|
+
name : str
|
1633
|
+
Name of the sensor on Airflow
|
1634
|
+
description : str
|
1635
|
+
Description of sensor in the Airflow UI
|
1636
|
+
bucket_key : Union[str, List[str]]
|
1637
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1638
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1639
|
+
bucket_name : str
|
1640
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1641
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1642
|
+
wildcard_match : bool
|
1643
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1644
|
+
aws_conn_id : str
|
1645
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1646
|
+
verify : bool
|
1647
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1648
|
+
"""
|
1649
|
+
...
|
1650
|
+
|
1651
|
+
@typing.overload
|
1652
|
+
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]]:
|
1653
|
+
"""
|
1654
|
+
Specifies the times when the flow should be run when running on a
|
1655
|
+
production scheduler.
|
1656
|
+
|
1657
|
+
Parameters
|
1658
|
+
----------
|
1659
|
+
hourly : bool, default False
|
1660
|
+
Run the workflow hourly.
|
1661
|
+
daily : bool, default True
|
1662
|
+
Run the workflow daily.
|
1663
|
+
weekly : bool, default False
|
1664
|
+
Run the workflow weekly.
|
1665
|
+
cron : str, optional, default None
|
1666
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1667
|
+
specified by this expression.
|
1668
|
+
timezone : str, optional, default None
|
1669
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1670
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1671
|
+
"""
|
1672
|
+
...
|
1673
|
+
|
1674
|
+
@typing.overload
|
1675
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1676
|
+
...
|
1677
|
+
|
1678
|
+
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):
|
1679
|
+
"""
|
1680
|
+
Specifies the times when the flow should be run when running on a
|
1681
|
+
production scheduler.
|
1682
|
+
|
1683
|
+
Parameters
|
1684
|
+
----------
|
1685
|
+
hourly : bool, default False
|
1686
|
+
Run the workflow hourly.
|
1687
|
+
daily : bool, default True
|
1688
|
+
Run the workflow daily.
|
1689
|
+
weekly : bool, default False
|
1690
|
+
Run the workflow weekly.
|
1691
|
+
cron : str, optional, default None
|
1692
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1693
|
+
specified by this expression.
|
1694
|
+
timezone : str, optional, default None
|
1695
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1696
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1697
|
+
"""
|
1698
|
+
...
|
1699
|
+
|
1549
1700
|
@typing.overload
|
1550
1701
|
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1551
1702
|
"""
|
@@ -1641,97 +1792,6 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1641
1792
|
"""
|
1642
1793
|
...
|
1643
1794
|
|
1644
|
-
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]]:
|
1645
|
-
"""
|
1646
|
-
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.
|
1647
|
-
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.
|
1648
|
-
|
1649
|
-
Parameters
|
1650
|
-
----------
|
1651
|
-
timeout : int
|
1652
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1653
|
-
poke_interval : int
|
1654
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1655
|
-
mode : str
|
1656
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1657
|
-
exponential_backoff : bool
|
1658
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1659
|
-
pool : str
|
1660
|
-
the slot pool this task should run in,
|
1661
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1662
|
-
soft_fail : bool
|
1663
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1664
|
-
name : str
|
1665
|
-
Name of the sensor on Airflow
|
1666
|
-
description : str
|
1667
|
-
Description of sensor in the Airflow UI
|
1668
|
-
external_dag_id : str
|
1669
|
-
The dag_id that contains the task you want to wait for.
|
1670
|
-
external_task_ids : List[str]
|
1671
|
-
The list of task_ids that you want to wait for.
|
1672
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1673
|
-
allowed_states : List[str]
|
1674
|
-
Iterable of allowed states, (Default: ['success'])
|
1675
|
-
failed_states : List[str]
|
1676
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1677
|
-
execution_delta : datetime.timedelta
|
1678
|
-
time difference with the previous execution to look at,
|
1679
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1680
|
-
check_existence: bool
|
1681
|
-
Set to True to check if the external task exists or check if
|
1682
|
-
the DAG to wait for exists. (Default: True)
|
1683
|
-
"""
|
1684
|
-
...
|
1685
|
-
|
1686
|
-
@typing.overload
|
1687
|
-
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]]:
|
1688
|
-
"""
|
1689
|
-
Specifies the times when the flow should be run when running on a
|
1690
|
-
production scheduler.
|
1691
|
-
|
1692
|
-
Parameters
|
1693
|
-
----------
|
1694
|
-
hourly : bool, default False
|
1695
|
-
Run the workflow hourly.
|
1696
|
-
daily : bool, default True
|
1697
|
-
Run the workflow daily.
|
1698
|
-
weekly : bool, default False
|
1699
|
-
Run the workflow weekly.
|
1700
|
-
cron : str, optional, default None
|
1701
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1702
|
-
specified by this expression.
|
1703
|
-
timezone : str, optional, default None
|
1704
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1705
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1706
|
-
"""
|
1707
|
-
...
|
1708
|
-
|
1709
|
-
@typing.overload
|
1710
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1711
|
-
...
|
1712
|
-
|
1713
|
-
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):
|
1714
|
-
"""
|
1715
|
-
Specifies the times when the flow should be run when running on a
|
1716
|
-
production scheduler.
|
1717
|
-
|
1718
|
-
Parameters
|
1719
|
-
----------
|
1720
|
-
hourly : bool, default False
|
1721
|
-
Run the workflow hourly.
|
1722
|
-
daily : bool, default True
|
1723
|
-
Run the workflow daily.
|
1724
|
-
weekly : bool, default False
|
1725
|
-
Run the workflow weekly.
|
1726
|
-
cron : str, optional, default None
|
1727
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1728
|
-
specified by this expression.
|
1729
|
-
timezone : str, optional, default None
|
1730
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1731
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1732
|
-
"""
|
1733
|
-
...
|
1734
|
-
|
1735
1795
|
@typing.overload
|
1736
1796
|
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1737
1797
|
"""
|
@@ -1771,63 +1831,52 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
1771
1831
|
"""
|
1772
1832
|
...
|
1773
1833
|
|
1774
|
-
|
1834
|
+
@typing.overload
|
1835
|
+
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]]:
|
1775
1836
|
"""
|
1776
|
-
Specifies
|
1837
|
+
Specifies the Conda environment for all steps of the flow.
|
1777
1838
|
|
1778
|
-
|
1779
|
-
use
|
1839
|
+
Use `@conda_base` to set common libraries required by all
|
1840
|
+
steps and use `@conda` to specify step-specific additions.
|
1780
1841
|
|
1781
1842
|
Parameters
|
1782
1843
|
----------
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1844
|
+
packages : Dict[str, str], default {}
|
1845
|
+
Packages to use for this flow. The key is the name of the package
|
1846
|
+
and the value is the version to use.
|
1847
|
+
libraries : Dict[str, str], default {}
|
1848
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1849
|
+
python : str, optional, default None
|
1850
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1851
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1852
|
+
disabled : bool, default False
|
1853
|
+
If set to True, disables Conda.
|
1789
1854
|
"""
|
1790
1855
|
...
|
1791
1856
|
|
1792
|
-
|
1857
|
+
@typing.overload
|
1858
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1859
|
+
...
|
1860
|
+
|
1861
|
+
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):
|
1793
1862
|
"""
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
starts only after all sensors finish.
|
1863
|
+
Specifies the Conda environment for all steps of the flow.
|
1864
|
+
|
1865
|
+
Use `@conda_base` to set common libraries required by all
|
1866
|
+
steps and use `@conda` to specify step-specific additions.
|
1799
1867
|
|
1800
1868
|
Parameters
|
1801
1869
|
----------
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1813
|
-
soft_fail : bool
|
1814
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1815
|
-
name : str
|
1816
|
-
Name of the sensor on Airflow
|
1817
|
-
description : str
|
1818
|
-
Description of sensor in the Airflow UI
|
1819
|
-
bucket_key : Union[str, List[str]]
|
1820
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1821
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1822
|
-
bucket_name : str
|
1823
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1824
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1825
|
-
wildcard_match : bool
|
1826
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1827
|
-
aws_conn_id : str
|
1828
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1829
|
-
verify : bool
|
1830
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1870
|
+
packages : Dict[str, str], default {}
|
1871
|
+
Packages to use for this flow. The key is the name of the package
|
1872
|
+
and the value is the version to use.
|
1873
|
+
libraries : Dict[str, str], default {}
|
1874
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1875
|
+
python : str, optional, default None
|
1876
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1877
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1878
|
+
disabled : bool, default False
|
1879
|
+
If set to True, disables Conda.
|
1831
1880
|
"""
|
1832
1881
|
...
|
1833
1882
|
|
@@ -1934,55 +1983,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1934
1983
|
"""
|
1935
1984
|
...
|
1936
1985
|
|
1937
|
-
@typing.overload
|
1938
|
-
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]]:
|
1939
|
-
"""
|
1940
|
-
Specifies the Conda environment for all steps of the flow.
|
1941
|
-
|
1942
|
-
Use `@conda_base` to set common libraries required by all
|
1943
|
-
steps and use `@conda` to specify step-specific additions.
|
1944
|
-
|
1945
|
-
Parameters
|
1946
|
-
----------
|
1947
|
-
packages : Dict[str, str], default {}
|
1948
|
-
Packages to use for this flow. The key is the name of the package
|
1949
|
-
and the value is the version to use.
|
1950
|
-
libraries : Dict[str, str], default {}
|
1951
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1952
|
-
python : str, optional, default None
|
1953
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1954
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1955
|
-
disabled : bool, default False
|
1956
|
-
If set to True, disables Conda.
|
1957
|
-
"""
|
1958
|
-
...
|
1959
|
-
|
1960
|
-
@typing.overload
|
1961
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1962
|
-
...
|
1963
|
-
|
1964
|
-
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):
|
1965
|
-
"""
|
1966
|
-
Specifies the Conda environment for all steps of the flow.
|
1967
|
-
|
1968
|
-
Use `@conda_base` to set common libraries required by all
|
1969
|
-
steps and use `@conda` to specify step-specific additions.
|
1970
|
-
|
1971
|
-
Parameters
|
1972
|
-
----------
|
1973
|
-
packages : Dict[str, str], default {}
|
1974
|
-
Packages to use for this flow. The key is the name of the package
|
1975
|
-
and the value is the version to use.
|
1976
|
-
libraries : Dict[str, str], default {}
|
1977
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1978
|
-
python : str, optional, default None
|
1979
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1980
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1981
|
-
disabled : bool, default False
|
1982
|
-
If set to True, disables Conda.
|
1983
|
-
"""
|
1984
|
-
...
|
1985
|
-
|
1986
1986
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1987
1987
|
"""
|
1988
1988
|
Switch namespace to the one provided.
|
@@ -2074,7 +2074,7 @@ class Metaflow(object, metaclass=type):
|
|
2074
2074
|
flows present in the current namespace will be returned. A `Flow` is present in a namespace
|
2075
2075
|
if it has at least one run in the namespace.
|
2076
2076
|
"""
|
2077
|
-
def __init__(self):
|
2077
|
+
def __init__(self, _current_metadata: typing.Optional[str] = None):
|
2078
2078
|
...
|
2079
2079
|
@property
|
2080
2080
|
def flows(self) -> typing.List[metaflow.client.core.Flow]:
|