metaflow-stubs 2.15.21__py2.py3-none-any.whl → 2.16.0__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.
Potentially problematic release.
This version of metaflow-stubs might be problematic. Click here for more details.
- metaflow-stubs/__init__.pyi +687 -681
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +3 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +7 -8
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +9 -9
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/{info_file.pyi → meta_files.pyi} +2 -6
- metaflow-stubs/metadata_provider/__init__.pyi +2 -2
- metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
- metaflow-stubs/metadata_provider/metadata.pyi +3 -3
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +6 -2
- metaflow-stubs/metaflow_current.pyi +17 -17
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/packaging_sys/__init__.pyi +430 -0
- metaflow-stubs/packaging_sys/backend.pyi +73 -0
- metaflow-stubs/packaging_sys/distribution_support.pyi +72 -0
- metaflow-stubs/packaging_sys/tar_backend.pyi +53 -0
- metaflow-stubs/packaging_sys/utils.pyi +26 -0
- metaflow-stubs/packaging_sys/v1.pyi +145 -0
- metaflow-stubs/parameters.pyi +4 -4
- metaflow-stubs/plugins/__init__.pyi +16 -16
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -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 +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- 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 +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/argo/exit_hooks.pyi +3 -3
- metaflow-stubs/plugins/aws/__init__.pyi +4 -4
- 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 +4 -4
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +4 -2
- 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/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.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 +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +4 -4
- 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_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 +3 -5
- 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/components.pyi +4 -4
- 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 +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- 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/exit_hook/__init__.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/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 +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +4 -4
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +4 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +3 -3
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +5 -8
- metaflow-stubs/plugins/pypi/conda_environment.pyi +6 -5
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +4 -4
- 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 +3 -3
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_func.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
- metaflow-stubs/plugins/secrets/utils.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +3 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +5 -5
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +4 -4
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +3 -2
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +2 -2
- 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/user_configs/__init__.pyi +2 -3
- metaflow-stubs/user_configs/config_options.pyi +4 -5
- metaflow-stubs/user_configs/config_parameters.pyi +8 -10
- metaflow-stubs/user_decorators/__init__.pyi +15 -0
- metaflow-stubs/user_decorators/common.pyi +38 -0
- metaflow-stubs/user_decorators/mutable_flow.pyi +223 -0
- metaflow-stubs/user_decorators/mutable_step.pyi +152 -0
- metaflow-stubs/user_decorators/user_flow_decorator.pyi +137 -0
- metaflow-stubs/user_decorators/user_step_decorator.pyi +323 -0
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.15.21.dist-info → metaflow_stubs-2.16.0.dist-info}/METADATA +2 -2
- metaflow_stubs-2.16.0.dist-info/RECORD +166 -0
- metaflow-stubs/user_configs/config_decorators.pyi +0 -251
- metaflow_stubs-2.15.21.dist-info/RECORD +0 -155
- {metaflow_stubs-2.15.21.dist-info → metaflow_stubs-2.16.0.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.15.21.dist-info → metaflow_stubs-2.16.0.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
######################################################################################################
|
|
2
2
|
# Auto-generated Metaflow stub file #
|
|
3
|
-
# MF version: 2.
|
|
4
|
-
# Generated on 2025-07-
|
|
3
|
+
# MF version: 2.16.0 #
|
|
4
|
+
# Generated on 2025-07-12T15:28:57.479372 #
|
|
5
5
|
######################################################################################################
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
@@ -13,7 +13,8 @@ if typing.TYPE_CHECKING:
|
|
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
|
15
15
|
|
|
16
|
-
from . import
|
|
16
|
+
from . import meta_files as meta_files
|
|
17
|
+
from . import packaging_sys as packaging_sys
|
|
17
18
|
from . import exception as exception
|
|
18
19
|
from . import metaflow_config as metaflow_config
|
|
19
20
|
from . import multicore_utils as multicore_utils
|
|
@@ -23,6 +24,7 @@ from . import metaflow_current as metaflow_current
|
|
|
23
24
|
from .metaflow_current import current as current
|
|
24
25
|
from . import parameters as parameters
|
|
25
26
|
from . import user_configs as user_configs
|
|
27
|
+
from . import user_decorators as user_decorators
|
|
26
28
|
from . import tagging_util as tagging_util
|
|
27
29
|
from . import metadata_provider as metadata_provider
|
|
28
30
|
from . import flowspec as flowspec
|
|
@@ -33,11 +35,13 @@ from .parameters import JSONType as JSONType
|
|
|
33
35
|
from .user_configs.config_parameters import Config as Config
|
|
34
36
|
from .user_configs.config_parameters import ConfigValue as ConfigValue
|
|
35
37
|
from .user_configs.config_parameters import config_expr as config_expr
|
|
36
|
-
from .
|
|
37
|
-
from .
|
|
38
|
+
from .user_decorators.user_step_decorator import UserStepDecorator as UserStepDecorator
|
|
39
|
+
from .user_decorators.user_step_decorator import StepMutator as StepMutator
|
|
40
|
+
from .user_decorators.user_step_decorator import user_step_decorator as user_step_decorator
|
|
41
|
+
from .user_decorators.user_flow_decorator import FlowMutator as FlowMutator
|
|
38
42
|
from . import metaflow_git as metaflow_git
|
|
39
|
-
from . import tuple_util as tuple_util
|
|
40
43
|
from . import events as events
|
|
44
|
+
from . import tuple_util as tuple_util
|
|
41
45
|
from . import runner as runner
|
|
42
46
|
from . import plugins as plugins
|
|
43
47
|
from .plugins.datatools.s3.s3 import S3 as S3
|
|
@@ -73,6 +77,8 @@ from . import cli as cli
|
|
|
73
77
|
|
|
74
78
|
EXT_PKG: str
|
|
75
79
|
|
|
80
|
+
USER_SKIP_STEP: dict
|
|
81
|
+
|
|
76
82
|
@typing.overload
|
|
77
83
|
def step(f: typing.Callable[[FlowSpecDerived], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
78
84
|
"""
|
|
@@ -146,95 +152,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
|
146
152
|
"""
|
|
147
153
|
...
|
|
148
154
|
|
|
149
|
-
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], 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] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', 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, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = 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]]]:
|
|
150
|
-
"""
|
|
151
|
-
Specifies that this step should execute on Kubernetes.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
Parameters
|
|
155
|
-
----------
|
|
156
|
-
cpu : int, default 1
|
|
157
|
-
Number of CPUs required for this step. If `@resources` is
|
|
158
|
-
also present, the maximum value from all decorators is used.
|
|
159
|
-
memory : int, default 4096
|
|
160
|
-
Memory size (in MB) required for this step. If
|
|
161
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
162
|
-
used.
|
|
163
|
-
disk : int, default 10240
|
|
164
|
-
Disk size (in MB) required for this step. If
|
|
165
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
166
|
-
used.
|
|
167
|
-
image : str, optional, default None
|
|
168
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
|
169
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
|
170
|
-
not, a default Docker image mapping to the current version of Python is used.
|
|
171
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
|
172
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
|
173
|
-
image_pull_secrets: List[str], default []
|
|
174
|
-
The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
|
|
175
|
-
Kubernetes image pull secrets to use when pulling container images
|
|
176
|
-
in Kubernetes.
|
|
177
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
|
178
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
|
179
|
-
secrets : List[str], optional, default None
|
|
180
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
|
181
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
|
182
|
-
in Metaflow configuration.
|
|
183
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
|
184
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
|
185
|
-
Can be passed in as a comma separated string of values e.g.
|
|
186
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
|
187
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
|
188
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
|
189
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
|
190
|
-
gpu : int, optional, default None
|
|
191
|
-
Number of GPUs required for this step. A value of zero implies that
|
|
192
|
-
the scheduled node should not have GPUs.
|
|
193
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
|
194
|
-
The vendor of the GPUs to be used for this step.
|
|
195
|
-
tolerations : List[str], default []
|
|
196
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
197
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
198
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
199
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
|
200
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
201
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
202
|
-
use_tmpfs : bool, default False
|
|
203
|
-
This enables an explicit tmpfs mount for this step.
|
|
204
|
-
tmpfs_tempdir : bool, default True
|
|
205
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
206
|
-
tmpfs_size : int, optional, default: None
|
|
207
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
208
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
209
|
-
memory allocated for this step.
|
|
210
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
|
211
|
-
Path to tmpfs mount for this step.
|
|
212
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
|
213
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
214
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
215
|
-
shared_memory: int, optional
|
|
216
|
-
Shared memory size (in MiB) required for this step
|
|
217
|
-
port: int, optional
|
|
218
|
-
Port number to specify in the Kubernetes job object
|
|
219
|
-
compute_pool : str, optional, default None
|
|
220
|
-
Compute pool to be used for for this step.
|
|
221
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
|
222
|
-
hostname_resolution_timeout: int, default 10 * 60
|
|
223
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
224
|
-
Only applicable when @parallel is used.
|
|
225
|
-
qos: str, default: Burstable
|
|
226
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
227
|
-
|
|
228
|
-
security_context: Dict[str, Any], optional, default None
|
|
229
|
-
Container security context. Applies to the task container. Allows the following keys:
|
|
230
|
-
- privileged: bool, optional, default None
|
|
231
|
-
- allow_privilege_escalation: bool, optional, default None
|
|
232
|
-
- run_as_user: int, optional, default None
|
|
233
|
-
- run_as_group: int, optional, default None
|
|
234
|
-
- run_as_non_root: bool, optional, default None
|
|
235
|
-
"""
|
|
236
|
-
...
|
|
237
|
-
|
|
238
155
|
@typing.overload
|
|
239
156
|
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]]]:
|
|
240
157
|
"""
|
|
@@ -295,334 +212,124 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
295
212
|
...
|
|
296
213
|
|
|
297
214
|
@typing.overload
|
|
298
|
-
def
|
|
215
|
+
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]]]:
|
|
299
216
|
"""
|
|
300
|
-
Specifies
|
|
217
|
+
Specifies that the step will success under all circumstances.
|
|
218
|
+
|
|
219
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
220
|
+
contains the exception raised. You can use it to detect the presence
|
|
221
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
222
|
+
are missing.
|
|
301
223
|
|
|
302
224
|
|
|
303
225
|
Parameters
|
|
304
226
|
----------
|
|
305
|
-
|
|
306
|
-
|
|
227
|
+
var : str, optional, default None
|
|
228
|
+
Name of the artifact in which to store the caught exception.
|
|
229
|
+
If not specified, the exception is not stored.
|
|
230
|
+
print_exception : bool, default True
|
|
231
|
+
Determines whether or not the exception is printed to
|
|
232
|
+
stdout when caught.
|
|
307
233
|
"""
|
|
308
234
|
...
|
|
309
235
|
|
|
310
236
|
@typing.overload
|
|
311
|
-
def
|
|
237
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
312
238
|
...
|
|
313
239
|
|
|
314
240
|
@typing.overload
|
|
315
|
-
def
|
|
241
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
316
242
|
...
|
|
317
243
|
|
|
318
|
-
def
|
|
244
|
+
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):
|
|
319
245
|
"""
|
|
320
|
-
Specifies
|
|
246
|
+
Specifies that the step will success under all circumstances.
|
|
247
|
+
|
|
248
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
249
|
+
contains the exception raised. You can use it to detect the presence
|
|
250
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
251
|
+
are missing.
|
|
321
252
|
|
|
322
253
|
|
|
323
254
|
Parameters
|
|
324
255
|
----------
|
|
325
|
-
|
|
326
|
-
|
|
256
|
+
var : str, optional, default None
|
|
257
|
+
Name of the artifact in which to store the caught exception.
|
|
258
|
+
If not specified, the exception is not stored.
|
|
259
|
+
print_exception : bool, default True
|
|
260
|
+
Determines whether or not the exception is printed to
|
|
261
|
+
stdout when caught.
|
|
327
262
|
"""
|
|
328
263
|
...
|
|
329
264
|
|
|
330
265
|
@typing.overload
|
|
331
|
-
def
|
|
266
|
+
def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
332
267
|
"""
|
|
333
|
-
Specifies
|
|
268
|
+
Specifies a timeout for your step.
|
|
334
269
|
|
|
335
|
-
|
|
336
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
270
|
+
This decorator is useful if this step may hang indefinitely.
|
|
337
271
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
python myflow.py run --with kubernetes
|
|
345
|
-
```
|
|
346
|
-
which executes the flow on the desired system using the
|
|
347
|
-
requirements specified in `@resources`.
|
|
272
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
273
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
274
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
275
|
+
|
|
276
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
277
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
348
278
|
|
|
349
279
|
|
|
350
280
|
Parameters
|
|
351
281
|
----------
|
|
352
|
-
|
|
353
|
-
Number of
|
|
354
|
-
|
|
355
|
-
Number of
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
memory : int, default 4096
|
|
359
|
-
Memory size (in MB) required for this step.
|
|
360
|
-
shared_memory : int, optional, default None
|
|
361
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
362
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
282
|
+
seconds : int, default 0
|
|
283
|
+
Number of seconds to wait prior to timing out.
|
|
284
|
+
minutes : int, default 0
|
|
285
|
+
Number of minutes to wait prior to timing out.
|
|
286
|
+
hours : int, default 0
|
|
287
|
+
Number of hours to wait prior to timing out.
|
|
363
288
|
"""
|
|
364
289
|
...
|
|
365
290
|
|
|
366
291
|
@typing.overload
|
|
367
|
-
def
|
|
292
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
368
293
|
...
|
|
369
294
|
|
|
370
295
|
@typing.overload
|
|
371
|
-
def
|
|
296
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
372
297
|
...
|
|
373
298
|
|
|
374
|
-
def
|
|
299
|
+
def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
|
375
300
|
"""
|
|
376
|
-
Specifies
|
|
301
|
+
Specifies a timeout for your step.
|
|
377
302
|
|
|
378
|
-
|
|
379
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
303
|
+
This decorator is useful if this step may hang indefinitely.
|
|
380
304
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
python myflow.py run --with kubernetes
|
|
388
|
-
```
|
|
389
|
-
which executes the flow on the desired system using the
|
|
390
|
-
requirements specified in `@resources`.
|
|
305
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
306
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
307
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
308
|
+
|
|
309
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
310
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
391
311
|
|
|
392
312
|
|
|
393
313
|
Parameters
|
|
394
314
|
----------
|
|
395
|
-
|
|
396
|
-
Number of
|
|
397
|
-
|
|
398
|
-
Number of
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
memory : int, default 4096
|
|
402
|
-
Memory size (in MB) required for this step.
|
|
403
|
-
shared_memory : int, optional, default None
|
|
404
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
405
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
315
|
+
seconds : int, default 0
|
|
316
|
+
Number of seconds to wait prior to timing out.
|
|
317
|
+
minutes : int, default 0
|
|
318
|
+
Number of minutes to wait prior to timing out.
|
|
319
|
+
hours : int, default 0
|
|
320
|
+
Number of hours to wait prior to timing out.
|
|
406
321
|
"""
|
|
407
322
|
...
|
|
408
323
|
|
|
409
324
|
@typing.overload
|
|
410
|
-
def
|
|
325
|
+
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]]]:
|
|
411
326
|
"""
|
|
412
|
-
Specifies
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
Number of CPUs required for this step. If `@resources` is
|
|
419
|
-
also present, the maximum value from all decorators is used.
|
|
420
|
-
gpu : int, default 0
|
|
421
|
-
Number of GPUs required for this step. If `@resources` is
|
|
422
|
-
also present, the maximum value from all decorators is used.
|
|
423
|
-
memory : int, default 4096
|
|
424
|
-
Memory size (in MB) required for this step. If
|
|
425
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
426
|
-
used.
|
|
427
|
-
image : str, optional, default None
|
|
428
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
|
429
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
430
|
-
not, a default Docker image mapping to the current version of Python is used.
|
|
431
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
432
|
-
AWS Batch Job Queue to submit the job to.
|
|
433
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
434
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
435
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
436
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
437
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
438
|
-
shared_memory : int, optional, default None
|
|
439
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
440
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
441
|
-
max_swap : int, optional, default None
|
|
442
|
-
The total amount of swap memory (in MiB) a container can use for this
|
|
443
|
-
step. This parameter is translated to the `--memory-swap` option in
|
|
444
|
-
Docker where the value is the sum of the container memory plus the
|
|
445
|
-
`max_swap` value.
|
|
446
|
-
swappiness : int, optional, default None
|
|
447
|
-
This allows you to tune memory swappiness behavior for this step.
|
|
448
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
449
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
450
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
451
|
-
use_tmpfs : bool, default False
|
|
452
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
453
|
-
not available on Fargate compute environments
|
|
454
|
-
tmpfs_tempdir : bool, default True
|
|
455
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
456
|
-
tmpfs_size : int, optional, default None
|
|
457
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
458
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
459
|
-
memory allocated for this step.
|
|
460
|
-
tmpfs_path : str, optional, default None
|
|
461
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
462
|
-
inferentia : int, default 0
|
|
463
|
-
Number of Inferentia chips required for this step.
|
|
464
|
-
trainium : int, default None
|
|
465
|
-
Alias for inferentia. Use only one of the two.
|
|
466
|
-
efa : int, default 0
|
|
467
|
-
Number of elastic fabric adapter network devices to attach to container
|
|
468
|
-
ephemeral_storage : int, default None
|
|
469
|
-
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
470
|
-
This is only relevant for Fargate compute environments
|
|
471
|
-
log_driver: str, optional, default None
|
|
472
|
-
The log driver to use for the Amazon ECS container.
|
|
473
|
-
log_options: List[str], optional, default None
|
|
474
|
-
List of strings containing options for the chosen log driver. The configurable values
|
|
475
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
476
|
-
Example: [`awslogs-group:aws/batch/job`]
|
|
477
|
-
"""
|
|
478
|
-
...
|
|
479
|
-
|
|
480
|
-
@typing.overload
|
|
481
|
-
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
482
|
-
...
|
|
483
|
-
|
|
484
|
-
@typing.overload
|
|
485
|
-
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
486
|
-
...
|
|
487
|
-
|
|
488
|
-
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):
|
|
489
|
-
"""
|
|
490
|
-
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
Parameters
|
|
494
|
-
----------
|
|
495
|
-
cpu : int, default 1
|
|
496
|
-
Number of CPUs required for this step. If `@resources` is
|
|
497
|
-
also present, the maximum value from all decorators is used.
|
|
498
|
-
gpu : int, default 0
|
|
499
|
-
Number of GPUs required for this step. If `@resources` is
|
|
500
|
-
also present, the maximum value from all decorators is used.
|
|
501
|
-
memory : int, default 4096
|
|
502
|
-
Memory size (in MB) required for this step. If
|
|
503
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
504
|
-
used.
|
|
505
|
-
image : str, optional, default None
|
|
506
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
|
507
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
508
|
-
not, a default Docker image mapping to the current version of Python is used.
|
|
509
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
510
|
-
AWS Batch Job Queue to submit the job to.
|
|
511
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
512
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
513
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
514
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
515
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
516
|
-
shared_memory : int, optional, default None
|
|
517
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
518
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
519
|
-
max_swap : int, optional, default None
|
|
520
|
-
The total amount of swap memory (in MiB) a container can use for this
|
|
521
|
-
step. This parameter is translated to the `--memory-swap` option in
|
|
522
|
-
Docker where the value is the sum of the container memory plus the
|
|
523
|
-
`max_swap` value.
|
|
524
|
-
swappiness : int, optional, default None
|
|
525
|
-
This allows you to tune memory swappiness behavior for this step.
|
|
526
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
527
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
528
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
529
|
-
use_tmpfs : bool, default False
|
|
530
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
531
|
-
not available on Fargate compute environments
|
|
532
|
-
tmpfs_tempdir : bool, default True
|
|
533
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
534
|
-
tmpfs_size : int, optional, default None
|
|
535
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
536
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
537
|
-
memory allocated for this step.
|
|
538
|
-
tmpfs_path : str, optional, default None
|
|
539
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
540
|
-
inferentia : int, default 0
|
|
541
|
-
Number of Inferentia chips required for this step.
|
|
542
|
-
trainium : int, default None
|
|
543
|
-
Alias for inferentia. Use only one of the two.
|
|
544
|
-
efa : int, default 0
|
|
545
|
-
Number of elastic fabric adapter network devices to attach to container
|
|
546
|
-
ephemeral_storage : int, default None
|
|
547
|
-
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
548
|
-
This is only relevant for Fargate compute environments
|
|
549
|
-
log_driver: str, optional, default None
|
|
550
|
-
The log driver to use for the Amazon ECS container.
|
|
551
|
-
log_options: List[str], optional, default None
|
|
552
|
-
List of strings containing options for the chosen log driver. The configurable values
|
|
553
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
554
|
-
Example: [`awslogs-group:aws/batch/job`]
|
|
555
|
-
"""
|
|
556
|
-
...
|
|
557
|
-
|
|
558
|
-
@typing.overload
|
|
559
|
-
def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
560
|
-
"""
|
|
561
|
-
Specifies a timeout for your step.
|
|
562
|
-
|
|
563
|
-
This decorator is useful if this step may hang indefinitely.
|
|
564
|
-
|
|
565
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
566
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
567
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
568
|
-
|
|
569
|
-
Note that all the values specified in parameters are added together so if you specify
|
|
570
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
Parameters
|
|
574
|
-
----------
|
|
575
|
-
seconds : int, default 0
|
|
576
|
-
Number of seconds to wait prior to timing out.
|
|
577
|
-
minutes : int, default 0
|
|
578
|
-
Number of minutes to wait prior to timing out.
|
|
579
|
-
hours : int, default 0
|
|
580
|
-
Number of hours to wait prior to timing out.
|
|
581
|
-
"""
|
|
582
|
-
...
|
|
583
|
-
|
|
584
|
-
@typing.overload
|
|
585
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
586
|
-
...
|
|
587
|
-
|
|
588
|
-
@typing.overload
|
|
589
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
590
|
-
...
|
|
591
|
-
|
|
592
|
-
def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
|
593
|
-
"""
|
|
594
|
-
Specifies a timeout for your step.
|
|
595
|
-
|
|
596
|
-
This decorator is useful if this step may hang indefinitely.
|
|
597
|
-
|
|
598
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
599
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
600
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
601
|
-
|
|
602
|
-
Note that all the values specified in parameters are added together so if you specify
|
|
603
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
Parameters
|
|
607
|
-
----------
|
|
608
|
-
seconds : int, default 0
|
|
609
|
-
Number of seconds to wait prior to timing out.
|
|
610
|
-
minutes : int, default 0
|
|
611
|
-
Number of minutes to wait prior to timing out.
|
|
612
|
-
hours : int, default 0
|
|
613
|
-
Number of hours to wait prior to timing out.
|
|
614
|
-
"""
|
|
615
|
-
...
|
|
616
|
-
|
|
617
|
-
@typing.overload
|
|
618
|
-
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]]]:
|
|
619
|
-
"""
|
|
620
|
-
Specifies the PyPI packages for the step.
|
|
621
|
-
|
|
622
|
-
Information in this decorator will augment any
|
|
623
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
624
|
-
you can use `@pypi_base` to set packages required by all
|
|
625
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
327
|
+
Specifies the PyPI packages for the step.
|
|
328
|
+
|
|
329
|
+
Information in this decorator will augment any
|
|
330
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
331
|
+
you can use `@pypi_base` to set packages required by all
|
|
332
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
626
333
|
|
|
627
334
|
|
|
628
335
|
Parameters
|
|
@@ -685,51 +392,35 @@ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
|
685
392
|
...
|
|
686
393
|
|
|
687
394
|
@typing.overload
|
|
688
|
-
def
|
|
395
|
+
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]]]:
|
|
689
396
|
"""
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
397
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
693
398
|
|
|
694
399
|
|
|
695
400
|
Parameters
|
|
696
401
|
----------
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
id : str, optional, default None
|
|
700
|
-
If multiple cards are present, use this id to identify this card.
|
|
701
|
-
options : Dict[str, Any], default {}
|
|
702
|
-
Options passed to the card. The contents depend on the card type.
|
|
703
|
-
timeout : int, default 45
|
|
704
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
402
|
+
vars : Dict[str, str], default {}
|
|
403
|
+
Dictionary of environment variables to set.
|
|
705
404
|
"""
|
|
706
405
|
...
|
|
707
406
|
|
|
708
407
|
@typing.overload
|
|
709
|
-
def
|
|
408
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
710
409
|
...
|
|
711
410
|
|
|
712
411
|
@typing.overload
|
|
713
|
-
def
|
|
412
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
714
413
|
...
|
|
715
414
|
|
|
716
|
-
def
|
|
415
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
717
416
|
"""
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
417
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
721
418
|
|
|
722
419
|
|
|
723
420
|
Parameters
|
|
724
421
|
----------
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
id : str, optional, default None
|
|
728
|
-
If multiple cards are present, use this id to identify this card.
|
|
729
|
-
options : Dict[str, Any], default {}
|
|
730
|
-
Options passed to the card. The contents depend on the card type.
|
|
731
|
-
timeout : int, default 45
|
|
732
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
422
|
+
vars : Dict[str, str], default {}
|
|
423
|
+
Dictionary of environment variables to set.
|
|
733
424
|
"""
|
|
734
425
|
...
|
|
735
426
|
|
|
@@ -773,53 +464,130 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
|
773
464
|
...
|
|
774
465
|
|
|
775
466
|
@typing.overload
|
|
776
|
-
def
|
|
467
|
+
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]]]:
|
|
777
468
|
"""
|
|
778
|
-
Specifies
|
|
469
|
+
Specifies the resources needed when executing this step.
|
|
779
470
|
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
471
|
+
Use `@resources` to specify the resource requirements
|
|
472
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
473
|
+
|
|
474
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
475
|
+
```
|
|
476
|
+
python myflow.py run --with batch
|
|
477
|
+
```
|
|
478
|
+
or
|
|
479
|
+
```
|
|
480
|
+
python myflow.py run --with kubernetes
|
|
481
|
+
```
|
|
482
|
+
which executes the flow on the desired system using the
|
|
483
|
+
requirements specified in `@resources`.
|
|
784
484
|
|
|
785
485
|
|
|
786
486
|
Parameters
|
|
787
487
|
----------
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
488
|
+
cpu : int, default 1
|
|
489
|
+
Number of CPUs required for this step.
|
|
490
|
+
gpu : int, optional, default None
|
|
491
|
+
Number of GPUs required for this step.
|
|
492
|
+
disk : int, optional, default None
|
|
493
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
494
|
+
memory : int, default 4096
|
|
495
|
+
Memory size (in MB) required for this step.
|
|
496
|
+
shared_memory : int, optional, default None
|
|
497
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
498
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
794
499
|
"""
|
|
795
500
|
...
|
|
796
501
|
|
|
797
502
|
@typing.overload
|
|
798
|
-
def
|
|
503
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
799
504
|
...
|
|
800
505
|
|
|
801
506
|
@typing.overload
|
|
802
|
-
def
|
|
507
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
803
508
|
...
|
|
804
509
|
|
|
805
|
-
def
|
|
510
|
+
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):
|
|
806
511
|
"""
|
|
807
|
-
Specifies
|
|
512
|
+
Specifies the resources needed when executing this step.
|
|
808
513
|
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
514
|
+
Use `@resources` to specify the resource requirements
|
|
515
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
516
|
+
|
|
517
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
518
|
+
```
|
|
519
|
+
python myflow.py run --with batch
|
|
520
|
+
```
|
|
521
|
+
or
|
|
522
|
+
```
|
|
523
|
+
python myflow.py run --with kubernetes
|
|
524
|
+
```
|
|
525
|
+
which executes the flow on the desired system using the
|
|
526
|
+
requirements specified in `@resources`.
|
|
813
527
|
|
|
814
528
|
|
|
815
529
|
Parameters
|
|
816
530
|
----------
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
531
|
+
cpu : int, default 1
|
|
532
|
+
Number of CPUs required for this step.
|
|
533
|
+
gpu : int, optional, default None
|
|
534
|
+
Number of GPUs required for this step.
|
|
535
|
+
disk : int, optional, default None
|
|
536
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
537
|
+
memory : int, default 4096
|
|
538
|
+
Memory size (in MB) required for this step.
|
|
539
|
+
shared_memory : int, optional, default None
|
|
540
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
541
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
542
|
+
"""
|
|
543
|
+
...
|
|
544
|
+
|
|
545
|
+
@typing.overload
|
|
546
|
+
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]]]:
|
|
547
|
+
"""
|
|
548
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
549
|
+
|
|
550
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
Parameters
|
|
554
|
+
----------
|
|
555
|
+
type : str, default 'default'
|
|
556
|
+
Card type.
|
|
557
|
+
id : str, optional, default None
|
|
558
|
+
If multiple cards are present, use this id to identify this card.
|
|
559
|
+
options : Dict[str, Any], default {}
|
|
560
|
+
Options passed to the card. The contents depend on the card type.
|
|
561
|
+
timeout : int, default 45
|
|
562
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
563
|
+
"""
|
|
564
|
+
...
|
|
565
|
+
|
|
566
|
+
@typing.overload
|
|
567
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
568
|
+
...
|
|
569
|
+
|
|
570
|
+
@typing.overload
|
|
571
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
572
|
+
...
|
|
573
|
+
|
|
574
|
+
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):
|
|
575
|
+
"""
|
|
576
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
577
|
+
|
|
578
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
Parameters
|
|
582
|
+
----------
|
|
583
|
+
type : str, default 'default'
|
|
584
|
+
Card type.
|
|
585
|
+
id : str, optional, default None
|
|
586
|
+
If multiple cards are present, use this id to identify this card.
|
|
587
|
+
options : Dict[str, Any], default {}
|
|
588
|
+
Options passed to the card. The contents depend on the card type.
|
|
589
|
+
timeout : int, default 45
|
|
590
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
823
591
|
"""
|
|
824
592
|
...
|
|
825
593
|
|
|
@@ -879,281 +647,511 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
879
647
|
...
|
|
880
648
|
|
|
881
649
|
@typing.overload
|
|
882
|
-
def
|
|
650
|
+
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]]]:
|
|
883
651
|
"""
|
|
884
|
-
Specifies
|
|
885
|
-
|
|
886
|
-
```
|
|
887
|
-
@trigger_on_finish(flow='FooFlow')
|
|
888
|
-
```
|
|
889
|
-
or
|
|
890
|
-
```
|
|
891
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
892
|
-
```
|
|
893
|
-
This decorator respects the @project decorator and triggers the flow
|
|
894
|
-
when upstream runs within the same namespace complete successfully
|
|
895
|
-
|
|
896
|
-
Additionally, you can specify project aware upstream flow dependencies
|
|
897
|
-
by specifying the fully qualified project_flow_name.
|
|
898
|
-
```
|
|
899
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
900
|
-
```
|
|
901
|
-
or
|
|
902
|
-
```
|
|
903
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
904
|
-
```
|
|
905
|
-
|
|
906
|
-
You can also specify just the project or project branch (other values will be
|
|
907
|
-
inferred from the current project or project branch):
|
|
908
|
-
```
|
|
909
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
910
|
-
```
|
|
911
|
-
|
|
912
|
-
Note that `branch` is typically one of:
|
|
913
|
-
- `prod`
|
|
914
|
-
- `user.bob`
|
|
915
|
-
- `test.my_experiment`
|
|
916
|
-
- `prod.staging`
|
|
652
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
917
653
|
|
|
918
654
|
|
|
919
655
|
Parameters
|
|
920
656
|
----------
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
657
|
+
cpu : int, default 1
|
|
658
|
+
Number of CPUs required for this step. If `@resources` is
|
|
659
|
+
also present, the maximum value from all decorators is used.
|
|
660
|
+
gpu : int, default 0
|
|
661
|
+
Number of GPUs required for this step. If `@resources` is
|
|
662
|
+
also present, the maximum value from all decorators is used.
|
|
663
|
+
memory : int, default 4096
|
|
664
|
+
Memory size (in MB) required for this step. If
|
|
665
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
666
|
+
used.
|
|
667
|
+
image : str, optional, default None
|
|
668
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
|
669
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
670
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
671
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
672
|
+
AWS Batch Job Queue to submit the job to.
|
|
673
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
674
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
675
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
676
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
677
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
678
|
+
shared_memory : int, optional, default None
|
|
679
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
680
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
681
|
+
max_swap : int, optional, default None
|
|
682
|
+
The total amount of swap memory (in MiB) a container can use for this
|
|
683
|
+
step. This parameter is translated to the `--memory-swap` option in
|
|
684
|
+
Docker where the value is the sum of the container memory plus the
|
|
685
|
+
`max_swap` value.
|
|
686
|
+
swappiness : int, optional, default None
|
|
687
|
+
This allows you to tune memory swappiness behavior for this step.
|
|
688
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
689
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
690
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
691
|
+
use_tmpfs : bool, default False
|
|
692
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
693
|
+
not available on Fargate compute environments
|
|
694
|
+
tmpfs_tempdir : bool, default True
|
|
695
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
696
|
+
tmpfs_size : int, optional, default None
|
|
697
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
698
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
699
|
+
memory allocated for this step.
|
|
700
|
+
tmpfs_path : str, optional, default None
|
|
701
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
702
|
+
inferentia : int, default 0
|
|
703
|
+
Number of Inferentia chips required for this step.
|
|
704
|
+
trainium : int, default None
|
|
705
|
+
Alias for inferentia. Use only one of the two.
|
|
706
|
+
efa : int, default 0
|
|
707
|
+
Number of elastic fabric adapter network devices to attach to container
|
|
708
|
+
ephemeral_storage : int, default None
|
|
709
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
710
|
+
This is only relevant for Fargate compute environments
|
|
711
|
+
log_driver: str, optional, default None
|
|
712
|
+
The log driver to use for the Amazon ECS container.
|
|
713
|
+
log_options: List[str], optional, default None
|
|
714
|
+
List of strings containing options for the chosen log driver. The configurable values
|
|
715
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
716
|
+
Example: [`awslogs-group:aws/batch/job`]
|
|
927
717
|
"""
|
|
928
718
|
...
|
|
929
719
|
|
|
930
720
|
@typing.overload
|
|
931
|
-
def
|
|
721
|
+
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
932
722
|
...
|
|
933
723
|
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
Specifies the flow(s) that this flow depends on.
|
|
937
|
-
|
|
938
|
-
```
|
|
939
|
-
@trigger_on_finish(flow='FooFlow')
|
|
940
|
-
```
|
|
941
|
-
or
|
|
942
|
-
```
|
|
943
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
944
|
-
```
|
|
945
|
-
This decorator respects the @project decorator and triggers the flow
|
|
946
|
-
when upstream runs within the same namespace complete successfully
|
|
947
|
-
|
|
948
|
-
Additionally, you can specify project aware upstream flow dependencies
|
|
949
|
-
by specifying the fully qualified project_flow_name.
|
|
950
|
-
```
|
|
951
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
952
|
-
```
|
|
953
|
-
or
|
|
954
|
-
```
|
|
955
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
956
|
-
```
|
|
957
|
-
|
|
958
|
-
You can also specify just the project or project branch (other values will be
|
|
959
|
-
inferred from the current project or project branch):
|
|
960
|
-
```
|
|
961
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
962
|
-
```
|
|
963
|
-
|
|
964
|
-
Note that `branch` is typically one of:
|
|
965
|
-
- `prod`
|
|
966
|
-
- `user.bob`
|
|
967
|
-
- `test.my_experiment`
|
|
968
|
-
- `prod.staging`
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
Parameters
|
|
972
|
-
----------
|
|
973
|
-
flow : Union[str, Dict[str, str]], optional, default None
|
|
974
|
-
Upstream flow dependency for this flow.
|
|
975
|
-
flows : List[Union[str, Dict[str, str]]], default []
|
|
976
|
-
Upstream flow dependencies for this flow.
|
|
977
|
-
options : Dict[str, Any], default {}
|
|
978
|
-
Backend-specific configuration for tuning eventing behavior.
|
|
979
|
-
"""
|
|
724
|
+
@typing.overload
|
|
725
|
+
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
980
726
|
...
|
|
981
727
|
|
|
982
|
-
def
|
|
728
|
+
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):
|
|
983
729
|
"""
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
730
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
Parameters
|
|
734
|
+
----------
|
|
735
|
+
cpu : int, default 1
|
|
736
|
+
Number of CPUs required for this step. If `@resources` is
|
|
737
|
+
also present, the maximum value from all decorators is used.
|
|
738
|
+
gpu : int, default 0
|
|
739
|
+
Number of GPUs required for this step. If `@resources` is
|
|
740
|
+
also present, the maximum value from all decorators is used.
|
|
741
|
+
memory : int, default 4096
|
|
742
|
+
Memory size (in MB) required for this step. If
|
|
743
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
744
|
+
used.
|
|
745
|
+
image : str, optional, default None
|
|
746
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
|
747
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
748
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
749
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
750
|
+
AWS Batch Job Queue to submit the job to.
|
|
751
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
752
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
753
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
754
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
755
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
756
|
+
shared_memory : int, optional, default None
|
|
757
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
758
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
759
|
+
max_swap : int, optional, default None
|
|
760
|
+
The total amount of swap memory (in MiB) a container can use for this
|
|
761
|
+
step. This parameter is translated to the `--memory-swap` option in
|
|
762
|
+
Docker where the value is the sum of the container memory plus the
|
|
763
|
+
`max_swap` value.
|
|
764
|
+
swappiness : int, optional, default None
|
|
765
|
+
This allows you to tune memory swappiness behavior for this step.
|
|
766
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
767
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
768
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
769
|
+
use_tmpfs : bool, default False
|
|
770
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
771
|
+
not available on Fargate compute environments
|
|
772
|
+
tmpfs_tempdir : bool, default True
|
|
773
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
774
|
+
tmpfs_size : int, optional, default None
|
|
775
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
776
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
777
|
+
memory allocated for this step.
|
|
778
|
+
tmpfs_path : str, optional, default None
|
|
779
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
780
|
+
inferentia : int, default 0
|
|
781
|
+
Number of Inferentia chips required for this step.
|
|
782
|
+
trainium : int, default None
|
|
783
|
+
Alias for inferentia. Use only one of the two.
|
|
784
|
+
efa : int, default 0
|
|
785
|
+
Number of elastic fabric adapter network devices to attach to container
|
|
786
|
+
ephemeral_storage : int, default None
|
|
787
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
788
|
+
This is only relevant for Fargate compute environments
|
|
789
|
+
log_driver: str, optional, default None
|
|
790
|
+
The log driver to use for the Amazon ECS container.
|
|
791
|
+
log_options: List[str], optional, default None
|
|
792
|
+
List of strings containing options for the chosen log driver. The configurable values
|
|
793
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
794
|
+
Example: [`awslogs-group:aws/batch/job`]
|
|
795
|
+
"""
|
|
796
|
+
...
|
|
797
|
+
|
|
798
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], 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] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', 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, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = 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]]]:
|
|
799
|
+
"""
|
|
800
|
+
Specifies that this step should execute on Kubernetes.
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+
Parameters
|
|
804
|
+
----------
|
|
805
|
+
cpu : int, default 1
|
|
806
|
+
Number of CPUs required for this step. If `@resources` is
|
|
807
|
+
also present, the maximum value from all decorators is used.
|
|
808
|
+
memory : int, default 4096
|
|
809
|
+
Memory size (in MB) required for this step. If
|
|
810
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
811
|
+
used.
|
|
812
|
+
disk : int, default 10240
|
|
813
|
+
Disk size (in MB) required for this step. If
|
|
814
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
815
|
+
used.
|
|
816
|
+
image : str, optional, default None
|
|
817
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
|
818
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
|
819
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
820
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
|
821
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
|
822
|
+
image_pull_secrets: List[str], default []
|
|
823
|
+
The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
|
|
824
|
+
Kubernetes image pull secrets to use when pulling container images
|
|
825
|
+
in Kubernetes.
|
|
826
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
|
827
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
|
828
|
+
secrets : List[str], optional, default None
|
|
829
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
|
830
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
|
831
|
+
in Metaflow configuration.
|
|
832
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
|
833
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
|
834
|
+
Can be passed in as a comma separated string of values e.g.
|
|
835
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
|
836
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
|
837
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
|
838
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
|
839
|
+
gpu : int, optional, default None
|
|
840
|
+
Number of GPUs required for this step. A value of zero implies that
|
|
841
|
+
the scheduled node should not have GPUs.
|
|
842
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
|
843
|
+
The vendor of the GPUs to be used for this step.
|
|
844
|
+
tolerations : List[str], default []
|
|
845
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
846
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
847
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
848
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
|
849
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
850
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
851
|
+
use_tmpfs : bool, default False
|
|
852
|
+
This enables an explicit tmpfs mount for this step.
|
|
853
|
+
tmpfs_tempdir : bool, default True
|
|
854
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
855
|
+
tmpfs_size : int, optional, default: None
|
|
856
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
857
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
858
|
+
memory allocated for this step.
|
|
859
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
|
860
|
+
Path to tmpfs mount for this step.
|
|
861
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
|
862
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
863
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
864
|
+
shared_memory: int, optional
|
|
865
|
+
Shared memory size (in MiB) required for this step
|
|
866
|
+
port: int, optional
|
|
867
|
+
Port number to specify in the Kubernetes job object
|
|
868
|
+
compute_pool : str, optional, default None
|
|
869
|
+
Compute pool to be used for for this step.
|
|
870
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
|
871
|
+
hostname_resolution_timeout: int, default 10 * 60
|
|
872
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
873
|
+
Only applicable when @parallel is used.
|
|
874
|
+
qos: str, default: Burstable
|
|
875
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
876
|
+
|
|
877
|
+
security_context: Dict[str, Any], optional, default None
|
|
878
|
+
Container security context. Applies to the task container. Allows the following keys:
|
|
879
|
+
- privileged: bool, optional, default None
|
|
880
|
+
- allow_privilege_escalation: bool, optional, default None
|
|
881
|
+
- run_as_user: int, optional, default None
|
|
882
|
+
- run_as_group: int, optional, default None
|
|
883
|
+
- run_as_non_root: bool, optional, default None
|
|
884
|
+
"""
|
|
885
|
+
...
|
|
886
|
+
|
|
887
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
888
|
+
"""
|
|
889
|
+
Specifies what flows belong to the same project.
|
|
890
|
+
|
|
891
|
+
A project-specific namespace is created for all flows that
|
|
892
|
+
use the same `@project(name)`.
|
|
989
893
|
|
|
990
894
|
|
|
991
895
|
Parameters
|
|
992
896
|
----------
|
|
993
|
-
timeout : int
|
|
994
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
995
|
-
poke_interval : int
|
|
996
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
997
|
-
mode : str
|
|
998
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
999
|
-
exponential_backoff : bool
|
|
1000
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1001
|
-
pool : str
|
|
1002
|
-
the slot pool this task should run in,
|
|
1003
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1004
|
-
soft_fail : bool
|
|
1005
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1006
897
|
name : str
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
898
|
+
Project name. Make sure that the name is unique amongst all
|
|
899
|
+
projects that use the same production scheduler. The name may
|
|
900
|
+
contain only lowercase alphanumeric characters and underscores.
|
|
901
|
+
|
|
902
|
+
branch : Optional[str], default None
|
|
903
|
+
The branch to use. If not specified, the branch is set to
|
|
904
|
+
`user.<username>` unless `production` is set to `True`. This can
|
|
905
|
+
also be set on the command line using `--branch` as a top-level option.
|
|
906
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
|
907
|
+
|
|
908
|
+
production : bool, default False
|
|
909
|
+
Whether or not the branch is the production branch. This can also be set on the
|
|
910
|
+
command line using `--production` as a top-level option. It is an error to specify
|
|
911
|
+
`production` in the decorator and on the command line.
|
|
912
|
+
The project branch name will be:
|
|
913
|
+
- if `branch` is specified:
|
|
914
|
+
- if `production` is True: `prod.<branch>`
|
|
915
|
+
- if `production` is False: `test.<branch>`
|
|
916
|
+
- if `branch` is not specified:
|
|
917
|
+
- if `production` is True: `prod`
|
|
918
|
+
- if `production` is False: `user.<username>`
|
|
1022
919
|
"""
|
|
1023
920
|
...
|
|
1024
921
|
|
|
1025
922
|
@typing.overload
|
|
1026
|
-
def
|
|
923
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1027
924
|
"""
|
|
1028
|
-
Specifies the
|
|
1029
|
-
|
|
1030
|
-
Use `@conda_base` to set common libraries required by all
|
|
1031
|
-
steps and use `@conda` to specify step-specific additions.
|
|
925
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1032
926
|
|
|
927
|
+
Use `@pypi_base` to set common packages required by all
|
|
928
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1033
929
|
|
|
1034
930
|
Parameters
|
|
1035
931
|
----------
|
|
1036
|
-
packages : Dict[str, str], default {}
|
|
932
|
+
packages : Dict[str, str], default: {}
|
|
1037
933
|
Packages to use for this flow. The key is the name of the package
|
|
1038
934
|
and the value is the version to use.
|
|
1039
|
-
|
|
1040
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1041
|
-
python : str, optional, default None
|
|
935
|
+
python : str, optional, default: None
|
|
1042
936
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1043
937
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1044
|
-
disabled : bool, default False
|
|
1045
|
-
If set to True, disables Conda.
|
|
1046
938
|
"""
|
|
1047
939
|
...
|
|
1048
940
|
|
|
1049
941
|
@typing.overload
|
|
1050
|
-
def
|
|
942
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1051
943
|
...
|
|
1052
944
|
|
|
1053
|
-
def
|
|
945
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
1054
946
|
"""
|
|
1055
|
-
Specifies the
|
|
1056
|
-
|
|
1057
|
-
Use `@conda_base` to set common libraries required by all
|
|
1058
|
-
steps and use `@conda` to specify step-specific additions.
|
|
947
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1059
948
|
|
|
949
|
+
Use `@pypi_base` to set common packages required by all
|
|
950
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1060
951
|
|
|
1061
952
|
Parameters
|
|
1062
953
|
----------
|
|
1063
|
-
packages : Dict[str, str], default {}
|
|
954
|
+
packages : Dict[str, str], default: {}
|
|
1064
955
|
Packages to use for this flow. The key is the name of the package
|
|
1065
956
|
and the value is the version to use.
|
|
1066
|
-
|
|
1067
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1068
|
-
python : str, optional, default None
|
|
957
|
+
python : str, optional, default: None
|
|
1069
958
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1070
959
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1071
|
-
disabled : bool, default False
|
|
1072
|
-
If set to True, disables Conda.
|
|
1073
960
|
"""
|
|
1074
961
|
...
|
|
1075
962
|
|
|
1076
|
-
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]]:
|
|
963
|
+
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]]:
|
|
964
|
+
"""
|
|
965
|
+
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.
|
|
966
|
+
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.
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
Parameters
|
|
970
|
+
----------
|
|
971
|
+
timeout : int
|
|
972
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
973
|
+
poke_interval : int
|
|
974
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
975
|
+
mode : str
|
|
976
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
977
|
+
exponential_backoff : bool
|
|
978
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
979
|
+
pool : str
|
|
980
|
+
the slot pool this task should run in,
|
|
981
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
982
|
+
soft_fail : bool
|
|
983
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
984
|
+
name : str
|
|
985
|
+
Name of the sensor on Airflow
|
|
986
|
+
description : str
|
|
987
|
+
Description of sensor in the Airflow UI
|
|
988
|
+
external_dag_id : str
|
|
989
|
+
The dag_id that contains the task you want to wait for.
|
|
990
|
+
external_task_ids : List[str]
|
|
991
|
+
The list of task_ids that you want to wait for.
|
|
992
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
993
|
+
allowed_states : List[str]
|
|
994
|
+
Iterable of allowed states, (Default: ['success'])
|
|
995
|
+
failed_states : List[str]
|
|
996
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
|
997
|
+
execution_delta : datetime.timedelta
|
|
998
|
+
time difference with the previous execution to look at,
|
|
999
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1000
|
+
check_existence: bool
|
|
1001
|
+
Set to True to check if the external task exists or check if
|
|
1002
|
+
the DAG to wait for exists. (Default: True)
|
|
1003
|
+
"""
|
|
1004
|
+
...
|
|
1005
|
+
|
|
1006
|
+
@typing.overload
|
|
1007
|
+
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]]:
|
|
1008
|
+
"""
|
|
1009
|
+
Specifies the flow(s) that this flow depends on.
|
|
1010
|
+
|
|
1011
|
+
```
|
|
1012
|
+
@trigger_on_finish(flow='FooFlow')
|
|
1013
|
+
```
|
|
1014
|
+
or
|
|
1015
|
+
```
|
|
1016
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
1017
|
+
```
|
|
1018
|
+
This decorator respects the @project decorator and triggers the flow
|
|
1019
|
+
when upstream runs within the same namespace complete successfully
|
|
1020
|
+
|
|
1021
|
+
Additionally, you can specify project aware upstream flow dependencies
|
|
1022
|
+
by specifying the fully qualified project_flow_name.
|
|
1023
|
+
```
|
|
1024
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
1025
|
+
```
|
|
1026
|
+
or
|
|
1027
|
+
```
|
|
1028
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
1029
|
+
```
|
|
1030
|
+
|
|
1031
|
+
You can also specify just the project or project branch (other values will be
|
|
1032
|
+
inferred from the current project or project branch):
|
|
1033
|
+
```
|
|
1034
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
1035
|
+
```
|
|
1036
|
+
|
|
1037
|
+
Note that `branch` is typically one of:
|
|
1038
|
+
- `prod`
|
|
1039
|
+
- `user.bob`
|
|
1040
|
+
- `test.my_experiment`
|
|
1041
|
+
- `prod.staging`
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
Parameters
|
|
1045
|
+
----------
|
|
1046
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
|
1047
|
+
Upstream flow dependency for this flow.
|
|
1048
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
|
1049
|
+
Upstream flow dependencies for this flow.
|
|
1050
|
+
options : Dict[str, Any], default {}
|
|
1051
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1052
|
+
"""
|
|
1053
|
+
...
|
|
1054
|
+
|
|
1055
|
+
@typing.overload
|
|
1056
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1057
|
+
...
|
|
1058
|
+
|
|
1059
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, 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] = {}):
|
|
1077
1060
|
"""
|
|
1078
|
-
|
|
1079
|
-
|
|
1061
|
+
Specifies the flow(s) that this flow depends on.
|
|
1062
|
+
|
|
1063
|
+
```
|
|
1064
|
+
@trigger_on_finish(flow='FooFlow')
|
|
1065
|
+
```
|
|
1066
|
+
or
|
|
1067
|
+
```
|
|
1068
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
1069
|
+
```
|
|
1070
|
+
This decorator respects the @project decorator and triggers the flow
|
|
1071
|
+
when upstream runs within the same namespace complete successfully
|
|
1072
|
+
|
|
1073
|
+
Additionally, you can specify project aware upstream flow dependencies
|
|
1074
|
+
by specifying the fully qualified project_flow_name.
|
|
1075
|
+
```
|
|
1076
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
1077
|
+
```
|
|
1078
|
+
or
|
|
1079
|
+
```
|
|
1080
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
1081
|
+
```
|
|
1082
|
+
|
|
1083
|
+
You can also specify just the project or project branch (other values will be
|
|
1084
|
+
inferred from the current project or project branch):
|
|
1085
|
+
```
|
|
1086
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
1087
|
+
```
|
|
1088
|
+
|
|
1089
|
+
Note that `branch` is typically one of:
|
|
1090
|
+
- `prod`
|
|
1091
|
+
- `user.bob`
|
|
1092
|
+
- `test.my_experiment`
|
|
1093
|
+
- `prod.staging`
|
|
1080
1094
|
|
|
1081
1095
|
|
|
1082
1096
|
Parameters
|
|
1083
1097
|
----------
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
exponential_backoff : bool
|
|
1091
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1092
|
-
pool : str
|
|
1093
|
-
the slot pool this task should run in,
|
|
1094
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1095
|
-
soft_fail : bool
|
|
1096
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1097
|
-
name : str
|
|
1098
|
-
Name of the sensor on Airflow
|
|
1099
|
-
description : str
|
|
1100
|
-
Description of sensor in the Airflow UI
|
|
1101
|
-
external_dag_id : str
|
|
1102
|
-
The dag_id that contains the task you want to wait for.
|
|
1103
|
-
external_task_ids : List[str]
|
|
1104
|
-
The list of task_ids that you want to wait for.
|
|
1105
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1106
|
-
allowed_states : List[str]
|
|
1107
|
-
Iterable of allowed states, (Default: ['success'])
|
|
1108
|
-
failed_states : List[str]
|
|
1109
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
|
1110
|
-
execution_delta : datetime.timedelta
|
|
1111
|
-
time difference with the previous execution to look at,
|
|
1112
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1113
|
-
check_existence: bool
|
|
1114
|
-
Set to True to check if the external task exists or check if
|
|
1115
|
-
the DAG to wait for exists. (Default: True)
|
|
1098
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
|
1099
|
+
Upstream flow dependency for this flow.
|
|
1100
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
|
1101
|
+
Upstream flow dependencies for this flow.
|
|
1102
|
+
options : Dict[str, Any], default {}
|
|
1103
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1116
1104
|
"""
|
|
1117
1105
|
...
|
|
1118
1106
|
|
|
1119
1107
|
@typing.overload
|
|
1120
|
-
def
|
|
1108
|
+
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]]:
|
|
1121
1109
|
"""
|
|
1122
|
-
Specifies the
|
|
1110
|
+
Specifies the times when the flow should be run when running on a
|
|
1111
|
+
production scheduler.
|
|
1123
1112
|
|
|
1124
|
-
Use `@pypi_base` to set common packages required by all
|
|
1125
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1126
1113
|
|
|
1127
1114
|
Parameters
|
|
1128
1115
|
----------
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1116
|
+
hourly : bool, default False
|
|
1117
|
+
Run the workflow hourly.
|
|
1118
|
+
daily : bool, default True
|
|
1119
|
+
Run the workflow daily.
|
|
1120
|
+
weekly : bool, default False
|
|
1121
|
+
Run the workflow weekly.
|
|
1122
|
+
cron : str, optional, default None
|
|
1123
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1124
|
+
specified by this expression.
|
|
1125
|
+
timezone : str, optional, default None
|
|
1126
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1127
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1135
1128
|
"""
|
|
1136
1129
|
...
|
|
1137
1130
|
|
|
1138
1131
|
@typing.overload
|
|
1139
|
-
def
|
|
1132
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1140
1133
|
...
|
|
1141
1134
|
|
|
1142
|
-
def
|
|
1135
|
+
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):
|
|
1143
1136
|
"""
|
|
1144
|
-
Specifies the
|
|
1137
|
+
Specifies the times when the flow should be run when running on a
|
|
1138
|
+
production scheduler.
|
|
1145
1139
|
|
|
1146
|
-
Use `@pypi_base` to set common packages required by all
|
|
1147
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1148
1140
|
|
|
1149
1141
|
Parameters
|
|
1150
1142
|
----------
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1143
|
+
hourly : bool, default False
|
|
1144
|
+
Run the workflow hourly.
|
|
1145
|
+
daily : bool, default True
|
|
1146
|
+
Run the workflow daily.
|
|
1147
|
+
weekly : bool, default False
|
|
1148
|
+
Run the workflow weekly.
|
|
1149
|
+
cron : str, optional, default None
|
|
1150
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1151
|
+
specified by this expression.
|
|
1152
|
+
timezone : str, optional, default None
|
|
1153
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1154
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1157
1155
|
"""
|
|
1158
1156
|
...
|
|
1159
1157
|
|
|
@@ -1251,88 +1249,96 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
|
1251
1249
|
...
|
|
1252
1250
|
|
|
1253
1251
|
@typing.overload
|
|
1254
|
-
def
|
|
1252
|
+
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]]:
|
|
1255
1253
|
"""
|
|
1256
|
-
Specifies the
|
|
1257
|
-
|
|
1254
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1255
|
+
|
|
1256
|
+
Use `@conda_base` to set common libraries required by all
|
|
1257
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1258
1258
|
|
|
1259
1259
|
|
|
1260
1260
|
Parameters
|
|
1261
1261
|
----------
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1273
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1262
|
+
packages : Dict[str, str], default {}
|
|
1263
|
+
Packages to use for this flow. The key is the name of the package
|
|
1264
|
+
and the value is the version to use.
|
|
1265
|
+
libraries : Dict[str, str], default {}
|
|
1266
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1267
|
+
python : str, optional, default None
|
|
1268
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1269
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1270
|
+
disabled : bool, default False
|
|
1271
|
+
If set to True, disables Conda.
|
|
1274
1272
|
"""
|
|
1275
1273
|
...
|
|
1276
1274
|
|
|
1277
1275
|
@typing.overload
|
|
1278
|
-
def
|
|
1276
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1279
1277
|
...
|
|
1280
1278
|
|
|
1281
|
-
def
|
|
1279
|
+
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):
|
|
1282
1280
|
"""
|
|
1283
|
-
Specifies the
|
|
1284
|
-
|
|
1281
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1282
|
+
|
|
1283
|
+
Use `@conda_base` to set common libraries required by all
|
|
1284
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1285
1285
|
|
|
1286
1286
|
|
|
1287
1287
|
Parameters
|
|
1288
1288
|
----------
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1300
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1289
|
+
packages : Dict[str, str], default {}
|
|
1290
|
+
Packages to use for this flow. The key is the name of the package
|
|
1291
|
+
and the value is the version to use.
|
|
1292
|
+
libraries : Dict[str, str], default {}
|
|
1293
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1294
|
+
python : str, optional, default None
|
|
1295
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1296
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1297
|
+
disabled : bool, default False
|
|
1298
|
+
If set to True, disables Conda.
|
|
1301
1299
|
"""
|
|
1302
1300
|
...
|
|
1303
1301
|
|
|
1304
|
-
def
|
|
1302
|
+
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]]:
|
|
1305
1303
|
"""
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1304
|
+
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)
|
|
1305
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1306
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1307
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1308
|
+
starts only after all sensors finish.
|
|
1310
1309
|
|
|
1311
1310
|
|
|
1312
1311
|
Parameters
|
|
1313
1312
|
----------
|
|
1313
|
+
timeout : int
|
|
1314
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1315
|
+
poke_interval : int
|
|
1316
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1317
|
+
mode : str
|
|
1318
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1319
|
+
exponential_backoff : bool
|
|
1320
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1321
|
+
pool : str
|
|
1322
|
+
the slot pool this task should run in,
|
|
1323
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1324
|
+
soft_fail : bool
|
|
1325
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1314
1326
|
name : str
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
- if `branch` is specified:
|
|
1331
|
-
- if `production` is True: `prod.<branch>`
|
|
1332
|
-
- if `production` is False: `test.<branch>`
|
|
1333
|
-
- if `branch` is not specified:
|
|
1334
|
-
- if `production` is True: `prod`
|
|
1335
|
-
- if `production` is False: `user.<username>`
|
|
1327
|
+
Name of the sensor on Airflow
|
|
1328
|
+
description : str
|
|
1329
|
+
Description of sensor in the Airflow UI
|
|
1330
|
+
bucket_key : Union[str, List[str]]
|
|
1331
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1332
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1333
|
+
bucket_name : str
|
|
1334
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1335
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1336
|
+
wildcard_match : bool
|
|
1337
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1338
|
+
aws_conn_id : str
|
|
1339
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
|
1340
|
+
verify : bool
|
|
1341
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1336
1342
|
"""
|
|
1337
1343
|
...
|
|
1338
1344
|
|