metaflow-stubs 2.12.24__py2.py3-none-any.whl → 2.12.26__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 +637 -634
- metaflow-stubs/cards.pyi +5 -5
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +3 -3
- metaflow-stubs/client/core.pyi +5 -5
- 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 +3 -3
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +29 -28
- 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 +3 -3
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow.pyi +3 -3
- metaflow-stubs/plugins/airflow/airflow_cli.pyi +5 -2
- 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 +2 -2
- 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 +11 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +6 -6
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +10 -7
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +6 -6
- 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 +2 -2
- 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 +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 +3 -3
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/s3/s3.pyi +5 -5
- 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 +8 -7
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
- 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 +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +7 -4
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +5 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/logs_cli.pyi +2 -2
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +7 -6
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +5 -8
- metaflow-stubs/runner/nbdeploy.pyi +5 -7
- metaflow-stubs/runner/nbrun.pyi +5 -7
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +2 -6
- 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.24.dist-info → metaflow_stubs-2.12.26.dist-info}/METADATA +2 -2
- metaflow_stubs-2.12.26.dist-info/RECORD +152 -0
- {metaflow_stubs-2.12.24.dist-info → metaflow_stubs-2.12.26.dist-info}/WHEEL +1 -1
- metaflow_stubs-2.12.24.dist-info/RECORD +0 -152
- {metaflow_stubs-2.12.24.dist-info → metaflow_stubs-2.12.26.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.26 #
|
4
|
+
# Generated on 2024-10-23T21:00:22.846814 #
|
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.
|
12
|
-
import metaflow._vendor.click.types
|
13
|
-
import metaflow.datastore.inputs
|
11
|
+
import metaflow.flowspec
|
14
12
|
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
|
15
18
|
import typing
|
19
|
+
import metaflow._vendor.click.types
|
16
20
|
import metaflow.events
|
17
|
-
import metaflow.
|
18
|
-
import metaflow.flowspec
|
21
|
+
import metaflow.metaflow_current
|
19
22
|
import metaflow.plugins.datatools.s3.s3
|
20
|
-
import io
|
21
|
-
import datetime
|
22
|
-
import metaflow.runner.metaflow_runner
|
23
23
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
24
24
|
StepFlag = typing.NewType("StepFlag", bool)
|
25
25
|
|
@@ -855,79 +855,186 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
855
855
|
...
|
856
856
|
|
857
857
|
@typing.overload
|
858
|
-
def
|
858
|
+
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]]]:
|
859
859
|
"""
|
860
|
-
|
860
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
861
861
|
|
862
|
-
|
863
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
862
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
864
863
|
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
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.
|
875
892
|
|
876
893
|
Parameters
|
877
894
|
----------
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
This parameter maps to the `--shm-size` option in Docker.
|
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
|
+
|
889
905
|
"""
|
890
906
|
...
|
891
907
|
|
892
908
|
@typing.overload
|
893
|
-
def
|
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]]]:
|
910
|
+
"""
|
911
|
+
Specifies environment variables to be set prior to the execution of a step.
|
912
|
+
|
913
|
+
Parameters
|
914
|
+
----------
|
915
|
+
vars : Dict[str, str], default {}
|
916
|
+
Dictionary of environment variables to set.
|
917
|
+
"""
|
894
918
|
...
|
895
919
|
|
896
920
|
@typing.overload
|
897
|
-
def
|
921
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
898
922
|
...
|
899
923
|
|
900
|
-
|
924
|
+
@typing.overload
|
925
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
926
|
+
...
|
927
|
+
|
928
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
901
929
|
"""
|
902
|
-
Specifies
|
930
|
+
Specifies environment variables to be set prior to the execution of a step.
|
903
931
|
|
904
|
-
|
905
|
-
|
932
|
+
Parameters
|
933
|
+
----------
|
934
|
+
vars : Dict[str, str], default {}
|
935
|
+
Dictionary of environment variables to set.
|
936
|
+
"""
|
937
|
+
...
|
938
|
+
|
939
|
+
@typing.overload
|
940
|
+
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]]]:
|
941
|
+
"""
|
942
|
+
Specifies the PyPI packages for the step.
|
906
943
|
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
or
|
912
|
-
```
|
913
|
-
python myflow.py run --with kubernetes
|
914
|
-
```
|
915
|
-
which executes the flow on the desired system using the
|
916
|
-
requirements specified in `@resources`.
|
944
|
+
Information in this decorator will augment any
|
945
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
946
|
+
you can use `@pypi_base` to set packages required by all
|
947
|
+
steps and use `@pypi` to specify step-specific overrides.
|
917
948
|
|
918
949
|
Parameters
|
919
950
|
----------
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
951
|
+
packages : Dict[str, str], default: {}
|
952
|
+
Packages to use for this step. The key is the name of the package
|
953
|
+
and the value is the version to use.
|
954
|
+
python : str, optional, default: None
|
955
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
956
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
957
|
+
"""
|
958
|
+
...
|
959
|
+
|
960
|
+
@typing.overload
|
961
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
962
|
+
...
|
963
|
+
|
964
|
+
@typing.overload
|
965
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
966
|
+
...
|
967
|
+
|
968
|
+
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):
|
969
|
+
"""
|
970
|
+
Specifies the PyPI packages for the step.
|
971
|
+
|
972
|
+
Information in this decorator will augment any
|
973
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
974
|
+
you can use `@pypi_base` to set packages required by all
|
975
|
+
steps and use `@pypi` to specify step-specific overrides.
|
976
|
+
|
977
|
+
Parameters
|
978
|
+
----------
|
979
|
+
packages : Dict[str, str], default: {}
|
980
|
+
Packages to use for this step. The key is the name of the package
|
981
|
+
and the value is the version to use.
|
982
|
+
python : str, optional, default: None
|
983
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
984
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
985
|
+
"""
|
986
|
+
...
|
987
|
+
|
988
|
+
@typing.overload
|
989
|
+
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]]]:
|
990
|
+
"""
|
991
|
+
Specifies the number of times the task corresponding
|
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)`.
|
997
|
+
|
998
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
999
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1000
|
+
ensuring that the flow execution can continue.
|
1001
|
+
|
1002
|
+
Parameters
|
1003
|
+
----------
|
1004
|
+
times : int, default 3
|
1005
|
+
Number of times to retry this task.
|
1006
|
+
minutes_between_retries : int, default 2
|
1007
|
+
Number of minutes between retries.
|
1008
|
+
"""
|
1009
|
+
...
|
1010
|
+
|
1011
|
+
@typing.overload
|
1012
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1013
|
+
...
|
1014
|
+
|
1015
|
+
@typing.overload
|
1016
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1017
|
+
...
|
1018
|
+
|
1019
|
+
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):
|
1020
|
+
"""
|
1021
|
+
Specifies the number of times the task corresponding
|
1022
|
+
to a step needs to be retried.
|
1023
|
+
|
1024
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
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)`.
|
1027
|
+
|
1028
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1029
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1030
|
+
ensuring that the flow execution can continue.
|
1031
|
+
|
1032
|
+
Parameters
|
1033
|
+
----------
|
1034
|
+
times : int, default 3
|
1035
|
+
Number of times to retry this task.
|
1036
|
+
minutes_between_retries : int, default 2
|
1037
|
+
Number of minutes between retries.
|
931
1038
|
"""
|
932
1039
|
...
|
933
1040
|
|
@@ -989,59 +1096,37 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
989
1096
|
...
|
990
1097
|
|
991
1098
|
@typing.overload
|
992
|
-
def
|
1099
|
+
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]]]:
|
993
1100
|
"""
|
994
|
-
Specifies
|
1101
|
+
Specifies that the step will success under all circumstances.
|
1102
|
+
|
1103
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1104
|
+
contains the exception raised. You can use it to detect the presence
|
1105
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1106
|
+
are missing.
|
995
1107
|
|
996
1108
|
Parameters
|
997
1109
|
----------
|
998
|
-
|
999
|
-
|
1110
|
+
var : str, optional, default None
|
1111
|
+
Name of the artifact in which to store the caught exception.
|
1112
|
+
If not specified, the exception is not stored.
|
1113
|
+
print_exception : bool, default True
|
1114
|
+
Determines whether or not the exception is printed to
|
1115
|
+
stdout when caught.
|
1000
1116
|
"""
|
1001
1117
|
...
|
1002
1118
|
|
1003
1119
|
@typing.overload
|
1004
|
-
def
|
1120
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1005
1121
|
...
|
1006
1122
|
|
1007
1123
|
@typing.overload
|
1008
|
-
def
|
1124
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1009
1125
|
...
|
1010
1126
|
|
1011
|
-
def
|
1127
|
+
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):
|
1012
1128
|
"""
|
1013
|
-
Specifies
|
1014
|
-
|
1015
|
-
Parameters
|
1016
|
-
----------
|
1017
|
-
vars : Dict[str, str], default {}
|
1018
|
-
Dictionary of environment variables to set.
|
1019
|
-
"""
|
1020
|
-
...
|
1021
|
-
|
1022
|
-
@typing.overload
|
1023
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1024
|
-
"""
|
1025
|
-
Decorator prototype for all step decorators. This function gets specialized
|
1026
|
-
and imported for all decorators types by _import_plugin_decorators().
|
1027
|
-
"""
|
1028
|
-
...
|
1029
|
-
|
1030
|
-
@typing.overload
|
1031
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1032
|
-
...
|
1033
|
-
|
1034
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1035
|
-
"""
|
1036
|
-
Decorator prototype for all step decorators. This function gets specialized
|
1037
|
-
and imported for all decorators types by _import_plugin_decorators().
|
1038
|
-
"""
|
1039
|
-
...
|
1040
|
-
|
1041
|
-
@typing.overload
|
1042
|
-
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]]]:
|
1043
|
-
"""
|
1044
|
-
Specifies that the step will success under all circumstances.
|
1129
|
+
Specifies that the step will success under all circumstances.
|
1045
1130
|
|
1046
1131
|
The decorator will create an optional artifact, specified by `var`, which
|
1047
1132
|
contains the exception raised. You can use it to detect the presence
|
@@ -1060,227 +1145,277 @@ def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) ->
|
|
1060
1145
|
...
|
1061
1146
|
|
1062
1147
|
@typing.overload
|
1063
|
-
def
|
1064
|
-
...
|
1065
|
-
|
1066
|
-
@typing.overload
|
1067
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1068
|
-
...
|
1069
|
-
|
1070
|
-
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):
|
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]]]:
|
1071
1149
|
"""
|
1072
|
-
Specifies
|
1073
|
-
|
1074
|
-
The decorator will create an optional artifact, specified by `var`, which
|
1075
|
-
contains the exception raised. You can use it to detect the presence
|
1076
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1077
|
-
are missing.
|
1150
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1151
|
+
the execution of a step.
|
1078
1152
|
|
1079
1153
|
Parameters
|
1080
1154
|
----------
|
1081
|
-
|
1082
|
-
|
1083
|
-
If not specified, the exception is not stored.
|
1084
|
-
print_exception : bool, default True
|
1085
|
-
Determines whether or not the exception is printed to
|
1086
|
-
stdout when caught.
|
1155
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1156
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1087
1157
|
"""
|
1088
1158
|
...
|
1089
1159
|
|
1090
1160
|
@typing.overload
|
1091
|
-
def
|
1161
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
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]]] = []):
|
1092
1169
|
"""
|
1093
|
-
|
1094
|
-
|
1095
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1170
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1171
|
+
the execution of a step.
|
1096
1172
|
|
1097
1173
|
Parameters
|
1098
1174
|
----------
|
1099
|
-
|
1100
|
-
|
1101
|
-
id : str, optional, default None
|
1102
|
-
If multiple cards are present, use this id to identify this card.
|
1103
|
-
options : Dict[str, Any], default {}
|
1104
|
-
Options passed to the card. The contents depend on the card type.
|
1105
|
-
timeout : int, default 45
|
1106
|
-
Interrupt reporting if it takes more than this many seconds.
|
1107
|
-
|
1108
|
-
|
1175
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1176
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1109
1177
|
"""
|
1110
1178
|
...
|
1111
1179
|
|
1112
1180
|
@typing.overload
|
1113
|
-
def
|
1181
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1182
|
+
"""
|
1183
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1184
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1185
|
+
"""
|
1114
1186
|
...
|
1115
1187
|
|
1116
1188
|
@typing.overload
|
1117
|
-
def
|
1189
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1118
1190
|
...
|
1119
1191
|
|
1120
|
-
def
|
1192
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1121
1193
|
"""
|
1122
|
-
|
1123
|
-
|
1124
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1125
|
-
|
1126
|
-
Parameters
|
1127
|
-
----------
|
1128
|
-
type : str, default 'default'
|
1129
|
-
Card type.
|
1130
|
-
id : str, optional, default None
|
1131
|
-
If multiple cards are present, use this id to identify this card.
|
1132
|
-
options : Dict[str, Any], default {}
|
1133
|
-
Options passed to the card. The contents depend on the card type.
|
1134
|
-
timeout : int, default 45
|
1135
|
-
Interrupt reporting if it takes more than this many seconds.
|
1136
|
-
|
1137
|
-
|
1194
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1195
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1138
1196
|
"""
|
1139
1197
|
...
|
1140
1198
|
|
1141
1199
|
@typing.overload
|
1142
|
-
def
|
1200
|
+
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]]]:
|
1143
1201
|
"""
|
1144
|
-
Specifies the
|
1202
|
+
Specifies the Conda environment for the step.
|
1145
1203
|
|
1146
1204
|
Information in this decorator will augment any
|
1147
|
-
attributes set in the `@
|
1148
|
-
you can use `@
|
1149
|
-
steps and use `@
|
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.
|
1150
1208
|
|
1151
1209
|
Parameters
|
1152
1210
|
----------
|
1153
|
-
packages : Dict[str, str], default
|
1211
|
+
packages : Dict[str, str], default {}
|
1154
1212
|
Packages to use for this step. The key is the name of the package
|
1155
1213
|
and the value is the version to use.
|
1156
|
-
|
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
|
1157
1217
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1158
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.
|
1159
1221
|
"""
|
1160
1222
|
...
|
1161
1223
|
|
1162
1224
|
@typing.overload
|
1163
|
-
def
|
1225
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1164
1226
|
...
|
1165
1227
|
|
1166
1228
|
@typing.overload
|
1167
|
-
def
|
1229
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1168
1230
|
...
|
1169
1231
|
|
1170
|
-
def
|
1232
|
+
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):
|
1171
1233
|
"""
|
1172
|
-
Specifies the
|
1234
|
+
Specifies the Conda environment for the step.
|
1173
1235
|
|
1174
1236
|
Information in this decorator will augment any
|
1175
|
-
attributes set in the `@
|
1176
|
-
you can use `@
|
1177
|
-
steps and use `@
|
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.
|
1178
1240
|
|
1179
1241
|
Parameters
|
1180
1242
|
----------
|
1181
|
-
packages : Dict[str, str], default
|
1243
|
+
packages : Dict[str, str], default {}
|
1182
1244
|
Packages to use for this step. The key is the name of the package
|
1183
1245
|
and the value is the version to use.
|
1184
|
-
|
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
|
1185
1249
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1186
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.
|
1187
1253
|
"""
|
1188
1254
|
...
|
1189
1255
|
|
1190
1256
|
@typing.overload
|
1191
|
-
def
|
1257
|
+
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]]]:
|
1192
1258
|
"""
|
1193
|
-
Specifies
|
1259
|
+
Specifies the resources needed when executing this step.
|
1260
|
+
|
1261
|
+
Use `@resources` to specify the resource requirements
|
1262
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1263
|
+
|
1264
|
+
You can choose the compute layer on the command line by executing e.g.
|
1265
|
+
```
|
1266
|
+
python myflow.py run --with batch
|
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`.
|
1194
1274
|
|
1195
1275
|
Parameters
|
1196
1276
|
----------
|
1197
1277
|
cpu : int, default 1
|
1198
|
-
Number of CPUs required for this step.
|
1199
|
-
also present, the maximum value from all decorators is used.
|
1278
|
+
Number of CPUs required for this step.
|
1200
1279
|
gpu : int, default 0
|
1201
|
-
Number of GPUs required for this step.
|
1202
|
-
|
1280
|
+
Number of GPUs required for this step.
|
1281
|
+
disk : int, optional, default None
|
1282
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1203
1283
|
memory : int, default 4096
|
1204
|
-
Memory size (in MB) required for this step.
|
1205
|
-
`@resources` is also present, the maximum value from all decorators is
|
1206
|
-
used.
|
1207
|
-
image : str, optional, default None
|
1208
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
1209
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
1210
|
-
not, a default Docker image mapping to the current version of Python is used.
|
1211
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
1212
|
-
AWS Batch Job Queue to submit the job to.
|
1213
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
1214
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
1215
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
1216
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
1217
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
1284
|
+
Memory size (in MB) required for this step.
|
1218
1285
|
shared_memory : int, optional, default None
|
1219
1286
|
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1220
1287
|
This parameter maps to the `--shm-size` option in Docker.
|
1221
|
-
max_swap : int, optional, default None
|
1222
|
-
The total amount of swap memory (in MiB) a container can use for this
|
1223
|
-
step. This parameter is translated to the `--memory-swap` option in
|
1224
|
-
Docker where the value is the sum of the container memory plus the
|
1225
|
-
`max_swap` value.
|
1226
|
-
swappiness : int, optional, default None
|
1227
|
-
This allows you to tune memory swappiness behavior for this step.
|
1228
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
1229
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
1230
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
1231
|
-
use_tmpfs : bool, default False
|
1232
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
1233
|
-
not available on Fargate compute environments
|
1234
|
-
tmpfs_tempdir : bool, default True
|
1235
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1236
|
-
tmpfs_size : int, optional, default None
|
1237
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1238
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1239
|
-
memory allocated for this step.
|
1240
|
-
tmpfs_path : str, optional, default None
|
1241
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1242
|
-
inferentia : int, default 0
|
1243
|
-
Number of Inferentia chips required for this step.
|
1244
|
-
trainium : int, default None
|
1245
|
-
Alias for inferentia. Use only one of the two.
|
1246
|
-
efa : int, default 0
|
1247
|
-
Number of elastic fabric adapter network devices to attach to container
|
1248
|
-
ephemeral_storage : int, default None
|
1249
|
-
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
1250
|
-
This is only relevant for Fargate compute environments
|
1251
|
-
log_driver: str, optional, default None
|
1252
|
-
The log driver to use for the Amazon ECS container.
|
1253
|
-
log_options: List[str], optional, default None
|
1254
|
-
List of strings containing options for the chosen log driver. The configurable values
|
1255
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1256
|
-
Example: [`awslogs-group:aws/batch/job`]
|
1257
1288
|
"""
|
1258
1289
|
...
|
1259
1290
|
|
1260
1291
|
@typing.overload
|
1261
|
-
def
|
1292
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1262
1293
|
...
|
1263
1294
|
|
1264
1295
|
@typing.overload
|
1265
|
-
def
|
1296
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1266
1297
|
...
|
1267
1298
|
|
1268
|
-
def
|
1299
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
1269
1300
|
"""
|
1270
|
-
Specifies
|
1301
|
+
Specifies the resources needed when executing this step.
|
1302
|
+
|
1303
|
+
Use `@resources` to specify the resource requirements
|
1304
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1305
|
+
|
1306
|
+
You can choose the compute layer on the command line by executing e.g.
|
1307
|
+
```
|
1308
|
+
python myflow.py run --with batch
|
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`.
|
1271
1316
|
|
1272
1317
|
Parameters
|
1273
1318
|
----------
|
1274
1319
|
cpu : int, default 1
|
1275
|
-
Number of CPUs required for this step.
|
1276
|
-
also present, the maximum value from all decorators is used.
|
1320
|
+
Number of CPUs required for this step.
|
1277
1321
|
gpu : int, default 0
|
1278
|
-
Number of GPUs required for this step.
|
1279
|
-
|
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.
|
1280
1325
|
memory : int, default 4096
|
1281
|
-
Memory size (in MB) required for this step.
|
1282
|
-
|
1283
|
-
|
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.
|
1336
|
+
|
1337
|
+
Parameters
|
1338
|
+
----------
|
1339
|
+
cpu : int, default 1
|
1340
|
+
Number of CPUs required for this step. If `@resources` is
|
1341
|
+
also present, the maximum value from all decorators is used.
|
1342
|
+
memory : int, default 4096
|
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.
|
1399
|
+
"""
|
1400
|
+
...
|
1401
|
+
|
1402
|
+
@typing.overload
|
1403
|
+
def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[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]]]:
|
1404
|
+
"""
|
1405
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
1406
|
+
|
1407
|
+
Parameters
|
1408
|
+
----------
|
1409
|
+
cpu : int, default 1
|
1410
|
+
Number of CPUs required for this step. If `@resources` is
|
1411
|
+
also present, the maximum value from all decorators is used.
|
1412
|
+
gpu : int, default 0
|
1413
|
+
Number of GPUs required for this step. If `@resources` is
|
1414
|
+
also present, the maximum value from all decorators is used.
|
1415
|
+
memory : int, default 4096
|
1416
|
+
Memory size (in MB) required for this step. If
|
1417
|
+
`@resources` is also present, the maximum value from all decorators is
|
1418
|
+
used.
|
1284
1419
|
image : str, optional, default None
|
1285
1420
|
Docker image to use when launching on AWS Batch. If not specified, and
|
1286
1421
|
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
@@ -1335,302 +1470,322 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1335
1470
|
...
|
1336
1471
|
|
1337
1472
|
@typing.overload
|
1338
|
-
def
|
1339
|
-
"""
|
1340
|
-
Specifies the Conda environment for the step.
|
1341
|
-
|
1342
|
-
Information in this decorator will augment any
|
1343
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1344
|
-
you can use `@conda_base` to set packages required by all
|
1345
|
-
steps and use `@conda` to specify step-specific overrides.
|
1346
|
-
|
1347
|
-
Parameters
|
1348
|
-
----------
|
1349
|
-
packages : Dict[str, str], default {}
|
1350
|
-
Packages to use for this step. The key is the name of the package
|
1351
|
-
and the value is the version to use.
|
1352
|
-
libraries : Dict[str, str], default {}
|
1353
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1354
|
-
python : str, optional, default None
|
1355
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1356
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1357
|
-
disabled : bool, default False
|
1358
|
-
If set to True, disables @conda.
|
1359
|
-
"""
|
1360
|
-
...
|
1361
|
-
|
1362
|
-
@typing.overload
|
1363
|
-
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1473
|
+
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1364
1474
|
...
|
1365
1475
|
|
1366
1476
|
@typing.overload
|
1367
|
-
def
|
1477
|
+
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1368
1478
|
...
|
1369
1479
|
|
1370
|
-
def
|
1480
|
+
def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None):
|
1371
1481
|
"""
|
1372
|
-
Specifies
|
1373
|
-
|
1374
|
-
Information in this decorator will augment any
|
1375
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1376
|
-
you can use `@conda_base` to set packages required by all
|
1377
|
-
steps and use `@conda` to specify step-specific overrides.
|
1482
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
1378
1483
|
|
1379
1484
|
Parameters
|
1380
1485
|
----------
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1486
|
+
cpu : int, default 1
|
1487
|
+
Number of CPUs required for this step. If `@resources` is
|
1488
|
+
also present, the maximum value from all decorators is used.
|
1489
|
+
gpu : int, default 0
|
1490
|
+
Number of GPUs required for this step. If `@resources` is
|
1491
|
+
also present, the maximum value from all decorators is used.
|
1492
|
+
memory : int, default 4096
|
1493
|
+
Memory size (in MB) required for this step. If
|
1494
|
+
`@resources` is also present, the maximum value from all decorators is
|
1495
|
+
used.
|
1496
|
+
image : str, optional, default None
|
1497
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
1498
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
1499
|
+
not, a default Docker image mapping to the current version of Python is used.
|
1500
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
1501
|
+
AWS Batch Job Queue to submit the job to.
|
1502
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
1503
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
1504
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
1505
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
1506
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
1507
|
+
shared_memory : int, optional, default None
|
1508
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1509
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1510
|
+
max_swap : int, optional, default None
|
1511
|
+
The total amount of swap memory (in MiB) a container can use for this
|
1512
|
+
step. This parameter is translated to the `--memory-swap` option in
|
1513
|
+
Docker where the value is the sum of the container memory plus the
|
1514
|
+
`max_swap` value.
|
1515
|
+
swappiness : int, optional, default None
|
1516
|
+
This allows you to tune memory swappiness behavior for this step.
|
1517
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
1518
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
1519
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
1520
|
+
use_tmpfs : bool, default False
|
1521
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
1522
|
+
not available on Fargate compute environments
|
1523
|
+
tmpfs_tempdir : bool, default True
|
1524
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1525
|
+
tmpfs_size : int, optional, default None
|
1526
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
1527
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1528
|
+
memory allocated for this step.
|
1529
|
+
tmpfs_path : str, optional, default None
|
1530
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1531
|
+
inferentia : int, default 0
|
1532
|
+
Number of Inferentia chips required for this step.
|
1533
|
+
trainium : int, default None
|
1534
|
+
Alias for inferentia. Use only one of the two.
|
1535
|
+
efa : int, default 0
|
1536
|
+
Number of elastic fabric adapter network devices to attach to container
|
1537
|
+
ephemeral_storage : int, default None
|
1538
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
1539
|
+
This is only relevant for Fargate compute environments
|
1540
|
+
log_driver: str, optional, default None
|
1541
|
+
The log driver to use for the Amazon ECS container.
|
1542
|
+
log_options: List[str], optional, default None
|
1543
|
+
List of strings containing options for the chosen log driver. The configurable values
|
1544
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1545
|
+
Example: [`awslogs-group:aws/batch/job`]
|
1391
1546
|
"""
|
1392
1547
|
...
|
1393
1548
|
|
1394
1549
|
@typing.overload
|
1395
|
-
def
|
1550
|
+
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]]:
|
1396
1551
|
"""
|
1397
|
-
Specifies
|
1398
|
-
|
1552
|
+
Specifies the event(s) that this flow depends on.
|
1553
|
+
|
1554
|
+
```
|
1555
|
+
@trigger(event='foo')
|
1556
|
+
```
|
1557
|
+
or
|
1558
|
+
```
|
1559
|
+
@trigger(events=['foo', 'bar'])
|
1560
|
+
```
|
1561
|
+
|
1562
|
+
Additionally, you can specify the parameter mappings
|
1563
|
+
to map event payload to Metaflow parameters for the flow.
|
1564
|
+
```
|
1565
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1566
|
+
```
|
1567
|
+
or
|
1568
|
+
```
|
1569
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1570
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1571
|
+
```
|
1572
|
+
|
1573
|
+
'parameters' can also be a list of strings and tuples like so:
|
1574
|
+
```
|
1575
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1576
|
+
```
|
1577
|
+
This is equivalent to:
|
1578
|
+
```
|
1579
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1580
|
+
```
|
1399
1581
|
|
1400
1582
|
Parameters
|
1401
1583
|
----------
|
1402
|
-
|
1403
|
-
|
1584
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1585
|
+
Event dependency for this flow.
|
1586
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1587
|
+
Events dependency for this flow.
|
1588
|
+
options : Dict[str, Any], default {}
|
1589
|
+
Backend-specific configuration for tuning eventing behavior.
|
1590
|
+
|
1591
|
+
|
1404
1592
|
"""
|
1405
1593
|
...
|
1406
1594
|
|
1407
1595
|
@typing.overload
|
1408
|
-
def
|
1409
|
-
...
|
1410
|
-
|
1411
|
-
@typing.overload
|
1412
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1596
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1413
1597
|
...
|
1414
1598
|
|
1415
|
-
def
|
1599
|
+
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, 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] = {}):
|
1416
1600
|
"""
|
1417
|
-
Specifies
|
1418
|
-
|
1601
|
+
Specifies the event(s) that this flow depends on.
|
1602
|
+
|
1603
|
+
```
|
1604
|
+
@trigger(event='foo')
|
1605
|
+
```
|
1606
|
+
or
|
1607
|
+
```
|
1608
|
+
@trigger(events=['foo', 'bar'])
|
1609
|
+
```
|
1610
|
+
|
1611
|
+
Additionally, you can specify the parameter mappings
|
1612
|
+
to map event payload to Metaflow parameters for the flow.
|
1613
|
+
```
|
1614
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1615
|
+
```
|
1616
|
+
or
|
1617
|
+
```
|
1618
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1619
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1620
|
+
```
|
1621
|
+
|
1622
|
+
'parameters' can also be a list of strings and tuples like so:
|
1623
|
+
```
|
1624
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1625
|
+
```
|
1626
|
+
This is equivalent to:
|
1627
|
+
```
|
1628
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1629
|
+
```
|
1419
1630
|
|
1420
1631
|
Parameters
|
1421
1632
|
----------
|
1422
|
-
|
1423
|
-
|
1633
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1634
|
+
Event dependency for this flow.
|
1635
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1636
|
+
Events dependency for this flow.
|
1637
|
+
options : Dict[str, Any], default {}
|
1638
|
+
Backend-specific configuration for tuning eventing behavior.
|
1639
|
+
|
1640
|
+
|
1424
1641
|
"""
|
1425
1642
|
...
|
1426
1643
|
|
1427
|
-
def
|
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]]:
|
1428
1645
|
"""
|
1429
|
-
|
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.
|
1430
1648
|
|
1431
1649
|
Parameters
|
1432
1650
|
----------
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
the
|
1465
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1466
|
-
The vendor of the GPUs to be used for this step.
|
1467
|
-
tolerations : List[str], default []
|
1468
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1469
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1470
|
-
use_tmpfs : bool, default False
|
1471
|
-
This enables an explicit tmpfs mount for this step.
|
1472
|
-
tmpfs_tempdir : bool, default True
|
1473
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1474
|
-
tmpfs_size : int, optional, default: None
|
1475
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1476
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1477
|
-
memory allocated for this step.
|
1478
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
1479
|
-
Path to tmpfs mount for this step.
|
1480
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
1481
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1482
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1483
|
-
shared_memory: int, optional
|
1484
|
-
Shared memory size (in MiB) required for this step
|
1485
|
-
port: int, optional
|
1486
|
-
Port number to specify in the Kubernetes job object
|
1487
|
-
compute_pool : str, optional, default None
|
1488
|
-
Compute pool to be used for for this step.
|
1489
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
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)
|
1490
1683
|
"""
|
1491
1684
|
...
|
1492
1685
|
|
1493
1686
|
@typing.overload
|
1494
|
-
def
|
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]]:
|
1495
1688
|
"""
|
1496
|
-
Specifies the
|
1497
|
-
|
1498
|
-
|
1499
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1500
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1501
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1502
|
-
|
1503
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1504
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1505
|
-
ensuring that the flow execution can continue.
|
1689
|
+
Specifies the times when the flow should be run when running on a
|
1690
|
+
production scheduler.
|
1506
1691
|
|
1507
1692
|
Parameters
|
1508
1693
|
----------
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
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).
|
1513
1706
|
"""
|
1514
1707
|
...
|
1515
1708
|
|
1516
1709
|
@typing.overload
|
1517
|
-
def
|
1518
|
-
...
|
1519
|
-
|
1520
|
-
@typing.overload
|
1521
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1710
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1522
1711
|
...
|
1523
1712
|
|
1524
|
-
def
|
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):
|
1525
1714
|
"""
|
1526
|
-
Specifies the
|
1527
|
-
|
1528
|
-
|
1529
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1530
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1531
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1532
|
-
|
1533
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1534
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1535
|
-
ensuring that the flow execution can continue.
|
1715
|
+
Specifies the times when the flow should be run when running on a
|
1716
|
+
production scheduler.
|
1536
1717
|
|
1537
1718
|
Parameters
|
1538
1719
|
----------
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
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).
|
1543
1732
|
"""
|
1544
1733
|
...
|
1545
1734
|
|
1546
1735
|
@typing.overload
|
1547
|
-
def
|
1736
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1548
1737
|
"""
|
1549
|
-
Specifies the
|
1550
|
-
|
1551
|
-
Use `@conda_base` to set common libraries required by all
|
1552
|
-
steps and use `@conda` to specify step-specific additions.
|
1738
|
+
Specifies the PyPI packages for all steps of the flow.
|
1553
1739
|
|
1740
|
+
Use `@pypi_base` to set common packages required by all
|
1741
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1554
1742
|
Parameters
|
1555
1743
|
----------
|
1556
|
-
packages : Dict[str, str], default {}
|
1744
|
+
packages : Dict[str, str], default: {}
|
1557
1745
|
Packages to use for this flow. The key is the name of the package
|
1558
1746
|
and the value is the version to use.
|
1559
|
-
|
1560
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1561
|
-
python : str, optional, default None
|
1747
|
+
python : str, optional, default: None
|
1562
1748
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1563
1749
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1564
|
-
disabled : bool, default False
|
1565
|
-
If set to True, disables Conda.
|
1566
1750
|
"""
|
1567
1751
|
...
|
1568
1752
|
|
1569
1753
|
@typing.overload
|
1570
|
-
def
|
1754
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1571
1755
|
...
|
1572
1756
|
|
1573
|
-
def
|
1757
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1574
1758
|
"""
|
1575
|
-
Specifies the
|
1576
|
-
|
1577
|
-
Use `@conda_base` to set common libraries required by all
|
1578
|
-
steps and use `@conda` to specify step-specific additions.
|
1759
|
+
Specifies the PyPI packages for all steps of the flow.
|
1579
1760
|
|
1761
|
+
Use `@pypi_base` to set common packages required by all
|
1762
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1580
1763
|
Parameters
|
1581
1764
|
----------
|
1582
|
-
packages : Dict[str, str], default {}
|
1765
|
+
packages : Dict[str, str], default: {}
|
1583
1766
|
Packages to use for this flow. The key is the name of the package
|
1584
1767
|
and the value is the version to use.
|
1585
|
-
|
1586
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1587
|
-
python : str, optional, default None
|
1768
|
+
python : str, optional, default: None
|
1588
1769
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1589
1770
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1590
|
-
disabled : bool, default False
|
1591
|
-
If set to True, disables Conda.
|
1592
1771
|
"""
|
1593
1772
|
...
|
1594
1773
|
|
1595
|
-
def
|
1774
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1596
1775
|
"""
|
1597
|
-
|
1598
|
-
|
1776
|
+
Specifies what flows belong to the same project.
|
1777
|
+
|
1778
|
+
A project-specific namespace is created for all flows that
|
1779
|
+
use the same `@project(name)`.
|
1599
1780
|
|
1600
1781
|
Parameters
|
1601
1782
|
----------
|
1602
|
-
timeout : int
|
1603
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1604
|
-
poke_interval : int
|
1605
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1606
|
-
mode : str
|
1607
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1608
|
-
exponential_backoff : bool
|
1609
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1610
|
-
pool : str
|
1611
|
-
the slot pool this task should run in,
|
1612
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1613
|
-
soft_fail : bool
|
1614
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1615
1783
|
name : str
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
external_task_ids : List[str]
|
1622
|
-
The list of task_ids that you want to wait for.
|
1623
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1624
|
-
allowed_states : List[str]
|
1625
|
-
Iterable of allowed states, (Default: ['success'])
|
1626
|
-
failed_states : List[str]
|
1627
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1628
|
-
execution_delta : datetime.timedelta
|
1629
|
-
time difference with the previous execution to look at,
|
1630
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1631
|
-
check_existence: bool
|
1632
|
-
Set to True to check if the external task exists or check if
|
1633
|
-
the DAG to wait for exists. (Default: True)
|
1784
|
+
Project name. Make sure that the name is unique amongst all
|
1785
|
+
projects that use the same production scheduler. The name may
|
1786
|
+
contain only lowercase alphanumeric characters and underscores.
|
1787
|
+
|
1788
|
+
|
1634
1789
|
"""
|
1635
1790
|
...
|
1636
1791
|
|
@@ -1676,45 +1831,6 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1676
1831
|
"""
|
1677
1832
|
...
|
1678
1833
|
|
1679
|
-
@typing.overload
|
1680
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1681
|
-
"""
|
1682
|
-
Specifies the PyPI packages for all steps of the flow.
|
1683
|
-
|
1684
|
-
Use `@pypi_base` to set common packages required by all
|
1685
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1686
|
-
Parameters
|
1687
|
-
----------
|
1688
|
-
packages : Dict[str, str], default: {}
|
1689
|
-
Packages to use for this flow. The key is the name of the package
|
1690
|
-
and the value is the version to use.
|
1691
|
-
python : str, optional, default: None
|
1692
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1693
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1694
|
-
"""
|
1695
|
-
...
|
1696
|
-
|
1697
|
-
@typing.overload
|
1698
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1699
|
-
...
|
1700
|
-
|
1701
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1702
|
-
"""
|
1703
|
-
Specifies the PyPI packages for all steps of the flow.
|
1704
|
-
|
1705
|
-
Use `@pypi_base` to set common packages required by all
|
1706
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1707
|
-
Parameters
|
1708
|
-
----------
|
1709
|
-
packages : Dict[str, str], default: {}
|
1710
|
-
Packages to use for this flow. The key is the name of the package
|
1711
|
-
and the value is the version to use.
|
1712
|
-
python : str, optional, default: None
|
1713
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1714
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1715
|
-
"""
|
1716
|
-
...
|
1717
|
-
|
1718
1834
|
@typing.overload
|
1719
1835
|
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1720
1836
|
"""
|
@@ -1819,164 +1935,51 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1819
1935
|
...
|
1820
1936
|
|
1821
1937
|
@typing.overload
|
1822
|
-
def
|
1823
|
-
"""
|
1824
|
-
Specifies the times when the flow should be run when running on a
|
1825
|
-
production scheduler.
|
1826
|
-
|
1827
|
-
Parameters
|
1828
|
-
----------
|
1829
|
-
hourly : bool, default False
|
1830
|
-
Run the workflow hourly.
|
1831
|
-
daily : bool, default True
|
1832
|
-
Run the workflow daily.
|
1833
|
-
weekly : bool, default False
|
1834
|
-
Run the workflow weekly.
|
1835
|
-
cron : str, optional, default None
|
1836
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1837
|
-
specified by this expression.
|
1838
|
-
timezone : str, optional, default None
|
1839
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1840
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1841
|
-
"""
|
1842
|
-
...
|
1843
|
-
|
1844
|
-
@typing.overload
|
1845
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1846
|
-
...
|
1847
|
-
|
1848
|
-
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):
|
1849
|
-
"""
|
1850
|
-
Specifies the times when the flow should be run when running on a
|
1851
|
-
production scheduler.
|
1852
|
-
|
1853
|
-
Parameters
|
1854
|
-
----------
|
1855
|
-
hourly : bool, default False
|
1856
|
-
Run the workflow hourly.
|
1857
|
-
daily : bool, default True
|
1858
|
-
Run the workflow daily.
|
1859
|
-
weekly : bool, default False
|
1860
|
-
Run the workflow weekly.
|
1861
|
-
cron : str, optional, default None
|
1862
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1863
|
-
specified by this expression.
|
1864
|
-
timezone : str, optional, default None
|
1865
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1866
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1867
|
-
"""
|
1868
|
-
...
|
1869
|
-
|
1870
|
-
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1871
|
-
"""
|
1872
|
-
Specifies what flows belong to the same project.
|
1873
|
-
|
1874
|
-
A project-specific namespace is created for all flows that
|
1875
|
-
use the same `@project(name)`.
|
1876
|
-
|
1877
|
-
Parameters
|
1878
|
-
----------
|
1879
|
-
name : str
|
1880
|
-
Project name. Make sure that the name is unique amongst all
|
1881
|
-
projects that use the same production scheduler. The name may
|
1882
|
-
contain only lowercase alphanumeric characters and underscores.
|
1883
|
-
|
1884
|
-
|
1885
|
-
"""
|
1886
|
-
...
|
1887
|
-
|
1888
|
-
@typing.overload
|
1889
|
-
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]]:
|
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]]:
|
1890
1939
|
"""
|
1891
|
-
Specifies the
|
1892
|
-
|
1893
|
-
```
|
1894
|
-
@trigger(event='foo')
|
1895
|
-
```
|
1896
|
-
or
|
1897
|
-
```
|
1898
|
-
@trigger(events=['foo', 'bar'])
|
1899
|
-
```
|
1900
|
-
|
1901
|
-
Additionally, you can specify the parameter mappings
|
1902
|
-
to map event payload to Metaflow parameters for the flow.
|
1903
|
-
```
|
1904
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1905
|
-
```
|
1906
|
-
or
|
1907
|
-
```
|
1908
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1909
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1910
|
-
```
|
1940
|
+
Specifies the Conda environment for all steps of the flow.
|
1911
1941
|
|
1912
|
-
|
1913
|
-
|
1914
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1915
|
-
```
|
1916
|
-
This is equivalent to:
|
1917
|
-
```
|
1918
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1919
|
-
```
|
1942
|
+
Use `@conda_base` to set common libraries required by all
|
1943
|
+
steps and use `@conda` to specify step-specific additions.
|
1920
1944
|
|
1921
1945
|
Parameters
|
1922
1946
|
----------
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
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.
|
1931
1957
|
"""
|
1932
1958
|
...
|
1933
1959
|
|
1934
1960
|
@typing.overload
|
1935
|
-
def
|
1961
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1936
1962
|
...
|
1937
1963
|
|
1938
|
-
def
|
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):
|
1939
1965
|
"""
|
1940
|
-
Specifies the
|
1941
|
-
|
1942
|
-
```
|
1943
|
-
@trigger(event='foo')
|
1944
|
-
```
|
1945
|
-
or
|
1946
|
-
```
|
1947
|
-
@trigger(events=['foo', 'bar'])
|
1948
|
-
```
|
1949
|
-
|
1950
|
-
Additionally, you can specify the parameter mappings
|
1951
|
-
to map event payload to Metaflow parameters for the flow.
|
1952
|
-
```
|
1953
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1954
|
-
```
|
1955
|
-
or
|
1956
|
-
```
|
1957
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1958
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1959
|
-
```
|
1966
|
+
Specifies the Conda environment for all steps of the flow.
|
1960
1967
|
|
1961
|
-
|
1962
|
-
|
1963
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1964
|
-
```
|
1965
|
-
This is equivalent to:
|
1966
|
-
```
|
1967
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1968
|
-
```
|
1968
|
+
Use `@conda_base` to set common libraries required by all
|
1969
|
+
steps and use `@conda` to specify step-specific additions.
|
1969
1970
|
|
1970
1971
|
Parameters
|
1971
1972
|
----------
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
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.
|
1980
1983
|
"""
|
1981
1984
|
...
|
1982
1985
|
|
@@ -3214,15 +3217,15 @@ class NBRunner(object, metaclass=type):
|
|
3214
3217
|
Additional environment variables to set for the Run. This overrides the
|
3215
3218
|
environment set for this process.
|
3216
3219
|
base_dir : Optional[str], default None
|
3217
|
-
The directory to run the subprocess in; if not specified,
|
3218
|
-
directory is used.
|
3220
|
+
The directory to run the subprocess in; if not specified, the current
|
3221
|
+
working directory is used.
|
3219
3222
|
file_read_timeout : int, default 3600
|
3220
3223
|
The timeout until which we try to read the runner attribute file.
|
3221
3224
|
**kwargs : Any
|
3222
3225
|
Additional arguments that you would pass to `python myflow.py` before
|
3223
3226
|
the `run` command.
|
3224
3227
|
"""
|
3225
|
-
def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str =
|
3228
|
+
def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
|
3226
3229
|
...
|
3227
3230
|
def nbrun(self, **kwargs):
|
3228
3231
|
"""
|
@@ -3403,13 +3406,13 @@ class NBDeployer(object, metaclass=type):
|
|
3403
3406
|
Additional environment variables to set. This overrides the
|
3404
3407
|
environment set for this process.
|
3405
3408
|
base_dir : Optional[str], default None
|
3406
|
-
The directory to run the subprocess in; if not specified,
|
3407
|
-
directory is used.
|
3409
|
+
The directory to run the subprocess in; if not specified, the current
|
3410
|
+
working directory is used.
|
3408
3411
|
**kwargs : Any
|
3409
3412
|
Additional arguments that you would pass to `python myflow.py` i.e. options
|
3410
3413
|
listed in `python myflow.py --help`
|
3411
3414
|
"""
|
3412
|
-
def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str =
|
3415
|
+
def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
|
3413
3416
|
...
|
3414
3417
|
def cleanup(self):
|
3415
3418
|
"""
|