metaflow-stubs 2.18.7__py2.py3-none-any.whl → 2.18.9__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 +664 -663
- metaflow-stubs/cards.pyi +3 -2
- metaflow-stubs/cli.pyi +2 -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 -7
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +6 -6
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +13 -6
- metaflow-stubs/meta_files.pyi +2 -2
- 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 +2 -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 +5 -5
- metaflow-stubs/packaging_sys/backend.pyi +4 -4
- metaflow-stubs/packaging_sys/distribution_support.pyi +6 -6
- metaflow-stubs/packaging_sys/tar_backend.pyi +6 -6
- metaflow-stubs/packaging_sys/utils.pyi +2 -2
- metaflow-stubs/packaging_sys/v1.pyi +4 -4
- metaflow-stubs/parameters.pyi +4 -4
- metaflow-stubs/plugins/__init__.pyi +14 -13
- 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 +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +5 -5
- 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 +3 -3
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +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 +2 -2
- 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 +5 -5
- 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 +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +85 -5
- 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 +3 -3
- 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 +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -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 +2 -2
- metaflow-stubs/plugins/parsers.pyi +25 -0
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- 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 +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +3 -3
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +35 -35
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +5 -5
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +3 -3
- 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 -2
- metaflow-stubs/user_configs/config_options.pyi +4 -4
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- metaflow-stubs/user_decorators/__init__.pyi +2 -2
- metaflow-stubs/user_decorators/common.pyi +2 -2
- metaflow-stubs/user_decorators/mutable_flow.pyi +4 -4
- metaflow-stubs/user_decorators/mutable_step.pyi +4 -4
- metaflow-stubs/user_decorators/user_flow_decorator.pyi +5 -5
- metaflow-stubs/user_decorators/user_step_decorator.pyi +6 -6
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.18.7.dist-info → metaflow_stubs-2.18.9.dist-info}/METADATA +2 -2
- metaflow_stubs-2.18.9.dist-info/RECORD +167 -0
- metaflow_stubs-2.18.7.dist-info/RECORD +0 -166
- {metaflow_stubs-2.18.7.dist-info → metaflow_stubs-2.18.9.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.18.7.dist-info → metaflow_stubs-2.18.9.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
######################################################################################################
|
|
2
2
|
# Auto-generated Metaflow stub file #
|
|
3
|
-
# MF version: 2.18.
|
|
4
|
-
# Generated on 2025-09-
|
|
3
|
+
# MF version: 2.18.9 #
|
|
4
|
+
# Generated on 2025-09-24T20:09:24.398546 #
|
|
5
5
|
######################################################################################################
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
9
|
import typing
|
|
10
10
|
if typing.TYPE_CHECKING:
|
|
11
|
-
import typing
|
|
12
11
|
import datetime
|
|
12
|
+
import typing
|
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
|
15
15
|
|
|
@@ -39,17 +39,18 @@ from .user_decorators.user_step_decorator import UserStepDecorator as UserStepDe
|
|
|
39
39
|
from .user_decorators.user_step_decorator import StepMutator as StepMutator
|
|
40
40
|
from .user_decorators.user_step_decorator import user_step_decorator as user_step_decorator
|
|
41
41
|
from .user_decorators.user_flow_decorator import FlowMutator as FlowMutator
|
|
42
|
+
from . import tuple_util as tuple_util
|
|
42
43
|
from . import events as events
|
|
43
44
|
from . import metaflow_git as metaflow_git
|
|
44
|
-
from . import tuple_util as tuple_util
|
|
45
45
|
from . import runner as runner
|
|
46
46
|
from . import plugins as plugins
|
|
47
47
|
from .plugins.datatools.s3.s3 import S3 as S3
|
|
48
48
|
from . import includefile as includefile
|
|
49
49
|
from .includefile import IncludeFile as IncludeFile
|
|
50
|
+
from .plugins.parsers import yaml_parser as yaml_parser
|
|
50
51
|
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
51
|
-
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
52
52
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
|
53
|
+
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
53
54
|
from . import cards as cards
|
|
54
55
|
from . import client as client
|
|
55
56
|
from .client.core import namespace as namespace
|
|
@@ -152,6 +153,161 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
|
152
153
|
"""
|
|
153
154
|
...
|
|
154
155
|
|
|
156
|
+
@typing.overload
|
|
157
|
+
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, aws_batch_tags: typing.Optional[typing.Dict[str, str]] = 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]]]:
|
|
158
|
+
"""
|
|
159
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
Parameters
|
|
163
|
+
----------
|
|
164
|
+
cpu : int, default 1
|
|
165
|
+
Number of CPUs required for this step. If `@resources` is
|
|
166
|
+
also present, the maximum value from all decorators is used.
|
|
167
|
+
gpu : int, default 0
|
|
168
|
+
Number of GPUs required for this step. If `@resources` is
|
|
169
|
+
also present, the maximum value from all decorators is used.
|
|
170
|
+
memory : int, default 4096
|
|
171
|
+
Memory size (in MB) required for this step. If
|
|
172
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
173
|
+
used.
|
|
174
|
+
image : str, optional, default None
|
|
175
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
|
176
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
177
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
178
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
179
|
+
AWS Batch Job Queue to submit the job to.
|
|
180
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
181
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
182
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
183
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
184
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
185
|
+
shared_memory : int, optional, default None
|
|
186
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
187
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
188
|
+
max_swap : int, optional, default None
|
|
189
|
+
The total amount of swap memory (in MiB) a container can use for this
|
|
190
|
+
step. This parameter is translated to the `--memory-swap` option in
|
|
191
|
+
Docker where the value is the sum of the container memory plus the
|
|
192
|
+
`max_swap` value.
|
|
193
|
+
swappiness : int, optional, default None
|
|
194
|
+
This allows you to tune memory swappiness behavior for this step.
|
|
195
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
196
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
197
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
198
|
+
aws_batch_tags: Dict[str, str], optional, default None
|
|
199
|
+
Sets arbitrary AWS tags on the AWS Batch compute environment.
|
|
200
|
+
Set as string key-value pairs.
|
|
201
|
+
use_tmpfs : bool, default False
|
|
202
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
203
|
+
not available on Fargate compute environments
|
|
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 None
|
|
211
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
212
|
+
inferentia : int, default 0
|
|
213
|
+
Number of Inferentia chips required for this step.
|
|
214
|
+
trainium : int, default None
|
|
215
|
+
Alias for inferentia. Use only one of the two.
|
|
216
|
+
efa : int, default 0
|
|
217
|
+
Number of elastic fabric adapter network devices to attach to container
|
|
218
|
+
ephemeral_storage : int, default None
|
|
219
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
220
|
+
This is only relevant for Fargate compute environments
|
|
221
|
+
log_driver: str, optional, default None
|
|
222
|
+
The log driver to use for the Amazon ECS container.
|
|
223
|
+
log_options: List[str], optional, default None
|
|
224
|
+
List of strings containing options for the chosen log driver. The configurable values
|
|
225
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
226
|
+
Example: [`awslogs-group:aws/batch/job`]
|
|
227
|
+
"""
|
|
228
|
+
...
|
|
229
|
+
|
|
230
|
+
@typing.overload
|
|
231
|
+
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
232
|
+
...
|
|
233
|
+
|
|
234
|
+
@typing.overload
|
|
235
|
+
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
236
|
+
...
|
|
237
|
+
|
|
238
|
+
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, aws_batch_tags: typing.Optional[typing.Dict[str, str]] = 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):
|
|
239
|
+
"""
|
|
240
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
Parameters
|
|
244
|
+
----------
|
|
245
|
+
cpu : int, default 1
|
|
246
|
+
Number of CPUs required for this step. If `@resources` is
|
|
247
|
+
also present, the maximum value from all decorators is used.
|
|
248
|
+
gpu : int, default 0
|
|
249
|
+
Number of GPUs required for this step. If `@resources` is
|
|
250
|
+
also present, the maximum value from all decorators is used.
|
|
251
|
+
memory : int, default 4096
|
|
252
|
+
Memory size (in MB) required for this step. If
|
|
253
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
254
|
+
used.
|
|
255
|
+
image : str, optional, default None
|
|
256
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
|
257
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
258
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
259
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
260
|
+
AWS Batch Job Queue to submit the job to.
|
|
261
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
262
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
263
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
264
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
265
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
266
|
+
shared_memory : int, optional, default None
|
|
267
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
268
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
269
|
+
max_swap : int, optional, default None
|
|
270
|
+
The total amount of swap memory (in MiB) a container can use for this
|
|
271
|
+
step. This parameter is translated to the `--memory-swap` option in
|
|
272
|
+
Docker where the value is the sum of the container memory plus the
|
|
273
|
+
`max_swap` value.
|
|
274
|
+
swappiness : int, optional, default None
|
|
275
|
+
This allows you to tune memory swappiness behavior for this step.
|
|
276
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
277
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
278
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
279
|
+
aws_batch_tags: Dict[str, str], optional, default None
|
|
280
|
+
Sets arbitrary AWS tags on the AWS Batch compute environment.
|
|
281
|
+
Set as string key-value pairs.
|
|
282
|
+
use_tmpfs : bool, default False
|
|
283
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
284
|
+
not available on Fargate compute environments
|
|
285
|
+
tmpfs_tempdir : bool, default True
|
|
286
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
287
|
+
tmpfs_size : int, optional, default None
|
|
288
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
289
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
290
|
+
memory allocated for this step.
|
|
291
|
+
tmpfs_path : str, optional, default None
|
|
292
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
293
|
+
inferentia : int, default 0
|
|
294
|
+
Number of Inferentia chips required for this step.
|
|
295
|
+
trainium : int, default None
|
|
296
|
+
Alias for inferentia. Use only one of the two.
|
|
297
|
+
efa : int, default 0
|
|
298
|
+
Number of elastic fabric adapter network devices to attach to container
|
|
299
|
+
ephemeral_storage : int, default None
|
|
300
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
301
|
+
This is only relevant for Fargate compute environments
|
|
302
|
+
log_driver: str, optional, default None
|
|
303
|
+
The log driver to use for the Amazon ECS container.
|
|
304
|
+
log_options: List[str], optional, default None
|
|
305
|
+
List of strings containing options for the chosen log driver. The configurable values
|
|
306
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
307
|
+
Example: [`awslogs-group:aws/batch/job`]
|
|
308
|
+
"""
|
|
309
|
+
...
|
|
310
|
+
|
|
155
311
|
@typing.overload
|
|
156
312
|
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]]]:
|
|
157
313
|
"""
|
|
@@ -211,6 +367,74 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
|
211
367
|
"""
|
|
212
368
|
...
|
|
213
369
|
|
|
370
|
+
@typing.overload
|
|
371
|
+
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]]]:
|
|
372
|
+
"""
|
|
373
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
374
|
+
|
|
375
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
Parameters
|
|
379
|
+
----------
|
|
380
|
+
type : str, default 'default'
|
|
381
|
+
Card type.
|
|
382
|
+
id : str, optional, default None
|
|
383
|
+
If multiple cards are present, use this id to identify this card.
|
|
384
|
+
options : Dict[str, Any], default {}
|
|
385
|
+
Options passed to the card. The contents depend on the card type.
|
|
386
|
+
timeout : int, default 45
|
|
387
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
388
|
+
"""
|
|
389
|
+
...
|
|
390
|
+
|
|
391
|
+
@typing.overload
|
|
392
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
393
|
+
...
|
|
394
|
+
|
|
395
|
+
@typing.overload
|
|
396
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
397
|
+
...
|
|
398
|
+
|
|
399
|
+
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):
|
|
400
|
+
"""
|
|
401
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
402
|
+
|
|
403
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
Parameters
|
|
407
|
+
----------
|
|
408
|
+
type : str, default 'default'
|
|
409
|
+
Card type.
|
|
410
|
+
id : str, optional, default None
|
|
411
|
+
If multiple cards are present, use this id to identify this card.
|
|
412
|
+
options : Dict[str, Any], default {}
|
|
413
|
+
Options passed to the card. The contents depend on the card type.
|
|
414
|
+
timeout : int, default 45
|
|
415
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
416
|
+
"""
|
|
417
|
+
...
|
|
418
|
+
|
|
419
|
+
@typing.overload
|
|
420
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
421
|
+
"""
|
|
422
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
423
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
424
|
+
"""
|
|
425
|
+
...
|
|
426
|
+
|
|
427
|
+
@typing.overload
|
|
428
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
429
|
+
...
|
|
430
|
+
|
|
431
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
432
|
+
"""
|
|
433
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
434
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
435
|
+
"""
|
|
436
|
+
...
|
|
437
|
+
|
|
214
438
|
@typing.overload
|
|
215
439
|
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]]]:
|
|
216
440
|
"""
|
|
@@ -263,30 +487,146 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
263
487
|
...
|
|
264
488
|
|
|
265
489
|
@typing.overload
|
|
266
|
-
def
|
|
490
|
+
def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
267
491
|
"""
|
|
268
|
-
Specifies
|
|
269
|
-
|
|
492
|
+
Specifies the number of times the task corresponding
|
|
493
|
+
to a step needs to be retried.
|
|
494
|
+
|
|
495
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
496
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
497
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
498
|
+
|
|
499
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
500
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
501
|
+
ensuring that the flow execution can continue.
|
|
270
502
|
|
|
271
503
|
|
|
272
504
|
Parameters
|
|
273
505
|
----------
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
506
|
+
times : int, default 3
|
|
507
|
+
Number of times to retry this task.
|
|
508
|
+
minutes_between_retries : int, default 2
|
|
509
|
+
Number of minutes between retries.
|
|
278
510
|
"""
|
|
279
511
|
...
|
|
280
512
|
|
|
281
513
|
@typing.overload
|
|
282
|
-
def
|
|
514
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
283
515
|
...
|
|
284
516
|
|
|
285
517
|
@typing.overload
|
|
286
|
-
def
|
|
518
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
287
519
|
...
|
|
288
520
|
|
|
289
|
-
def
|
|
521
|
+
def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
|
|
522
|
+
"""
|
|
523
|
+
Specifies the number of times the task corresponding
|
|
524
|
+
to a step needs to be retried.
|
|
525
|
+
|
|
526
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
527
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
528
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
529
|
+
|
|
530
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
531
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
532
|
+
ensuring that the flow execution can continue.
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
Parameters
|
|
536
|
+
----------
|
|
537
|
+
times : int, default 3
|
|
538
|
+
Number of times to retry this task.
|
|
539
|
+
minutes_between_retries : int, default 2
|
|
540
|
+
Number of minutes between retries.
|
|
541
|
+
"""
|
|
542
|
+
...
|
|
543
|
+
|
|
544
|
+
@typing.overload
|
|
545
|
+
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]]]:
|
|
546
|
+
"""
|
|
547
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
Parameters
|
|
551
|
+
----------
|
|
552
|
+
vars : Dict[str, str], default {}
|
|
553
|
+
Dictionary of environment variables to set.
|
|
554
|
+
"""
|
|
555
|
+
...
|
|
556
|
+
|
|
557
|
+
@typing.overload
|
|
558
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
559
|
+
...
|
|
560
|
+
|
|
561
|
+
@typing.overload
|
|
562
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
563
|
+
...
|
|
564
|
+
|
|
565
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
566
|
+
"""
|
|
567
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
Parameters
|
|
571
|
+
----------
|
|
572
|
+
vars : Dict[str, str], default {}
|
|
573
|
+
Dictionary of environment variables to set.
|
|
574
|
+
"""
|
|
575
|
+
...
|
|
576
|
+
|
|
577
|
+
@typing.overload
|
|
578
|
+
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]]]:
|
|
579
|
+
"""
|
|
580
|
+
Specifies the PyPI packages for the step.
|
|
581
|
+
|
|
582
|
+
Information in this decorator will augment any
|
|
583
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
584
|
+
you can use `@pypi_base` to set packages required by all
|
|
585
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
Parameters
|
|
589
|
+
----------
|
|
590
|
+
packages : Dict[str, str], default: {}
|
|
591
|
+
Packages to use for this step. The key is the name of the package
|
|
592
|
+
and the value is the version to use.
|
|
593
|
+
python : str, optional, default: None
|
|
594
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
595
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
596
|
+
"""
|
|
597
|
+
...
|
|
598
|
+
|
|
599
|
+
@typing.overload
|
|
600
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
601
|
+
...
|
|
602
|
+
|
|
603
|
+
@typing.overload
|
|
604
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
605
|
+
...
|
|
606
|
+
|
|
607
|
+
def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
608
|
+
"""
|
|
609
|
+
Specifies the PyPI packages for the step.
|
|
610
|
+
|
|
611
|
+
Information in this decorator will augment any
|
|
612
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
613
|
+
you can use `@pypi_base` to set packages required by all
|
|
614
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
Parameters
|
|
618
|
+
----------
|
|
619
|
+
packages : Dict[str, str], default: {}
|
|
620
|
+
Packages to use for this step. The key is the name of the package
|
|
621
|
+
and the value is the version to use.
|
|
622
|
+
python : str, optional, default: None
|
|
623
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
624
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
625
|
+
"""
|
|
626
|
+
...
|
|
627
|
+
|
|
628
|
+
@typing.overload
|
|
629
|
+
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: 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]]]:
|
|
290
630
|
"""
|
|
291
631
|
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
292
632
|
the execution of a step.
|
|
@@ -302,57 +642,84 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
|
302
642
|
...
|
|
303
643
|
|
|
304
644
|
@typing.overload
|
|
305
|
-
def
|
|
645
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
646
|
+
...
|
|
647
|
+
|
|
648
|
+
@typing.overload
|
|
649
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
650
|
+
...
|
|
651
|
+
|
|
652
|
+
def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: typing.Optional[str] = None):
|
|
306
653
|
"""
|
|
307
|
-
Specifies
|
|
308
|
-
|
|
654
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
655
|
+
the execution of a step.
|
|
309
656
|
|
|
310
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
311
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
312
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
313
657
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
658
|
+
Parameters
|
|
659
|
+
----------
|
|
660
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
661
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
662
|
+
role : str, optional, default: None
|
|
663
|
+
Role to use for fetching secrets
|
|
664
|
+
"""
|
|
665
|
+
...
|
|
666
|
+
|
|
667
|
+
@typing.overload
|
|
668
|
+
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]]]:
|
|
669
|
+
"""
|
|
670
|
+
Specifies the Conda environment for the step.
|
|
671
|
+
|
|
672
|
+
Information in this decorator will augment any
|
|
673
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
674
|
+
you can use `@conda_base` to set packages required by all
|
|
675
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
317
676
|
|
|
318
677
|
|
|
319
678
|
Parameters
|
|
320
679
|
----------
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
680
|
+
packages : Dict[str, str], default {}
|
|
681
|
+
Packages to use for this step. The key is the name of the package
|
|
682
|
+
and the value is the version to use.
|
|
683
|
+
libraries : Dict[str, str], default {}
|
|
684
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
685
|
+
python : str, optional, default None
|
|
686
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
687
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
688
|
+
disabled : bool, default False
|
|
689
|
+
If set to True, disables @conda.
|
|
325
690
|
"""
|
|
326
691
|
...
|
|
327
692
|
|
|
328
693
|
@typing.overload
|
|
329
|
-
def
|
|
694
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
330
695
|
...
|
|
331
696
|
|
|
332
697
|
@typing.overload
|
|
333
|
-
def
|
|
698
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
334
699
|
...
|
|
335
700
|
|
|
336
|
-
def
|
|
701
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
|
337
702
|
"""
|
|
338
|
-
Specifies the
|
|
339
|
-
to a step needs to be retried.
|
|
340
|
-
|
|
341
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
342
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
343
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
703
|
+
Specifies the Conda environment for the step.
|
|
344
704
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
705
|
+
Information in this decorator will augment any
|
|
706
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
707
|
+
you can use `@conda_base` to set packages required by all
|
|
708
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
348
709
|
|
|
349
710
|
|
|
350
711
|
Parameters
|
|
351
712
|
----------
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
713
|
+
packages : Dict[str, str], default {}
|
|
714
|
+
Packages to use for this step. The key is the name of the package
|
|
715
|
+
and the value is the version to use.
|
|
716
|
+
libraries : Dict[str, str], default {}
|
|
717
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
718
|
+
python : str, optional, default None
|
|
719
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
720
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
721
|
+
disabled : bool, default False
|
|
722
|
+
If set to True, disables @conda.
|
|
356
723
|
"""
|
|
357
724
|
...
|
|
358
725
|
|
|
@@ -446,660 +813,122 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
|
446
813
|
...
|
|
447
814
|
|
|
448
815
|
@typing.overload
|
|
449
|
-
def
|
|
816
|
+
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]]]:
|
|
450
817
|
"""
|
|
451
|
-
Specifies the
|
|
818
|
+
Specifies the resources needed when executing this step.
|
|
452
819
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
820
|
+
Use `@resources` to specify the resource requirements
|
|
821
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
822
|
+
|
|
823
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
824
|
+
```
|
|
825
|
+
python myflow.py run --with batch
|
|
826
|
+
```
|
|
827
|
+
or
|
|
828
|
+
```
|
|
829
|
+
python myflow.py run --with kubernetes
|
|
830
|
+
```
|
|
831
|
+
which executes the flow on the desired system using the
|
|
832
|
+
requirements specified in `@resources`.
|
|
457
833
|
|
|
458
834
|
|
|
459
835
|
Parameters
|
|
460
836
|
----------
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
837
|
+
cpu : int, default 1
|
|
838
|
+
Number of CPUs required for this step.
|
|
839
|
+
gpu : int, optional, default None
|
|
840
|
+
Number of GPUs required for this step.
|
|
841
|
+
disk : int, optional, default None
|
|
842
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
843
|
+
memory : int, default 4096
|
|
844
|
+
Memory size (in MB) required for this step.
|
|
845
|
+
shared_memory : int, optional, default None
|
|
846
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
847
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
471
848
|
"""
|
|
472
849
|
...
|
|
473
850
|
|
|
474
851
|
@typing.overload
|
|
475
|
-
def
|
|
852
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
476
853
|
...
|
|
477
854
|
|
|
478
855
|
@typing.overload
|
|
479
|
-
def
|
|
856
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
480
857
|
...
|
|
481
858
|
|
|
482
|
-
def
|
|
483
|
-
"""
|
|
484
|
-
Specifies the
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
----------
|
|
515
|
-
vars : Dict[str, str], default {}
|
|
516
|
-
Dictionary of environment variables to set.
|
|
517
|
-
"""
|
|
518
|
-
...
|
|
519
|
-
|
|
520
|
-
@typing.overload
|
|
521
|
-
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
522
|
-
...
|
|
523
|
-
|
|
524
|
-
@typing.overload
|
|
525
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
526
|
-
...
|
|
527
|
-
|
|
528
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
529
|
-
"""
|
|
530
|
-
Specifies environment variables to be set prior to the execution of a step.
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
Parameters
|
|
534
|
-
----------
|
|
535
|
-
vars : Dict[str, str], default {}
|
|
536
|
-
Dictionary of environment variables to set.
|
|
537
|
-
"""
|
|
538
|
-
...
|
|
539
|
-
|
|
540
|
-
@typing.overload
|
|
541
|
-
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, aws_batch_tags: typing.Optional[typing.Dict[str, str]] = 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]]]:
|
|
542
|
-
"""
|
|
543
|
-
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
Parameters
|
|
547
|
-
----------
|
|
548
|
-
cpu : int, default 1
|
|
549
|
-
Number of CPUs required for this step. If `@resources` is
|
|
550
|
-
also present, the maximum value from all decorators is used.
|
|
551
|
-
gpu : int, default 0
|
|
552
|
-
Number of GPUs required for this step. If `@resources` is
|
|
553
|
-
also present, the maximum value from all decorators is used.
|
|
554
|
-
memory : int, default 4096
|
|
555
|
-
Memory size (in MB) required for this step. If
|
|
556
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
557
|
-
used.
|
|
558
|
-
image : str, optional, default None
|
|
559
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
|
560
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
561
|
-
not, a default Docker image mapping to the current version of Python is used.
|
|
562
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
563
|
-
AWS Batch Job Queue to submit the job to.
|
|
564
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
565
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
566
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
567
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
568
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
569
|
-
shared_memory : int, optional, default None
|
|
570
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
571
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
572
|
-
max_swap : int, optional, default None
|
|
573
|
-
The total amount of swap memory (in MiB) a container can use for this
|
|
574
|
-
step. This parameter is translated to the `--memory-swap` option in
|
|
575
|
-
Docker where the value is the sum of the container memory plus the
|
|
576
|
-
`max_swap` value.
|
|
577
|
-
swappiness : int, optional, default None
|
|
578
|
-
This allows you to tune memory swappiness behavior for this step.
|
|
579
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
580
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
581
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
582
|
-
aws_batch_tags: Dict[str, str], optional, default None
|
|
583
|
-
Sets arbitrary AWS tags on the AWS Batch compute environment.
|
|
584
|
-
Set as string key-value pairs.
|
|
585
|
-
use_tmpfs : bool, default False
|
|
586
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
587
|
-
not available on Fargate compute environments
|
|
588
|
-
tmpfs_tempdir : bool, default True
|
|
589
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
590
|
-
tmpfs_size : int, optional, default None
|
|
591
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
592
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
593
|
-
memory allocated for this step.
|
|
594
|
-
tmpfs_path : str, optional, default None
|
|
595
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
596
|
-
inferentia : int, default 0
|
|
597
|
-
Number of Inferentia chips required for this step.
|
|
598
|
-
trainium : int, default None
|
|
599
|
-
Alias for inferentia. Use only one of the two.
|
|
600
|
-
efa : int, default 0
|
|
601
|
-
Number of elastic fabric adapter network devices to attach to container
|
|
602
|
-
ephemeral_storage : int, default None
|
|
603
|
-
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
604
|
-
This is only relevant for Fargate compute environments
|
|
605
|
-
log_driver: str, optional, default None
|
|
606
|
-
The log driver to use for the Amazon ECS container.
|
|
607
|
-
log_options: List[str], optional, default None
|
|
608
|
-
List of strings containing options for the chosen log driver. The configurable values
|
|
609
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
610
|
-
Example: [`awslogs-group:aws/batch/job`]
|
|
611
|
-
"""
|
|
612
|
-
...
|
|
613
|
-
|
|
614
|
-
@typing.overload
|
|
615
|
-
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
616
|
-
...
|
|
617
|
-
|
|
618
|
-
@typing.overload
|
|
619
|
-
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
620
|
-
...
|
|
621
|
-
|
|
622
|
-
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, aws_batch_tags: typing.Optional[typing.Dict[str, str]] = 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):
|
|
623
|
-
"""
|
|
624
|
-
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
Parameters
|
|
628
|
-
----------
|
|
629
|
-
cpu : int, default 1
|
|
630
|
-
Number of CPUs required for this step. If `@resources` is
|
|
631
|
-
also present, the maximum value from all decorators is used.
|
|
632
|
-
gpu : int, default 0
|
|
633
|
-
Number of GPUs required for this step. If `@resources` is
|
|
634
|
-
also present, the maximum value from all decorators is used.
|
|
635
|
-
memory : int, default 4096
|
|
636
|
-
Memory size (in MB) required for this step. If
|
|
637
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
638
|
-
used.
|
|
639
|
-
image : str, optional, default None
|
|
640
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
|
641
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
642
|
-
not, a default Docker image mapping to the current version of Python is used.
|
|
643
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
644
|
-
AWS Batch Job Queue to submit the job to.
|
|
645
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
646
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
647
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
648
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
649
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
650
|
-
shared_memory : int, optional, default None
|
|
651
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
652
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
653
|
-
max_swap : int, optional, default None
|
|
654
|
-
The total amount of swap memory (in MiB) a container can use for this
|
|
655
|
-
step. This parameter is translated to the `--memory-swap` option in
|
|
656
|
-
Docker where the value is the sum of the container memory plus the
|
|
657
|
-
`max_swap` value.
|
|
658
|
-
swappiness : int, optional, default None
|
|
659
|
-
This allows you to tune memory swappiness behavior for this step.
|
|
660
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
661
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
662
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
663
|
-
aws_batch_tags: Dict[str, str], optional, default None
|
|
664
|
-
Sets arbitrary AWS tags on the AWS Batch compute environment.
|
|
665
|
-
Set as string key-value pairs.
|
|
666
|
-
use_tmpfs : bool, default False
|
|
667
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
668
|
-
not available on Fargate compute environments
|
|
669
|
-
tmpfs_tempdir : bool, default True
|
|
670
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
671
|
-
tmpfs_size : int, optional, default None
|
|
672
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
673
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
674
|
-
memory allocated for this step.
|
|
675
|
-
tmpfs_path : str, optional, default None
|
|
676
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
677
|
-
inferentia : int, default 0
|
|
678
|
-
Number of Inferentia chips required for this step.
|
|
679
|
-
trainium : int, default None
|
|
680
|
-
Alias for inferentia. Use only one of the two.
|
|
681
|
-
efa : int, default 0
|
|
682
|
-
Number of elastic fabric adapter network devices to attach to container
|
|
683
|
-
ephemeral_storage : int, default None
|
|
684
|
-
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
685
|
-
This is only relevant for Fargate compute environments
|
|
686
|
-
log_driver: str, optional, default None
|
|
687
|
-
The log driver to use for the Amazon ECS container.
|
|
688
|
-
log_options: List[str], optional, default None
|
|
689
|
-
List of strings containing options for the chosen log driver. The configurable values
|
|
690
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
691
|
-
Example: [`awslogs-group:aws/batch/job`]
|
|
692
|
-
"""
|
|
693
|
-
...
|
|
694
|
-
|
|
695
|
-
@typing.overload
|
|
696
|
-
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]]]:
|
|
697
|
-
"""
|
|
698
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
699
|
-
|
|
700
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
Parameters
|
|
704
|
-
----------
|
|
705
|
-
type : str, default 'default'
|
|
706
|
-
Card type.
|
|
707
|
-
id : str, optional, default None
|
|
708
|
-
If multiple cards are present, use this id to identify this card.
|
|
709
|
-
options : Dict[str, Any], default {}
|
|
710
|
-
Options passed to the card. The contents depend on the card type.
|
|
711
|
-
timeout : int, default 45
|
|
712
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
713
|
-
"""
|
|
714
|
-
...
|
|
715
|
-
|
|
716
|
-
@typing.overload
|
|
717
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
718
|
-
...
|
|
719
|
-
|
|
720
|
-
@typing.overload
|
|
721
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
722
|
-
...
|
|
723
|
-
|
|
724
|
-
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):
|
|
725
|
-
"""
|
|
726
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
727
|
-
|
|
728
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
Parameters
|
|
732
|
-
----------
|
|
733
|
-
type : str, default 'default'
|
|
734
|
-
Card type.
|
|
735
|
-
id : str, optional, default None
|
|
736
|
-
If multiple cards are present, use this id to identify this card.
|
|
737
|
-
options : Dict[str, Any], default {}
|
|
738
|
-
Options passed to the card. The contents depend on the card type.
|
|
739
|
-
timeout : int, default 45
|
|
740
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
741
|
-
"""
|
|
742
|
-
...
|
|
743
|
-
|
|
744
|
-
@typing.overload
|
|
745
|
-
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]]]:
|
|
746
|
-
"""
|
|
747
|
-
Specifies the PyPI packages for the step.
|
|
748
|
-
|
|
749
|
-
Information in this decorator will augment any
|
|
750
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
751
|
-
you can use `@pypi_base` to set packages required by all
|
|
752
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
Parameters
|
|
756
|
-
----------
|
|
757
|
-
packages : Dict[str, str], default: {}
|
|
758
|
-
Packages to use for this step. The key is the name of the package
|
|
759
|
-
and the value is the version to use.
|
|
760
|
-
python : str, optional, default: None
|
|
761
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
762
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
763
|
-
"""
|
|
764
|
-
...
|
|
765
|
-
|
|
766
|
-
@typing.overload
|
|
767
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
768
|
-
...
|
|
769
|
-
|
|
770
|
-
@typing.overload
|
|
771
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
772
|
-
...
|
|
773
|
-
|
|
774
|
-
def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
775
|
-
"""
|
|
776
|
-
Specifies the PyPI packages for the step.
|
|
777
|
-
|
|
778
|
-
Information in this decorator will augment any
|
|
779
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
780
|
-
you can use `@pypi_base` to set packages required by all
|
|
781
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
Parameters
|
|
785
|
-
----------
|
|
786
|
-
packages : Dict[str, str], default: {}
|
|
787
|
-
Packages to use for this step. The key is the name of the package
|
|
788
|
-
and the value is the version to use.
|
|
789
|
-
python : str, optional, default: None
|
|
790
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
791
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
792
|
-
"""
|
|
793
|
-
...
|
|
794
|
-
|
|
795
|
-
@typing.overload
|
|
796
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
797
|
-
"""
|
|
798
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
799
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
800
|
-
"""
|
|
801
|
-
...
|
|
802
|
-
|
|
803
|
-
@typing.overload
|
|
804
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
805
|
-
...
|
|
806
|
-
|
|
807
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
808
|
-
"""
|
|
809
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
810
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
811
|
-
"""
|
|
812
|
-
...
|
|
813
|
-
|
|
814
|
-
@typing.overload
|
|
815
|
-
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]]]:
|
|
816
|
-
"""
|
|
817
|
-
Specifies the resources needed when executing this step.
|
|
818
|
-
|
|
819
|
-
Use `@resources` to specify the resource requirements
|
|
820
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
821
|
-
|
|
822
|
-
You can choose the compute layer on the command line by executing e.g.
|
|
823
|
-
```
|
|
824
|
-
python myflow.py run --with batch
|
|
825
|
-
```
|
|
826
|
-
or
|
|
827
|
-
```
|
|
828
|
-
python myflow.py run --with kubernetes
|
|
829
|
-
```
|
|
830
|
-
which executes the flow on the desired system using the
|
|
831
|
-
requirements specified in `@resources`.
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
Parameters
|
|
835
|
-
----------
|
|
836
|
-
cpu : int, default 1
|
|
837
|
-
Number of CPUs required for this step.
|
|
838
|
-
gpu : int, optional, default None
|
|
839
|
-
Number of GPUs required for this step.
|
|
840
|
-
disk : int, optional, default None
|
|
841
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
842
|
-
memory : int, default 4096
|
|
843
|
-
Memory size (in MB) required for this step.
|
|
844
|
-
shared_memory : int, optional, default None
|
|
845
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
846
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
847
|
-
"""
|
|
848
|
-
...
|
|
849
|
-
|
|
850
|
-
@typing.overload
|
|
851
|
-
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
852
|
-
...
|
|
853
|
-
|
|
854
|
-
@typing.overload
|
|
855
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
856
|
-
...
|
|
857
|
-
|
|
858
|
-
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):
|
|
859
|
-
"""
|
|
860
|
-
Specifies the resources needed when executing this step.
|
|
861
|
-
|
|
862
|
-
Use `@resources` to specify the resource requirements
|
|
863
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
864
|
-
|
|
865
|
-
You can choose the compute layer on the command line by executing e.g.
|
|
866
|
-
```
|
|
867
|
-
python myflow.py run --with batch
|
|
868
|
-
```
|
|
869
|
-
or
|
|
870
|
-
```
|
|
871
|
-
python myflow.py run --with kubernetes
|
|
872
|
-
```
|
|
873
|
-
which executes the flow on the desired system using the
|
|
874
|
-
requirements specified in `@resources`.
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
Parameters
|
|
878
|
-
----------
|
|
879
|
-
cpu : int, default 1
|
|
880
|
-
Number of CPUs required for this step.
|
|
881
|
-
gpu : int, optional, default None
|
|
882
|
-
Number of GPUs required for this step.
|
|
883
|
-
disk : int, optional, default None
|
|
884
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
885
|
-
memory : int, default 4096
|
|
886
|
-
Memory size (in MB) required for this step.
|
|
887
|
-
shared_memory : int, optional, default None
|
|
888
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
889
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
890
|
-
"""
|
|
891
|
-
...
|
|
892
|
-
|
|
893
|
-
@typing.overload
|
|
894
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
895
|
-
"""
|
|
896
|
-
Specifies the PyPI packages for all steps of the flow.
|
|
897
|
-
|
|
898
|
-
Use `@pypi_base` to set common packages required by all
|
|
899
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
900
|
-
|
|
901
|
-
Parameters
|
|
902
|
-
----------
|
|
903
|
-
packages : Dict[str, str], default: {}
|
|
904
|
-
Packages to use for this flow. The key is the name of the package
|
|
905
|
-
and the value is the version to use.
|
|
906
|
-
python : str, optional, default: None
|
|
907
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
908
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
909
|
-
"""
|
|
910
|
-
...
|
|
911
|
-
|
|
912
|
-
@typing.overload
|
|
913
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
914
|
-
...
|
|
915
|
-
|
|
916
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
917
|
-
"""
|
|
918
|
-
Specifies the PyPI packages for all steps of the flow.
|
|
919
|
-
|
|
920
|
-
Use `@pypi_base` to set common packages required by all
|
|
921
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
922
|
-
|
|
923
|
-
Parameters
|
|
924
|
-
----------
|
|
925
|
-
packages : Dict[str, str], default: {}
|
|
926
|
-
Packages to use for this flow. The key is the name of the package
|
|
927
|
-
and the value is the version to use.
|
|
928
|
-
python : str, optional, default: None
|
|
929
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
930
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
931
|
-
"""
|
|
932
|
-
...
|
|
933
|
-
|
|
934
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
935
|
-
"""
|
|
936
|
-
Specifies what flows belong to the same project.
|
|
937
|
-
|
|
938
|
-
A project-specific namespace is created for all flows that
|
|
939
|
-
use the same `@project(name)`.
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
Parameters
|
|
943
|
-
----------
|
|
944
|
-
name : str
|
|
945
|
-
Project name. Make sure that the name is unique amongst all
|
|
946
|
-
projects that use the same production scheduler. The name may
|
|
947
|
-
contain only lowercase alphanumeric characters and underscores.
|
|
948
|
-
|
|
949
|
-
branch : Optional[str], default None
|
|
950
|
-
The branch to use. If not specified, the branch is set to
|
|
951
|
-
`user.<username>` unless `production` is set to `True`. This can
|
|
952
|
-
also be set on the command line using `--branch` as a top-level option.
|
|
953
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
|
954
|
-
|
|
955
|
-
production : bool, default False
|
|
956
|
-
Whether or not the branch is the production branch. This can also be set on the
|
|
957
|
-
command line using `--production` as a top-level option. It is an error to specify
|
|
958
|
-
`production` in the decorator and on the command line.
|
|
959
|
-
The project branch name will be:
|
|
960
|
-
- if `branch` is specified:
|
|
961
|
-
- if `production` is True: `prod.<branch>`
|
|
962
|
-
- if `production` is False: `test.<branch>`
|
|
963
|
-
- if `branch` is not specified:
|
|
964
|
-
- if `production` is True: `prod`
|
|
965
|
-
- if `production` is False: `user.<username>`
|
|
966
|
-
"""
|
|
967
|
-
...
|
|
968
|
-
|
|
969
|
-
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]]:
|
|
970
|
-
"""
|
|
971
|
-
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.
|
|
972
|
-
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.
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
Parameters
|
|
976
|
-
----------
|
|
977
|
-
timeout : int
|
|
978
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
979
|
-
poke_interval : int
|
|
980
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
981
|
-
mode : str
|
|
982
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
983
|
-
exponential_backoff : bool
|
|
984
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
985
|
-
pool : str
|
|
986
|
-
the slot pool this task should run in,
|
|
987
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
988
|
-
soft_fail : bool
|
|
989
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
990
|
-
name : str
|
|
991
|
-
Name of the sensor on Airflow
|
|
992
|
-
description : str
|
|
993
|
-
Description of sensor in the Airflow UI
|
|
994
|
-
external_dag_id : str
|
|
995
|
-
The dag_id that contains the task you want to wait for.
|
|
996
|
-
external_task_ids : List[str]
|
|
997
|
-
The list of task_ids that you want to wait for.
|
|
998
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
999
|
-
allowed_states : List[str]
|
|
1000
|
-
Iterable of allowed states, (Default: ['success'])
|
|
1001
|
-
failed_states : List[str]
|
|
1002
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
|
1003
|
-
execution_delta : datetime.timedelta
|
|
1004
|
-
time difference with the previous execution to look at,
|
|
1005
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1006
|
-
check_existence: bool
|
|
1007
|
-
Set to True to check if the external task exists or check if
|
|
1008
|
-
the DAG to wait for exists. (Default: True)
|
|
1009
|
-
"""
|
|
1010
|
-
...
|
|
1011
|
-
|
|
1012
|
-
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]]:
|
|
1013
|
-
"""
|
|
1014
|
-
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)
|
|
1015
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1016
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1017
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1018
|
-
starts only after all sensors finish.
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
Parameters
|
|
1022
|
-
----------
|
|
1023
|
-
timeout : int
|
|
1024
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1025
|
-
poke_interval : int
|
|
1026
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1027
|
-
mode : str
|
|
1028
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1029
|
-
exponential_backoff : bool
|
|
1030
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1031
|
-
pool : str
|
|
1032
|
-
the slot pool this task should run in,
|
|
1033
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1034
|
-
soft_fail : bool
|
|
1035
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1036
|
-
name : str
|
|
1037
|
-
Name of the sensor on Airflow
|
|
1038
|
-
description : str
|
|
1039
|
-
Description of sensor in the Airflow UI
|
|
1040
|
-
bucket_key : Union[str, List[str]]
|
|
1041
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1042
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1043
|
-
bucket_name : str
|
|
1044
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1045
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1046
|
-
wildcard_match : bool
|
|
1047
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1048
|
-
aws_conn_id : str
|
|
1049
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
|
1050
|
-
verify : bool
|
|
1051
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
859
|
+
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):
|
|
860
|
+
"""
|
|
861
|
+
Specifies the resources needed when executing this step.
|
|
862
|
+
|
|
863
|
+
Use `@resources` to specify the resource requirements
|
|
864
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
865
|
+
|
|
866
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
867
|
+
```
|
|
868
|
+
python myflow.py run --with batch
|
|
869
|
+
```
|
|
870
|
+
or
|
|
871
|
+
```
|
|
872
|
+
python myflow.py run --with kubernetes
|
|
873
|
+
```
|
|
874
|
+
which executes the flow on the desired system using the
|
|
875
|
+
requirements specified in `@resources`.
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
Parameters
|
|
879
|
+
----------
|
|
880
|
+
cpu : int, default 1
|
|
881
|
+
Number of CPUs required for this step.
|
|
882
|
+
gpu : int, optional, default None
|
|
883
|
+
Number of GPUs required for this step.
|
|
884
|
+
disk : int, optional, default None
|
|
885
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
886
|
+
memory : int, default 4096
|
|
887
|
+
Memory size (in MB) required for this step.
|
|
888
|
+
shared_memory : int, optional, default None
|
|
889
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
890
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
1052
891
|
"""
|
|
1053
892
|
...
|
|
1054
893
|
|
|
1055
894
|
@typing.overload
|
|
1056
|
-
def
|
|
895
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1057
896
|
"""
|
|
1058
|
-
Specifies the
|
|
1059
|
-
production scheduler.
|
|
897
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1060
898
|
|
|
899
|
+
Use `@pypi_base` to set common packages required by all
|
|
900
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1061
901
|
|
|
1062
902
|
Parameters
|
|
1063
903
|
----------
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
cron : str, optional, default None
|
|
1071
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1072
|
-
specified by this expression.
|
|
1073
|
-
timezone : str, optional, default None
|
|
1074
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1075
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
904
|
+
packages : Dict[str, str], default: {}
|
|
905
|
+
Packages to use for this flow. The key is the name of the package
|
|
906
|
+
and the value is the version to use.
|
|
907
|
+
python : str, optional, default: None
|
|
908
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
909
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1076
910
|
"""
|
|
1077
911
|
...
|
|
1078
912
|
|
|
1079
913
|
@typing.overload
|
|
1080
|
-
def
|
|
914
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1081
915
|
...
|
|
1082
916
|
|
|
1083
|
-
def
|
|
917
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
1084
918
|
"""
|
|
1085
|
-
Specifies the
|
|
1086
|
-
production scheduler.
|
|
919
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1087
920
|
|
|
921
|
+
Use `@pypi_base` to set common packages required by all
|
|
922
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1088
923
|
|
|
1089
924
|
Parameters
|
|
1090
925
|
----------
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
cron : str, optional, default None
|
|
1098
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1099
|
-
specified by this expression.
|
|
1100
|
-
timezone : str, optional, default None
|
|
1101
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1102
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
926
|
+
packages : Dict[str, str], default: {}
|
|
927
|
+
Packages to use for this flow. The key is the name of the package
|
|
928
|
+
and the value is the version to use.
|
|
929
|
+
python : str, optional, default: None
|
|
930
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
931
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1103
932
|
"""
|
|
1104
933
|
...
|
|
1105
934
|
|
|
@@ -1204,6 +1033,135 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
|
1204
1033
|
"""
|
|
1205
1034
|
...
|
|
1206
1035
|
|
|
1036
|
+
@typing.overload
|
|
1037
|
+
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]]:
|
|
1038
|
+
"""
|
|
1039
|
+
Specifies the times when the flow should be run when running on a
|
|
1040
|
+
production scheduler.
|
|
1041
|
+
|
|
1042
|
+
|
|
1043
|
+
Parameters
|
|
1044
|
+
----------
|
|
1045
|
+
hourly : bool, default False
|
|
1046
|
+
Run the workflow hourly.
|
|
1047
|
+
daily : bool, default True
|
|
1048
|
+
Run the workflow daily.
|
|
1049
|
+
weekly : bool, default False
|
|
1050
|
+
Run the workflow weekly.
|
|
1051
|
+
cron : str, optional, default None
|
|
1052
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1053
|
+
specified by this expression.
|
|
1054
|
+
timezone : str, optional, default None
|
|
1055
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1056
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1057
|
+
"""
|
|
1058
|
+
...
|
|
1059
|
+
|
|
1060
|
+
@typing.overload
|
|
1061
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1062
|
+
...
|
|
1063
|
+
|
|
1064
|
+
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):
|
|
1065
|
+
"""
|
|
1066
|
+
Specifies the times when the flow should be run when running on a
|
|
1067
|
+
production scheduler.
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
Parameters
|
|
1071
|
+
----------
|
|
1072
|
+
hourly : bool, default False
|
|
1073
|
+
Run the workflow hourly.
|
|
1074
|
+
daily : bool, default True
|
|
1075
|
+
Run the workflow daily.
|
|
1076
|
+
weekly : bool, default False
|
|
1077
|
+
Run the workflow weekly.
|
|
1078
|
+
cron : str, optional, default None
|
|
1079
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1080
|
+
specified by this expression.
|
|
1081
|
+
timezone : str, optional, default None
|
|
1082
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1083
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1084
|
+
"""
|
|
1085
|
+
...
|
|
1086
|
+
|
|
1087
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1088
|
+
"""
|
|
1089
|
+
Specifies what flows belong to the same project.
|
|
1090
|
+
|
|
1091
|
+
A project-specific namespace is created for all flows that
|
|
1092
|
+
use the same `@project(name)`.
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+
Parameters
|
|
1096
|
+
----------
|
|
1097
|
+
name : str
|
|
1098
|
+
Project name. Make sure that the name is unique amongst all
|
|
1099
|
+
projects that use the same production scheduler. The name may
|
|
1100
|
+
contain only lowercase alphanumeric characters and underscores.
|
|
1101
|
+
|
|
1102
|
+
branch : Optional[str], default None
|
|
1103
|
+
The branch to use. If not specified, the branch is set to
|
|
1104
|
+
`user.<username>` unless `production` is set to `True`. This can
|
|
1105
|
+
also be set on the command line using `--branch` as a top-level option.
|
|
1106
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
|
1107
|
+
|
|
1108
|
+
production : bool, default False
|
|
1109
|
+
Whether or not the branch is the production branch. This can also be set on the
|
|
1110
|
+
command line using `--production` as a top-level option. It is an error to specify
|
|
1111
|
+
`production` in the decorator and on the command line.
|
|
1112
|
+
The project branch name will be:
|
|
1113
|
+
- if `branch` is specified:
|
|
1114
|
+
- if `production` is True: `prod.<branch>`
|
|
1115
|
+
- if `production` is False: `test.<branch>`
|
|
1116
|
+
- if `branch` is not specified:
|
|
1117
|
+
- if `production` is True: `prod`
|
|
1118
|
+
- if `production` is False: `user.<username>`
|
|
1119
|
+
"""
|
|
1120
|
+
...
|
|
1121
|
+
|
|
1122
|
+
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]]:
|
|
1123
|
+
"""
|
|
1124
|
+
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.
|
|
1125
|
+
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.
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
Parameters
|
|
1129
|
+
----------
|
|
1130
|
+
timeout : int
|
|
1131
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1132
|
+
poke_interval : int
|
|
1133
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1134
|
+
mode : str
|
|
1135
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1136
|
+
exponential_backoff : bool
|
|
1137
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1138
|
+
pool : str
|
|
1139
|
+
the slot pool this task should run in,
|
|
1140
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1141
|
+
soft_fail : bool
|
|
1142
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1143
|
+
name : str
|
|
1144
|
+
Name of the sensor on Airflow
|
|
1145
|
+
description : str
|
|
1146
|
+
Description of sensor in the Airflow UI
|
|
1147
|
+
external_dag_id : str
|
|
1148
|
+
The dag_id that contains the task you want to wait for.
|
|
1149
|
+
external_task_ids : List[str]
|
|
1150
|
+
The list of task_ids that you want to wait for.
|
|
1151
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1152
|
+
allowed_states : List[str]
|
|
1153
|
+
Iterable of allowed states, (Default: ['success'])
|
|
1154
|
+
failed_states : List[str]
|
|
1155
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
|
1156
|
+
execution_delta : datetime.timedelta
|
|
1157
|
+
time difference with the previous execution to look at,
|
|
1158
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1159
|
+
check_existence: bool
|
|
1160
|
+
Set to True to check if the external task exists or check if
|
|
1161
|
+
the DAG to wait for exists. (Default: True)
|
|
1162
|
+
"""
|
|
1163
|
+
...
|
|
1164
|
+
|
|
1207
1165
|
@typing.overload
|
|
1208
1166
|
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]]:
|
|
1209
1167
|
"""
|
|
@@ -1255,6 +1213,49 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
|
1255
1213
|
"""
|
|
1256
1214
|
...
|
|
1257
1215
|
|
|
1216
|
+
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]]:
|
|
1217
|
+
"""
|
|
1218
|
+
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)
|
|
1219
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1220
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1221
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1222
|
+
starts only after all sensors finish.
|
|
1223
|
+
|
|
1224
|
+
|
|
1225
|
+
Parameters
|
|
1226
|
+
----------
|
|
1227
|
+
timeout : int
|
|
1228
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1229
|
+
poke_interval : int
|
|
1230
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1231
|
+
mode : str
|
|
1232
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1233
|
+
exponential_backoff : bool
|
|
1234
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1235
|
+
pool : str
|
|
1236
|
+
the slot pool this task should run in,
|
|
1237
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1238
|
+
soft_fail : bool
|
|
1239
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1240
|
+
name : str
|
|
1241
|
+
Name of the sensor on Airflow
|
|
1242
|
+
description : str
|
|
1243
|
+
Description of sensor in the Airflow UI
|
|
1244
|
+
bucket_key : Union[str, List[str]]
|
|
1245
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1246
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1247
|
+
bucket_name : str
|
|
1248
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1249
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1250
|
+
wildcard_match : bool
|
|
1251
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1252
|
+
aws_conn_id : str
|
|
1253
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
|
1254
|
+
verify : bool
|
|
1255
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1256
|
+
"""
|
|
1257
|
+
...
|
|
1258
|
+
|
|
1258
1259
|
@typing.overload
|
|
1259
1260
|
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1260
1261
|
"""
|