metaflow-stubs 2.16.0__py2.py3-none-any.whl → 2.16.2__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 +514 -514
- metaflow-stubs/cards.pyi +2 -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 +5 -5
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/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 +6 -6
- metaflow-stubs/packaging_sys/backend.pyi +2 -2
- metaflow-stubs/packaging_sys/distribution_support.pyi +4 -4
- metaflow-stubs/packaging_sys/tar_backend.pyi +5 -5
- 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 +16 -16
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +5 -5
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +4 -4
- 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 +5 -5
- 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 +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
- 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 +5 -5
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +3 -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 +5 -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 +4 -4
- 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 +5 -5
- 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/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 +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_func.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
- metaflow-stubs/plugins/secrets/utils.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +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 +30 -30
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +3 -3
- 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 +3 -3
- 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 +5 -5
- metaflow-stubs/user_decorators/user_flow_decorator.pyi +5 -5
- metaflow-stubs/user_decorators/user_step_decorator.pyi +5 -5
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.16.0.dist-info → metaflow_stubs-2.16.2.dist-info}/METADATA +2 -2
- metaflow_stubs-2.16.2.dist-info/RECORD +166 -0
- metaflow_stubs-2.16.0.dist-info/RECORD +0 -166
- {metaflow_stubs-2.16.0.dist-info → metaflow_stubs-2.16.2.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.16.0.dist-info → metaflow_stubs-2.16.2.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
######################################################################################################
|
|
2
2
|
# Auto-generated Metaflow stub file #
|
|
3
|
-
# MF version: 2.16.
|
|
4
|
-
# Generated on 2025-07-
|
|
3
|
+
# MF version: 2.16.2 #
|
|
4
|
+
# Generated on 2025-07-15T23:31:58.903931 #
|
|
5
5
|
######################################################################################################
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
@@ -40,16 +40,16 @@ 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
42
|
from . import metaflow_git as metaflow_git
|
|
43
|
-
from . import events as events
|
|
44
43
|
from . import tuple_util as tuple_util
|
|
44
|
+
from . import events as events
|
|
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.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
|
51
50
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
52
51
|
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
52
|
+
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
|
53
53
|
from . import cards as cards
|
|
54
54
|
from . import client as client
|
|
55
55
|
from .client.core import namespace as namespace
|
|
@@ -153,171 +153,149 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
|
153
153
|
...
|
|
154
154
|
|
|
155
155
|
@typing.overload
|
|
156
|
-
def
|
|
156
|
+
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]]]:
|
|
157
157
|
"""
|
|
158
|
-
Specifies the
|
|
158
|
+
Specifies the resources needed when executing this step.
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
Use `@resources` to specify the resource requirements
|
|
161
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
162
|
+
|
|
163
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
164
|
+
```
|
|
165
|
+
python myflow.py run --with batch
|
|
166
|
+
```
|
|
167
|
+
or
|
|
168
|
+
```
|
|
169
|
+
python myflow.py run --with kubernetes
|
|
170
|
+
```
|
|
171
|
+
which executes the flow on the desired system using the
|
|
172
|
+
requirements specified in `@resources`.
|
|
164
173
|
|
|
165
174
|
|
|
166
175
|
Parameters
|
|
167
176
|
----------
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
177
|
+
cpu : int, default 1
|
|
178
|
+
Number of CPUs required for this step.
|
|
179
|
+
gpu : int, optional, default None
|
|
180
|
+
Number of GPUs required for this step.
|
|
181
|
+
disk : int, optional, default None
|
|
182
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
183
|
+
memory : int, default 4096
|
|
184
|
+
Memory size (in MB) required for this step.
|
|
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.
|
|
178
188
|
"""
|
|
179
189
|
...
|
|
180
190
|
|
|
181
191
|
@typing.overload
|
|
182
|
-
def
|
|
192
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
183
193
|
...
|
|
184
194
|
|
|
185
195
|
@typing.overload
|
|
186
|
-
def
|
|
196
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
187
197
|
...
|
|
188
198
|
|
|
189
|
-
def
|
|
199
|
+
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):
|
|
190
200
|
"""
|
|
191
|
-
Specifies the
|
|
201
|
+
Specifies the resources needed when executing this step.
|
|
192
202
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
203
|
+
Use `@resources` to specify the resource requirements
|
|
204
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
205
|
+
|
|
206
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
207
|
+
```
|
|
208
|
+
python myflow.py run --with batch
|
|
209
|
+
```
|
|
210
|
+
or
|
|
211
|
+
```
|
|
212
|
+
python myflow.py run --with kubernetes
|
|
213
|
+
```
|
|
214
|
+
which executes the flow on the desired system using the
|
|
215
|
+
requirements specified in `@resources`.
|
|
197
216
|
|
|
198
217
|
|
|
199
218
|
Parameters
|
|
200
219
|
----------
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
220
|
+
cpu : int, default 1
|
|
221
|
+
Number of CPUs required for this step.
|
|
222
|
+
gpu : int, optional, default None
|
|
223
|
+
Number of GPUs required for this step.
|
|
224
|
+
disk : int, optional, default None
|
|
225
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
226
|
+
memory : int, default 4096
|
|
227
|
+
Memory size (in MB) required for this step.
|
|
228
|
+
shared_memory : int, optional, default None
|
|
229
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
230
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
211
231
|
"""
|
|
212
232
|
...
|
|
213
233
|
|
|
214
234
|
@typing.overload
|
|
215
|
-
def
|
|
235
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
216
236
|
"""
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
The decorator will create an optional artifact, specified by `var`, which
|
|
220
|
-
contains the exception raised. You can use it to detect the presence
|
|
221
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
|
222
|
-
are missing.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
Parameters
|
|
226
|
-
----------
|
|
227
|
-
var : str, optional, default None
|
|
228
|
-
Name of the artifact in which to store the caught exception.
|
|
229
|
-
If not specified, the exception is not stored.
|
|
230
|
-
print_exception : bool, default True
|
|
231
|
-
Determines whether or not the exception is printed to
|
|
232
|
-
stdout when caught.
|
|
237
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
238
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
233
239
|
"""
|
|
234
240
|
...
|
|
235
241
|
|
|
236
242
|
@typing.overload
|
|
237
|
-
def
|
|
238
|
-
...
|
|
239
|
-
|
|
240
|
-
@typing.overload
|
|
241
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
243
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
242
244
|
...
|
|
243
245
|
|
|
244
|
-
def
|
|
246
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
245
247
|
"""
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
The decorator will create an optional artifact, specified by `var`, which
|
|
249
|
-
contains the exception raised. You can use it to detect the presence
|
|
250
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
|
251
|
-
are missing.
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
Parameters
|
|
255
|
-
----------
|
|
256
|
-
var : str, optional, default None
|
|
257
|
-
Name of the artifact in which to store the caught exception.
|
|
258
|
-
If not specified, the exception is not stored.
|
|
259
|
-
print_exception : bool, default True
|
|
260
|
-
Determines whether or not the exception is printed to
|
|
261
|
-
stdout when caught.
|
|
248
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
249
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
262
250
|
"""
|
|
263
251
|
...
|
|
264
252
|
|
|
265
253
|
@typing.overload
|
|
266
|
-
def
|
|
254
|
+
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]]]:
|
|
267
255
|
"""
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
This decorator is useful if this step may hang indefinitely.
|
|
271
|
-
|
|
272
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
273
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
274
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
256
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
275
257
|
|
|
276
|
-
Note that
|
|
277
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
258
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
278
259
|
|
|
279
260
|
|
|
280
261
|
Parameters
|
|
281
262
|
----------
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
263
|
+
type : str, default 'default'
|
|
264
|
+
Card type.
|
|
265
|
+
id : str, optional, default None
|
|
266
|
+
If multiple cards are present, use this id to identify this card.
|
|
267
|
+
options : Dict[str, Any], default {}
|
|
268
|
+
Options passed to the card. The contents depend on the card type.
|
|
269
|
+
timeout : int, default 45
|
|
270
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
288
271
|
"""
|
|
289
272
|
...
|
|
290
273
|
|
|
291
274
|
@typing.overload
|
|
292
|
-
def
|
|
275
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
293
276
|
...
|
|
294
277
|
|
|
295
278
|
@typing.overload
|
|
296
|
-
def
|
|
279
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
297
280
|
...
|
|
298
281
|
|
|
299
|
-
def
|
|
282
|
+
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):
|
|
300
283
|
"""
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
This decorator is useful if this step may hang indefinitely.
|
|
304
|
-
|
|
305
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
306
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
307
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
284
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
308
285
|
|
|
309
|
-
Note that
|
|
310
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
286
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
311
287
|
|
|
312
288
|
|
|
313
289
|
Parameters
|
|
314
290
|
----------
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
291
|
+
type : str, default 'default'
|
|
292
|
+
Card type.
|
|
293
|
+
id : str, optional, default None
|
|
294
|
+
If multiple cards are present, use this id to identify this card.
|
|
295
|
+
options : Dict[str, Any], default {}
|
|
296
|
+
Options passed to the card. The contents depend on the card type.
|
|
297
|
+
timeout : int, default 45
|
|
298
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
321
299
|
"""
|
|
322
300
|
...
|
|
323
301
|
|
|
@@ -373,283 +351,9 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
|
373
351
|
...
|
|
374
352
|
|
|
375
353
|
@typing.overload
|
|
376
|
-
def
|
|
377
|
-
"""
|
|
378
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
379
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
380
|
-
"""
|
|
381
|
-
...
|
|
382
|
-
|
|
383
|
-
@typing.overload
|
|
384
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
385
|
-
...
|
|
386
|
-
|
|
387
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
388
|
-
"""
|
|
389
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
390
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
391
|
-
"""
|
|
392
|
-
...
|
|
393
|
-
|
|
394
|
-
@typing.overload
|
|
395
|
-
def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
396
|
-
"""
|
|
397
|
-
Specifies environment variables to be set prior to the execution of a step.
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
Parameters
|
|
401
|
-
----------
|
|
402
|
-
vars : Dict[str, str], default {}
|
|
403
|
-
Dictionary of environment variables to set.
|
|
404
|
-
"""
|
|
405
|
-
...
|
|
406
|
-
|
|
407
|
-
@typing.overload
|
|
408
|
-
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
409
|
-
...
|
|
410
|
-
|
|
411
|
-
@typing.overload
|
|
412
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
413
|
-
...
|
|
414
|
-
|
|
415
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
416
|
-
"""
|
|
417
|
-
Specifies environment variables to be set prior to the execution of a step.
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
Parameters
|
|
421
|
-
----------
|
|
422
|
-
vars : Dict[str, str], default {}
|
|
423
|
-
Dictionary of environment variables to set.
|
|
424
|
-
"""
|
|
425
|
-
...
|
|
426
|
-
|
|
427
|
-
@typing.overload
|
|
428
|
-
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]]]:
|
|
354
|
+
def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = 'METAFLOW_BATCH_JOB_QUEUE', iam_role: str = 'METAFLOW_ECS_S3_ACCESS_IAM_ROLE', execution_role: str = 'METAFLOW_ECS_FARGATE_EXECUTION_ROLE', shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
429
355
|
"""
|
|
430
|
-
Specifies
|
|
431
|
-
the execution of a step.
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
Parameters
|
|
435
|
-
----------
|
|
436
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
437
|
-
List of secret specs, defining how the secrets are to be retrieved
|
|
438
|
-
role : str, optional, default: None
|
|
439
|
-
Role to use for fetching secrets
|
|
440
|
-
"""
|
|
441
|
-
...
|
|
442
|
-
|
|
443
|
-
@typing.overload
|
|
444
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
445
|
-
...
|
|
446
|
-
|
|
447
|
-
@typing.overload
|
|
448
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
449
|
-
...
|
|
450
|
-
|
|
451
|
-
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):
|
|
452
|
-
"""
|
|
453
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
454
|
-
the execution of a step.
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
Parameters
|
|
458
|
-
----------
|
|
459
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
460
|
-
List of secret specs, defining how the secrets are to be retrieved
|
|
461
|
-
role : str, optional, default: None
|
|
462
|
-
Role to use for fetching secrets
|
|
463
|
-
"""
|
|
464
|
-
...
|
|
465
|
-
|
|
466
|
-
@typing.overload
|
|
467
|
-
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
468
|
-
"""
|
|
469
|
-
Specifies the resources needed when executing this step.
|
|
470
|
-
|
|
471
|
-
Use `@resources` to specify the resource requirements
|
|
472
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
473
|
-
|
|
474
|
-
You can choose the compute layer on the command line by executing e.g.
|
|
475
|
-
```
|
|
476
|
-
python myflow.py run --with batch
|
|
477
|
-
```
|
|
478
|
-
or
|
|
479
|
-
```
|
|
480
|
-
python myflow.py run --with kubernetes
|
|
481
|
-
```
|
|
482
|
-
which executes the flow on the desired system using the
|
|
483
|
-
requirements specified in `@resources`.
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
Parameters
|
|
487
|
-
----------
|
|
488
|
-
cpu : int, default 1
|
|
489
|
-
Number of CPUs required for this step.
|
|
490
|
-
gpu : int, optional, default None
|
|
491
|
-
Number of GPUs required for this step.
|
|
492
|
-
disk : int, optional, default None
|
|
493
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
494
|
-
memory : int, default 4096
|
|
495
|
-
Memory size (in MB) required for this step.
|
|
496
|
-
shared_memory : int, optional, default None
|
|
497
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
498
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
499
|
-
"""
|
|
500
|
-
...
|
|
501
|
-
|
|
502
|
-
@typing.overload
|
|
503
|
-
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
504
|
-
...
|
|
505
|
-
|
|
506
|
-
@typing.overload
|
|
507
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
508
|
-
...
|
|
509
|
-
|
|
510
|
-
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
|
511
|
-
"""
|
|
512
|
-
Specifies the resources needed when executing this step.
|
|
513
|
-
|
|
514
|
-
Use `@resources` to specify the resource requirements
|
|
515
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
516
|
-
|
|
517
|
-
You can choose the compute layer on the command line by executing e.g.
|
|
518
|
-
```
|
|
519
|
-
python myflow.py run --with batch
|
|
520
|
-
```
|
|
521
|
-
or
|
|
522
|
-
```
|
|
523
|
-
python myflow.py run --with kubernetes
|
|
524
|
-
```
|
|
525
|
-
which executes the flow on the desired system using the
|
|
526
|
-
requirements specified in `@resources`.
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
Parameters
|
|
530
|
-
----------
|
|
531
|
-
cpu : int, default 1
|
|
532
|
-
Number of CPUs required for this step.
|
|
533
|
-
gpu : int, optional, default None
|
|
534
|
-
Number of GPUs required for this step.
|
|
535
|
-
disk : int, optional, default None
|
|
536
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
537
|
-
memory : int, default 4096
|
|
538
|
-
Memory size (in MB) required for this step.
|
|
539
|
-
shared_memory : int, optional, default None
|
|
540
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
541
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
542
|
-
"""
|
|
543
|
-
...
|
|
544
|
-
|
|
545
|
-
@typing.overload
|
|
546
|
-
def card(*, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
547
|
-
"""
|
|
548
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
549
|
-
|
|
550
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
Parameters
|
|
554
|
-
----------
|
|
555
|
-
type : str, default 'default'
|
|
556
|
-
Card type.
|
|
557
|
-
id : str, optional, default None
|
|
558
|
-
If multiple cards are present, use this id to identify this card.
|
|
559
|
-
options : Dict[str, Any], default {}
|
|
560
|
-
Options passed to the card. The contents depend on the card type.
|
|
561
|
-
timeout : int, default 45
|
|
562
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
563
|
-
"""
|
|
564
|
-
...
|
|
565
|
-
|
|
566
|
-
@typing.overload
|
|
567
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
568
|
-
...
|
|
569
|
-
|
|
570
|
-
@typing.overload
|
|
571
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
572
|
-
...
|
|
573
|
-
|
|
574
|
-
def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
|
|
575
|
-
"""
|
|
576
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
577
|
-
|
|
578
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
Parameters
|
|
582
|
-
----------
|
|
583
|
-
type : str, default 'default'
|
|
584
|
-
Card type.
|
|
585
|
-
id : str, optional, default None
|
|
586
|
-
If multiple cards are present, use this id to identify this card.
|
|
587
|
-
options : Dict[str, Any], default {}
|
|
588
|
-
Options passed to the card. The contents depend on the card type.
|
|
589
|
-
timeout : int, default 45
|
|
590
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
591
|
-
"""
|
|
592
|
-
...
|
|
593
|
-
|
|
594
|
-
@typing.overload
|
|
595
|
-
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]]]:
|
|
596
|
-
"""
|
|
597
|
-
Specifies the number of times the task corresponding
|
|
598
|
-
to a step needs to be retried.
|
|
599
|
-
|
|
600
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
601
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
602
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
603
|
-
|
|
604
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
605
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
|
606
|
-
ensuring that the flow execution can continue.
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
Parameters
|
|
610
|
-
----------
|
|
611
|
-
times : int, default 3
|
|
612
|
-
Number of times to retry this task.
|
|
613
|
-
minutes_between_retries : int, default 2
|
|
614
|
-
Number of minutes between retries.
|
|
615
|
-
"""
|
|
616
|
-
...
|
|
617
|
-
|
|
618
|
-
@typing.overload
|
|
619
|
-
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
620
|
-
...
|
|
621
|
-
|
|
622
|
-
@typing.overload
|
|
623
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
624
|
-
...
|
|
625
|
-
|
|
626
|
-
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):
|
|
627
|
-
"""
|
|
628
|
-
Specifies the number of times the task corresponding
|
|
629
|
-
to a step needs to be retried.
|
|
630
|
-
|
|
631
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
632
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
633
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
634
|
-
|
|
635
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
636
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
|
637
|
-
ensuring that the flow execution can continue.
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
Parameters
|
|
641
|
-
----------
|
|
642
|
-
times : int, default 3
|
|
643
|
-
Number of times to retry this task.
|
|
644
|
-
minutes_between_retries : int, default 2
|
|
645
|
-
Number of minutes between retries.
|
|
646
|
-
"""
|
|
647
|
-
...
|
|
648
|
-
|
|
649
|
-
@typing.overload
|
|
650
|
-
def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = 'METAFLOW_BATCH_JOB_QUEUE', iam_role: str = 'METAFLOW_ECS_S3_ACCESS_IAM_ROLE', execution_role: str = 'METAFLOW_ECS_FARGATE_EXECUTION_ROLE', shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
651
|
-
"""
|
|
652
|
-
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
356
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
653
357
|
|
|
654
358
|
|
|
655
359
|
Parameters
|
|
@@ -795,168 +499,388 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
795
499
|
"""
|
|
796
500
|
...
|
|
797
501
|
|
|
502
|
+
@typing.overload
|
|
503
|
+
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]]]:
|
|
504
|
+
"""
|
|
505
|
+
Specifies the number of times the task corresponding
|
|
506
|
+
to a step needs to be retried.
|
|
507
|
+
|
|
508
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
509
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
510
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
511
|
+
|
|
512
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
513
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
514
|
+
ensuring that the flow execution can continue.
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
Parameters
|
|
518
|
+
----------
|
|
519
|
+
times : int, default 3
|
|
520
|
+
Number of times to retry this task.
|
|
521
|
+
minutes_between_retries : int, default 2
|
|
522
|
+
Number of minutes between retries.
|
|
523
|
+
"""
|
|
524
|
+
...
|
|
525
|
+
|
|
526
|
+
@typing.overload
|
|
527
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
528
|
+
...
|
|
529
|
+
|
|
530
|
+
@typing.overload
|
|
531
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
532
|
+
...
|
|
533
|
+
|
|
534
|
+
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):
|
|
535
|
+
"""
|
|
536
|
+
Specifies the number of times the task corresponding
|
|
537
|
+
to a step needs to be retried.
|
|
538
|
+
|
|
539
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
540
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
541
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
542
|
+
|
|
543
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
544
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
545
|
+
ensuring that the flow execution can continue.
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
Parameters
|
|
549
|
+
----------
|
|
550
|
+
times : int, default 3
|
|
551
|
+
Number of times to retry this task.
|
|
552
|
+
minutes_between_retries : int, default 2
|
|
553
|
+
Number of minutes between retries.
|
|
554
|
+
"""
|
|
555
|
+
...
|
|
556
|
+
|
|
557
|
+
@typing.overload
|
|
558
|
+
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]]]:
|
|
559
|
+
"""
|
|
560
|
+
Specifies that the step will success under all circumstances.
|
|
561
|
+
|
|
562
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
563
|
+
contains the exception raised. You can use it to detect the presence
|
|
564
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
565
|
+
are missing.
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
Parameters
|
|
569
|
+
----------
|
|
570
|
+
var : str, optional, default None
|
|
571
|
+
Name of the artifact in which to store the caught exception.
|
|
572
|
+
If not specified, the exception is not stored.
|
|
573
|
+
print_exception : bool, default True
|
|
574
|
+
Determines whether or not the exception is printed to
|
|
575
|
+
stdout when caught.
|
|
576
|
+
"""
|
|
577
|
+
...
|
|
578
|
+
|
|
579
|
+
@typing.overload
|
|
580
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
581
|
+
...
|
|
582
|
+
|
|
583
|
+
@typing.overload
|
|
584
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
585
|
+
...
|
|
586
|
+
|
|
587
|
+
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
|
588
|
+
"""
|
|
589
|
+
Specifies that the step will success under all circumstances.
|
|
590
|
+
|
|
591
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
592
|
+
contains the exception raised. You can use it to detect the presence
|
|
593
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
594
|
+
are missing.
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
Parameters
|
|
598
|
+
----------
|
|
599
|
+
var : str, optional, default None
|
|
600
|
+
Name of the artifact in which to store the caught exception.
|
|
601
|
+
If not specified, the exception is not stored.
|
|
602
|
+
print_exception : bool, default True
|
|
603
|
+
Determines whether or not the exception is printed to
|
|
604
|
+
stdout when caught.
|
|
605
|
+
"""
|
|
606
|
+
...
|
|
607
|
+
|
|
798
608
|
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
799
609
|
"""
|
|
800
|
-
Specifies that this step should execute on Kubernetes.
|
|
610
|
+
Specifies that this step should execute on Kubernetes.
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
Parameters
|
|
614
|
+
----------
|
|
615
|
+
cpu : int, default 1
|
|
616
|
+
Number of CPUs required for this step. If `@resources` is
|
|
617
|
+
also present, the maximum value from all decorators is used.
|
|
618
|
+
memory : int, default 4096
|
|
619
|
+
Memory size (in MB) required for this step. If
|
|
620
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
621
|
+
used.
|
|
622
|
+
disk : int, default 10240
|
|
623
|
+
Disk size (in MB) required for this step. If
|
|
624
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
625
|
+
used.
|
|
626
|
+
image : str, optional, default None
|
|
627
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
|
628
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
|
629
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
630
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
|
631
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
|
632
|
+
image_pull_secrets: List[str], default []
|
|
633
|
+
The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
|
|
634
|
+
Kubernetes image pull secrets to use when pulling container images
|
|
635
|
+
in Kubernetes.
|
|
636
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
|
637
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
|
638
|
+
secrets : List[str], optional, default None
|
|
639
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
|
640
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
|
641
|
+
in Metaflow configuration.
|
|
642
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
|
643
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
|
644
|
+
Can be passed in as a comma separated string of values e.g.
|
|
645
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
|
646
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
|
647
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
|
648
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
|
649
|
+
gpu : int, optional, default None
|
|
650
|
+
Number of GPUs required for this step. A value of zero implies that
|
|
651
|
+
the scheduled node should not have GPUs.
|
|
652
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
|
653
|
+
The vendor of the GPUs to be used for this step.
|
|
654
|
+
tolerations : List[str], default []
|
|
655
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
656
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
657
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
658
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
|
659
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
660
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
661
|
+
use_tmpfs : bool, default False
|
|
662
|
+
This enables an explicit tmpfs mount for this step.
|
|
663
|
+
tmpfs_tempdir : bool, default True
|
|
664
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
665
|
+
tmpfs_size : int, optional, default: None
|
|
666
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
667
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
668
|
+
memory allocated for this step.
|
|
669
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
|
670
|
+
Path to tmpfs mount for this step.
|
|
671
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
|
672
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
673
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
674
|
+
shared_memory: int, optional
|
|
675
|
+
Shared memory size (in MiB) required for this step
|
|
676
|
+
port: int, optional
|
|
677
|
+
Port number to specify in the Kubernetes job object
|
|
678
|
+
compute_pool : str, optional, default None
|
|
679
|
+
Compute pool to be used for for this step.
|
|
680
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
|
681
|
+
hostname_resolution_timeout: int, default 10 * 60
|
|
682
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
683
|
+
Only applicable when @parallel is used.
|
|
684
|
+
qos: str, default: Burstable
|
|
685
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
686
|
+
|
|
687
|
+
security_context: Dict[str, Any], optional, default None
|
|
688
|
+
Container security context. Applies to the task container. Allows the following keys:
|
|
689
|
+
- privileged: bool, optional, default None
|
|
690
|
+
- allow_privilege_escalation: bool, optional, default None
|
|
691
|
+
- run_as_user: int, optional, default None
|
|
692
|
+
- run_as_group: int, optional, default None
|
|
693
|
+
- run_as_non_root: bool, optional, default None
|
|
694
|
+
"""
|
|
695
|
+
...
|
|
696
|
+
|
|
697
|
+
@typing.overload
|
|
698
|
+
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]]]:
|
|
699
|
+
"""
|
|
700
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
701
|
+
the execution of a step.
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
Parameters
|
|
705
|
+
----------
|
|
706
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
707
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
708
|
+
role : str, optional, default: None
|
|
709
|
+
Role to use for fetching secrets
|
|
710
|
+
"""
|
|
711
|
+
...
|
|
712
|
+
|
|
713
|
+
@typing.overload
|
|
714
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
715
|
+
...
|
|
716
|
+
|
|
717
|
+
@typing.overload
|
|
718
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
719
|
+
...
|
|
720
|
+
|
|
721
|
+
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):
|
|
722
|
+
"""
|
|
723
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
724
|
+
the execution of a step.
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
Parameters
|
|
728
|
+
----------
|
|
729
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
730
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
731
|
+
role : str, optional, default: None
|
|
732
|
+
Role to use for fetching secrets
|
|
733
|
+
"""
|
|
734
|
+
...
|
|
735
|
+
|
|
736
|
+
@typing.overload
|
|
737
|
+
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]]]:
|
|
738
|
+
"""
|
|
739
|
+
Specifies the Conda environment for the step.
|
|
740
|
+
|
|
741
|
+
Information in this decorator will augment any
|
|
742
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
743
|
+
you can use `@conda_base` to set packages required by all
|
|
744
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
Parameters
|
|
748
|
+
----------
|
|
749
|
+
packages : Dict[str, str], default {}
|
|
750
|
+
Packages to use for this step. The key is the name of the package
|
|
751
|
+
and the value is the version to use.
|
|
752
|
+
libraries : Dict[str, str], default {}
|
|
753
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
754
|
+
python : str, optional, default None
|
|
755
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
756
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
757
|
+
disabled : bool, default False
|
|
758
|
+
If set to True, disables @conda.
|
|
759
|
+
"""
|
|
760
|
+
...
|
|
761
|
+
|
|
762
|
+
@typing.overload
|
|
763
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
764
|
+
...
|
|
765
|
+
|
|
766
|
+
@typing.overload
|
|
767
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
768
|
+
...
|
|
769
|
+
|
|
770
|
+
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):
|
|
771
|
+
"""
|
|
772
|
+
Specifies the Conda environment for the step.
|
|
773
|
+
|
|
774
|
+
Information in this decorator will augment any
|
|
775
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
776
|
+
you can use `@conda_base` to set packages required by all
|
|
777
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
778
|
+
|
|
779
|
+
|
|
780
|
+
Parameters
|
|
781
|
+
----------
|
|
782
|
+
packages : Dict[str, str], default {}
|
|
783
|
+
Packages to use for this step. The key is the name of the package
|
|
784
|
+
and the value is the version to use.
|
|
785
|
+
libraries : Dict[str, str], default {}
|
|
786
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
787
|
+
python : str, optional, default None
|
|
788
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
789
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
790
|
+
disabled : bool, default False
|
|
791
|
+
If set to True, disables @conda.
|
|
792
|
+
"""
|
|
793
|
+
...
|
|
794
|
+
|
|
795
|
+
@typing.overload
|
|
796
|
+
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]]]:
|
|
797
|
+
"""
|
|
798
|
+
Specifies a timeout for your step.
|
|
799
|
+
|
|
800
|
+
This decorator is useful if this step may hang indefinitely.
|
|
801
|
+
|
|
802
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
803
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
804
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
805
|
+
|
|
806
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
807
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
801
808
|
|
|
802
809
|
|
|
803
810
|
Parameters
|
|
804
811
|
----------
|
|
805
|
-
|
|
806
|
-
Number of
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
used.
|
|
812
|
-
disk : int, default 10240
|
|
813
|
-
Disk size (in MB) required for this step. If
|
|
814
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
815
|
-
used.
|
|
816
|
-
image : str, optional, default None
|
|
817
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
|
818
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
|
819
|
-
not, a default Docker image mapping to the current version of Python is used.
|
|
820
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
|
821
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
|
822
|
-
image_pull_secrets: List[str], default []
|
|
823
|
-
The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
|
|
824
|
-
Kubernetes image pull secrets to use when pulling container images
|
|
825
|
-
in Kubernetes.
|
|
826
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
|
827
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
|
828
|
-
secrets : List[str], optional, default None
|
|
829
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
|
830
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
|
831
|
-
in Metaflow configuration.
|
|
832
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
|
833
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
|
834
|
-
Can be passed in as a comma separated string of values e.g.
|
|
835
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
|
836
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
|
837
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
|
838
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
|
839
|
-
gpu : int, optional, default None
|
|
840
|
-
Number of GPUs required for this step. A value of zero implies that
|
|
841
|
-
the scheduled node should not have GPUs.
|
|
842
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
|
843
|
-
The vendor of the GPUs to be used for this step.
|
|
844
|
-
tolerations : List[str], default []
|
|
845
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
846
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
847
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
848
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
|
849
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
850
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
851
|
-
use_tmpfs : bool, default False
|
|
852
|
-
This enables an explicit tmpfs mount for this step.
|
|
853
|
-
tmpfs_tempdir : bool, default True
|
|
854
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
855
|
-
tmpfs_size : int, optional, default: None
|
|
856
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
857
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
858
|
-
memory allocated for this step.
|
|
859
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
|
860
|
-
Path to tmpfs mount for this step.
|
|
861
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
|
862
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
863
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
864
|
-
shared_memory: int, optional
|
|
865
|
-
Shared memory size (in MiB) required for this step
|
|
866
|
-
port: int, optional
|
|
867
|
-
Port number to specify in the Kubernetes job object
|
|
868
|
-
compute_pool : str, optional, default None
|
|
869
|
-
Compute pool to be used for for this step.
|
|
870
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
|
871
|
-
hostname_resolution_timeout: int, default 10 * 60
|
|
872
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
873
|
-
Only applicable when @parallel is used.
|
|
874
|
-
qos: str, default: Burstable
|
|
875
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
876
|
-
|
|
877
|
-
security_context: Dict[str, Any], optional, default None
|
|
878
|
-
Container security context. Applies to the task container. Allows the following keys:
|
|
879
|
-
- privileged: bool, optional, default None
|
|
880
|
-
- allow_privilege_escalation: bool, optional, default None
|
|
881
|
-
- run_as_user: int, optional, default None
|
|
882
|
-
- run_as_group: int, optional, default None
|
|
883
|
-
- run_as_non_root: bool, optional, default None
|
|
812
|
+
seconds : int, default 0
|
|
813
|
+
Number of seconds to wait prior to timing out.
|
|
814
|
+
minutes : int, default 0
|
|
815
|
+
Number of minutes to wait prior to timing out.
|
|
816
|
+
hours : int, default 0
|
|
817
|
+
Number of hours to wait prior to timing out.
|
|
884
818
|
"""
|
|
885
819
|
...
|
|
886
820
|
|
|
887
|
-
|
|
821
|
+
@typing.overload
|
|
822
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
823
|
+
...
|
|
824
|
+
|
|
825
|
+
@typing.overload
|
|
826
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
827
|
+
...
|
|
828
|
+
|
|
829
|
+
def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
|
888
830
|
"""
|
|
889
|
-
Specifies
|
|
831
|
+
Specifies a timeout for your step.
|
|
890
832
|
|
|
891
|
-
|
|
892
|
-
use the same `@project(name)`.
|
|
833
|
+
This decorator is useful if this step may hang indefinitely.
|
|
893
834
|
|
|
835
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
836
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
837
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
894
838
|
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
name : str
|
|
898
|
-
Project name. Make sure that the name is unique amongst all
|
|
899
|
-
projects that use the same production scheduler. The name may
|
|
900
|
-
contain only lowercase alphanumeric characters and underscores.
|
|
839
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
840
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
901
841
|
|
|
902
|
-
branch : Optional[str], default None
|
|
903
|
-
The branch to use. If not specified, the branch is set to
|
|
904
|
-
`user.<username>` unless `production` is set to `True`. This can
|
|
905
|
-
also be set on the command line using `--branch` as a top-level option.
|
|
906
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
|
907
842
|
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
- if `branch` is not specified:
|
|
917
|
-
- if `production` is True: `prod`
|
|
918
|
-
- if `production` is False: `user.<username>`
|
|
843
|
+
Parameters
|
|
844
|
+
----------
|
|
845
|
+
seconds : int, default 0
|
|
846
|
+
Number of seconds to wait prior to timing out.
|
|
847
|
+
minutes : int, default 0
|
|
848
|
+
Number of minutes to wait prior to timing out.
|
|
849
|
+
hours : int, default 0
|
|
850
|
+
Number of hours to wait prior to timing out.
|
|
919
851
|
"""
|
|
920
852
|
...
|
|
921
853
|
|
|
922
854
|
@typing.overload
|
|
923
|
-
def
|
|
855
|
+
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]]]:
|
|
924
856
|
"""
|
|
925
|
-
Specifies
|
|
857
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
926
858
|
|
|
927
|
-
Use `@pypi_base` to set common packages required by all
|
|
928
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
929
859
|
|
|
930
860
|
Parameters
|
|
931
861
|
----------
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
and the value is the version to use.
|
|
935
|
-
python : str, optional, default: None
|
|
936
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
937
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
862
|
+
vars : Dict[str, str], default {}
|
|
863
|
+
Dictionary of environment variables to set.
|
|
938
864
|
"""
|
|
939
865
|
...
|
|
940
866
|
|
|
941
867
|
@typing.overload
|
|
942
|
-
def
|
|
868
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
943
869
|
...
|
|
944
870
|
|
|
945
|
-
|
|
871
|
+
@typing.overload
|
|
872
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
873
|
+
...
|
|
874
|
+
|
|
875
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
946
876
|
"""
|
|
947
|
-
Specifies
|
|
877
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
948
878
|
|
|
949
|
-
Use `@pypi_base` to set common packages required by all
|
|
950
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
951
879
|
|
|
952
880
|
Parameters
|
|
953
881
|
----------
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
and the value is the version to use.
|
|
957
|
-
python : str, optional, default: None
|
|
958
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
959
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
882
|
+
vars : Dict[str, str], default {}
|
|
883
|
+
Dictionary of environment variables to set.
|
|
960
884
|
"""
|
|
961
885
|
...
|
|
962
886
|
|
|
@@ -1155,6 +1079,41 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
|
1155
1079
|
"""
|
|
1156
1080
|
...
|
|
1157
1081
|
|
|
1082
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1083
|
+
"""
|
|
1084
|
+
Specifies what flows belong to the same project.
|
|
1085
|
+
|
|
1086
|
+
A project-specific namespace is created for all flows that
|
|
1087
|
+
use the same `@project(name)`.
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
Parameters
|
|
1091
|
+
----------
|
|
1092
|
+
name : str
|
|
1093
|
+
Project name. Make sure that the name is unique amongst all
|
|
1094
|
+
projects that use the same production scheduler. The name may
|
|
1095
|
+
contain only lowercase alphanumeric characters and underscores.
|
|
1096
|
+
|
|
1097
|
+
branch : Optional[str], default None
|
|
1098
|
+
The branch to use. If not specified, the branch is set to
|
|
1099
|
+
`user.<username>` unless `production` is set to `True`. This can
|
|
1100
|
+
also be set on the command line using `--branch` as a top-level option.
|
|
1101
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
|
1102
|
+
|
|
1103
|
+
production : bool, default False
|
|
1104
|
+
Whether or not the branch is the production branch. This can also be set on the
|
|
1105
|
+
command line using `--production` as a top-level option. It is an error to specify
|
|
1106
|
+
`production` in the decorator and on the command line.
|
|
1107
|
+
The project branch name will be:
|
|
1108
|
+
- if `branch` is specified:
|
|
1109
|
+
- if `production` is True: `prod.<branch>`
|
|
1110
|
+
- if `production` is False: `test.<branch>`
|
|
1111
|
+
- if `branch` is not specified:
|
|
1112
|
+
- if `production` is True: `prod`
|
|
1113
|
+
- if `production` is False: `user.<username>`
|
|
1114
|
+
"""
|
|
1115
|
+
...
|
|
1116
|
+
|
|
1158
1117
|
@typing.overload
|
|
1159
1118
|
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]]:
|
|
1160
1119
|
"""
|
|
@@ -1248,6 +1207,47 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
|
1248
1207
|
"""
|
|
1249
1208
|
...
|
|
1250
1209
|
|
|
1210
|
+
@typing.overload
|
|
1211
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1212
|
+
"""
|
|
1213
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1214
|
+
|
|
1215
|
+
Use `@pypi_base` to set common packages required by all
|
|
1216
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1217
|
+
|
|
1218
|
+
Parameters
|
|
1219
|
+
----------
|
|
1220
|
+
packages : Dict[str, str], default: {}
|
|
1221
|
+
Packages to use for this flow. The key is the name of the package
|
|
1222
|
+
and the value is the version to use.
|
|
1223
|
+
python : str, optional, default: None
|
|
1224
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1225
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1226
|
+
"""
|
|
1227
|
+
...
|
|
1228
|
+
|
|
1229
|
+
@typing.overload
|
|
1230
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1231
|
+
...
|
|
1232
|
+
|
|
1233
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
1234
|
+
"""
|
|
1235
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1236
|
+
|
|
1237
|
+
Use `@pypi_base` to set common packages required by all
|
|
1238
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1239
|
+
|
|
1240
|
+
Parameters
|
|
1241
|
+
----------
|
|
1242
|
+
packages : Dict[str, str], default: {}
|
|
1243
|
+
Packages to use for this flow. The key is the name of the package
|
|
1244
|
+
and the value is the version to use.
|
|
1245
|
+
python : str, optional, default: None
|
|
1246
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1247
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1248
|
+
"""
|
|
1249
|
+
...
|
|
1250
|
+
|
|
1251
1251
|
@typing.overload
|
|
1252
1252
|
def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1253
1253
|
"""
|