metaflow-stubs 2.18.7__py2.py3-none-any.whl → 2.18.8__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 +611 -611
- 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 +4 -4
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/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 +2 -2
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +34 -34
- 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 +4 -4
- 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 +2 -2
- metaflow-stubs/parameters.pyi +4 -4
- metaflow-stubs/plugins/__init__.pyi +15 -15
- 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 +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/argo/exit_hooks.pyi +2 -2
- 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 +3 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/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 +3 -3
- 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 +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_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 +2 -2
- 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 +84 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +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 +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_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 +2 -2
- 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 +2 -2
- 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 +5 -5
- metaflow-stubs/runner/deployer_impl.pyi +3 -3
- 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 +4 -4
- 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 +5 -5
- metaflow-stubs/user_decorators/mutable_step.pyi +5 -5
- metaflow-stubs/user_decorators/user_flow_decorator.pyi +3 -3
- 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.8.dist-info}/METADATA +2 -2
- metaflow_stubs-2.18.8.dist-info/RECORD +166 -0
- metaflow_stubs-2.18.7.dist-info/RECORD +0 -166
- {metaflow_stubs-2.18.7.dist-info → metaflow_stubs-2.18.8.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.18.7.dist-info → metaflow_stubs-2.18.8.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.8 #
|
|
4
|
+
# Generated on 2025-09-22T21:43:14.168437 #
|
|
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,17 @@ 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 events as events
|
|
43
|
-
from . import metaflow_git as metaflow_git
|
|
44
42
|
from . import tuple_util as tuple_util
|
|
43
|
+
from . import metaflow_git as metaflow_git
|
|
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 requirements_txt_parser as requirements_txt_parser
|
|
51
|
-
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
52
50
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
|
51
|
+
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
52
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_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,112 +153,57 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
|
153
153
|
...
|
|
154
154
|
|
|
155
155
|
@typing.overload
|
|
156
|
-
def
|
|
156
|
+
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]]]:
|
|
157
157
|
"""
|
|
158
|
-
Specifies
|
|
159
|
-
|
|
160
|
-
This decorator is useful if this step may hang indefinitely.
|
|
158
|
+
Specifies the number of times the task corresponding
|
|
159
|
+
to a step needs to be retried.
|
|
161
160
|
|
|
162
|
-
This
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
162
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
163
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
165
164
|
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
166
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
167
|
+
ensuring that the flow execution can continue.
|
|
168
168
|
|
|
169
169
|
|
|
170
170
|
Parameters
|
|
171
171
|
----------
|
|
172
|
-
|
|
173
|
-
Number of
|
|
174
|
-
|
|
175
|
-
Number of minutes
|
|
176
|
-
hours : int, default 0
|
|
177
|
-
Number of hours to wait prior to timing out.
|
|
172
|
+
times : int, default 3
|
|
173
|
+
Number of times to retry this task.
|
|
174
|
+
minutes_between_retries : int, default 2
|
|
175
|
+
Number of minutes between retries.
|
|
178
176
|
"""
|
|
179
177
|
...
|
|
180
178
|
|
|
181
179
|
@typing.overload
|
|
182
|
-
def
|
|
180
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
183
181
|
...
|
|
184
182
|
|
|
185
183
|
@typing.overload
|
|
186
|
-
def
|
|
187
|
-
...
|
|
188
|
-
|
|
189
|
-
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):
|
|
190
|
-
"""
|
|
191
|
-
Specifies a timeout for your step.
|
|
192
|
-
|
|
193
|
-
This decorator is useful if this step may hang indefinitely.
|
|
194
|
-
|
|
195
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
196
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
197
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
198
|
-
|
|
199
|
-
Note that all the values specified in parameters are added together so if you specify
|
|
200
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
Parameters
|
|
204
|
-
----------
|
|
205
|
-
seconds : int, default 0
|
|
206
|
-
Number of seconds to wait prior to timing out.
|
|
207
|
-
minutes : int, default 0
|
|
208
|
-
Number of minutes to wait prior to timing out.
|
|
209
|
-
hours : int, default 0
|
|
210
|
-
Number of hours to wait prior to timing out.
|
|
211
|
-
"""
|
|
184
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
212
185
|
...
|
|
213
186
|
|
|
214
|
-
|
|
215
|
-
def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
187
|
+
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):
|
|
216
188
|
"""
|
|
217
|
-
Specifies
|
|
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
|
-
|
|
189
|
+
Specifies the number of times the task corresponding
|
|
190
|
+
to a step needs to be retried.
|
|
224
191
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
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.
|
|
233
|
-
"""
|
|
234
|
-
...
|
|
235
|
-
|
|
236
|
-
@typing.overload
|
|
237
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
238
|
-
...
|
|
239
|
-
|
|
240
|
-
@typing.overload
|
|
241
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
242
|
-
...
|
|
243
|
-
|
|
244
|
-
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
|
245
|
-
"""
|
|
246
|
-
Specifies that the step will success under all circumstances.
|
|
192
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
193
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
194
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
247
195
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
are missing.
|
|
196
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
197
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
198
|
+
ensuring that the flow execution can continue.
|
|
252
199
|
|
|
253
200
|
|
|
254
201
|
Parameters
|
|
255
202
|
----------
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
Determines whether or not the exception is printed to
|
|
261
|
-
stdout when caught.
|
|
203
|
+
times : int, default 3
|
|
204
|
+
Number of times to retry this task.
|
|
205
|
+
minutes_between_retries : int, default 2
|
|
206
|
+
Number of minutes between retries.
|
|
262
207
|
"""
|
|
263
208
|
...
|
|
264
209
|
|
|
@@ -302,63 +247,28 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
|
302
247
|
...
|
|
303
248
|
|
|
304
249
|
@typing.overload
|
|
305
|
-
def
|
|
250
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
306
251
|
"""
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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
|
-
|
|
314
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
315
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
|
316
|
-
ensuring that the flow execution can continue.
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
Parameters
|
|
320
|
-
----------
|
|
321
|
-
times : int, default 3
|
|
322
|
-
Number of times to retry this task.
|
|
323
|
-
minutes_between_retries : int, default 2
|
|
324
|
-
Number of minutes between retries.
|
|
252
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
253
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
325
254
|
"""
|
|
326
255
|
...
|
|
327
256
|
|
|
328
257
|
@typing.overload
|
|
329
|
-
def
|
|
330
|
-
...
|
|
331
|
-
|
|
332
|
-
@typing.overload
|
|
333
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
258
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
334
259
|
...
|
|
335
260
|
|
|
336
|
-
def
|
|
261
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
337
262
|
"""
|
|
338
|
-
|
|
339
|
-
|
|
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)`.
|
|
344
|
-
|
|
345
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
346
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
|
347
|
-
ensuring that the flow execution can continue.
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
Parameters
|
|
351
|
-
----------
|
|
352
|
-
times : int, default 3
|
|
353
|
-
Number of times to retry this task.
|
|
354
|
-
minutes_between_retries : int, default 2
|
|
355
|
-
Number of minutes between retries.
|
|
263
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
264
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
356
265
|
"""
|
|
357
266
|
...
|
|
358
267
|
|
|
359
|
-
|
|
268
|
+
@typing.overload
|
|
269
|
+
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]]]:
|
|
360
270
|
"""
|
|
361
|
-
Specifies that this step should execute on
|
|
271
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
362
272
|
|
|
363
273
|
|
|
364
274
|
Parameters
|
|
@@ -366,228 +276,46 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
|
366
276
|
cpu : int, default 1
|
|
367
277
|
Number of CPUs required for this step. If `@resources` is
|
|
368
278
|
also present, the maximum value from all decorators is used.
|
|
279
|
+
gpu : int, default 0
|
|
280
|
+
Number of GPUs required for this step. If `@resources` is
|
|
281
|
+
also present, the maximum value from all decorators is used.
|
|
369
282
|
memory : int, default 4096
|
|
370
283
|
Memory size (in MB) required for this step. If
|
|
371
284
|
`@resources` is also present, the maximum value from all decorators is
|
|
372
285
|
used.
|
|
373
|
-
disk : int, default 10240
|
|
374
|
-
Disk size (in MB) required for this step. If
|
|
375
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
376
|
-
used.
|
|
377
286
|
image : str, optional, default None
|
|
378
|
-
Docker image to use when launching on
|
|
379
|
-
|
|
287
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
|
288
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
380
289
|
not, a default Docker image mapping to the current version of Python is used.
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
in
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
The vendor of the GPUs to be used for this step.
|
|
405
|
-
tolerations : List[Dict[str,str]], default []
|
|
406
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
407
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
408
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
409
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
|
410
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
411
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
290
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
291
|
+
AWS Batch Job Queue to submit the job to.
|
|
292
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
293
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
294
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
295
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
296
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
297
|
+
shared_memory : int, optional, default None
|
|
298
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
299
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
300
|
+
max_swap : int, optional, default None
|
|
301
|
+
The total amount of swap memory (in MiB) a container can use for this
|
|
302
|
+
step. This parameter is translated to the `--memory-swap` option in
|
|
303
|
+
Docker where the value is the sum of the container memory plus the
|
|
304
|
+
`max_swap` value.
|
|
305
|
+
swappiness : int, optional, default None
|
|
306
|
+
This allows you to tune memory swappiness behavior for this step.
|
|
307
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
308
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
309
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
310
|
+
aws_batch_tags: Dict[str, str], optional, default None
|
|
311
|
+
Sets arbitrary AWS tags on the AWS Batch compute environment.
|
|
312
|
+
Set as string key-value pairs.
|
|
412
313
|
use_tmpfs : bool, default False
|
|
413
|
-
This enables an explicit tmpfs mount for this step.
|
|
314
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
315
|
+
not available on Fargate compute environments
|
|
414
316
|
tmpfs_tempdir : bool, default True
|
|
415
317
|
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
416
|
-
tmpfs_size : int, optional, default
|
|
417
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
418
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
419
|
-
memory allocated for this step.
|
|
420
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
|
421
|
-
Path to tmpfs mount for this step.
|
|
422
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
|
423
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
424
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
425
|
-
shared_memory: int, optional
|
|
426
|
-
Shared memory size (in MiB) required for this step
|
|
427
|
-
port: int, optional
|
|
428
|
-
Port number to specify in the Kubernetes job object
|
|
429
|
-
compute_pool : str, optional, default None
|
|
430
|
-
Compute pool to be used for for this step.
|
|
431
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
|
432
|
-
hostname_resolution_timeout: int, default 10 * 60
|
|
433
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
434
|
-
Only applicable when @parallel is used.
|
|
435
|
-
qos: str, default: Burstable
|
|
436
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
437
|
-
|
|
438
|
-
security_context: Dict[str, Any], optional, default None
|
|
439
|
-
Container security context. Applies to the task container. Allows the following keys:
|
|
440
|
-
- privileged: bool, optional, default None
|
|
441
|
-
- allow_privilege_escalation: bool, optional, default None
|
|
442
|
-
- run_as_user: int, optional, default None
|
|
443
|
-
- run_as_group: int, optional, default None
|
|
444
|
-
- run_as_non_root: bool, optional, default None
|
|
445
|
-
"""
|
|
446
|
-
...
|
|
447
|
-
|
|
448
|
-
@typing.overload
|
|
449
|
-
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]]]:
|
|
450
|
-
"""
|
|
451
|
-
Specifies the Conda environment for the step.
|
|
452
|
-
|
|
453
|
-
Information in this decorator will augment any
|
|
454
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
455
|
-
you can use `@conda_base` to set packages required by all
|
|
456
|
-
steps and use `@conda` to specify step-specific overrides.
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
Parameters
|
|
460
|
-
----------
|
|
461
|
-
packages : Dict[str, str], default {}
|
|
462
|
-
Packages to use for this step. The key is the name of the package
|
|
463
|
-
and the value is the version to use.
|
|
464
|
-
libraries : Dict[str, str], default {}
|
|
465
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
466
|
-
python : str, optional, default None
|
|
467
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
468
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
469
|
-
disabled : bool, default False
|
|
470
|
-
If set to True, disables @conda.
|
|
471
|
-
"""
|
|
472
|
-
...
|
|
473
|
-
|
|
474
|
-
@typing.overload
|
|
475
|
-
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
476
|
-
...
|
|
477
|
-
|
|
478
|
-
@typing.overload
|
|
479
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
480
|
-
...
|
|
481
|
-
|
|
482
|
-
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):
|
|
483
|
-
"""
|
|
484
|
-
Specifies the Conda environment for the step.
|
|
485
|
-
|
|
486
|
-
Information in this decorator will augment any
|
|
487
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
488
|
-
you can use `@conda_base` to set packages required by all
|
|
489
|
-
steps and use `@conda` to specify step-specific overrides.
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
Parameters
|
|
493
|
-
----------
|
|
494
|
-
packages : Dict[str, str], default {}
|
|
495
|
-
Packages to use for this step. The key is the name of the package
|
|
496
|
-
and the value is the version to use.
|
|
497
|
-
libraries : Dict[str, str], default {}
|
|
498
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
499
|
-
python : str, optional, default None
|
|
500
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
501
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
502
|
-
disabled : bool, default False
|
|
503
|
-
If set to True, disables @conda.
|
|
504
|
-
"""
|
|
505
|
-
...
|
|
506
|
-
|
|
507
|
-
@typing.overload
|
|
508
|
-
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]]]:
|
|
509
|
-
"""
|
|
510
|
-
Specifies environment variables to be set prior to the execution of a step.
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
Parameters
|
|
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
|
|
318
|
+
tmpfs_size : int, optional, default None
|
|
591
319
|
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
592
320
|
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
593
321
|
memory allocated for this step.
|
|
@@ -693,215 +421,360 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
693
421
|
...
|
|
694
422
|
|
|
695
423
|
@typing.overload
|
|
696
|
-
def
|
|
424
|
+
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]]]:
|
|
697
425
|
"""
|
|
698
|
-
|
|
426
|
+
Specifies the Conda environment for the step.
|
|
699
427
|
|
|
700
|
-
|
|
428
|
+
Information in this decorator will augment any
|
|
429
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
430
|
+
you can use `@conda_base` to set packages required by all
|
|
431
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
701
432
|
|
|
702
433
|
|
|
703
434
|
Parameters
|
|
704
435
|
----------
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
436
|
+
packages : Dict[str, str], default {}
|
|
437
|
+
Packages to use for this step. The key is the name of the package
|
|
438
|
+
and the value is the version to use.
|
|
439
|
+
libraries : Dict[str, str], default {}
|
|
440
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
441
|
+
python : str, optional, default None
|
|
442
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
443
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
444
|
+
disabled : bool, default False
|
|
445
|
+
If set to True, disables @conda.
|
|
713
446
|
"""
|
|
714
447
|
...
|
|
715
448
|
|
|
716
449
|
@typing.overload
|
|
717
|
-
def
|
|
450
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
718
451
|
...
|
|
719
452
|
|
|
720
453
|
@typing.overload
|
|
721
|
-
def
|
|
454
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
722
455
|
...
|
|
723
456
|
|
|
724
|
-
def
|
|
457
|
+
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):
|
|
725
458
|
"""
|
|
726
|
-
|
|
459
|
+
Specifies the Conda environment for the step.
|
|
727
460
|
|
|
728
|
-
|
|
461
|
+
Information in this decorator will augment any
|
|
462
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
463
|
+
you can use `@conda_base` to set packages required by all
|
|
464
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
729
465
|
|
|
730
466
|
|
|
731
467
|
Parameters
|
|
732
468
|
----------
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
469
|
+
packages : Dict[str, str], default {}
|
|
470
|
+
Packages to use for this step. The key is the name of the package
|
|
471
|
+
and the value is the version to use.
|
|
472
|
+
libraries : Dict[str, str], default {}
|
|
473
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
474
|
+
python : str, optional, default None
|
|
475
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
476
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
477
|
+
disabled : bool, default False
|
|
478
|
+
If set to True, disables @conda.
|
|
741
479
|
"""
|
|
742
480
|
...
|
|
743
481
|
|
|
744
482
|
@typing.overload
|
|
745
|
-
def
|
|
483
|
+
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]]]:
|
|
746
484
|
"""
|
|
747
|
-
Specifies
|
|
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.
|
|
485
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
753
486
|
|
|
754
487
|
|
|
755
488
|
Parameters
|
|
756
489
|
----------
|
|
757
|
-
|
|
758
|
-
|
|
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.
|
|
490
|
+
vars : Dict[str, str], default {}
|
|
491
|
+
Dictionary of environment variables to set.
|
|
763
492
|
"""
|
|
764
493
|
...
|
|
765
494
|
|
|
766
495
|
@typing.overload
|
|
767
|
-
def
|
|
496
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
768
497
|
...
|
|
769
498
|
|
|
770
499
|
@typing.overload
|
|
771
|
-
def
|
|
500
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
772
501
|
...
|
|
773
502
|
|
|
774
|
-
def
|
|
503
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
775
504
|
"""
|
|
776
|
-
Specifies
|
|
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.
|
|
505
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
782
506
|
|
|
783
507
|
|
|
784
508
|
Parameters
|
|
785
509
|
----------
|
|
786
|
-
|
|
787
|
-
|
|
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.
|
|
510
|
+
vars : Dict[str, str], default {}
|
|
511
|
+
Dictionary of environment variables to set.
|
|
792
512
|
"""
|
|
793
513
|
...
|
|
794
514
|
|
|
795
515
|
@typing.overload
|
|
796
|
-
def
|
|
516
|
+
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
517
|
"""
|
|
798
|
-
|
|
799
|
-
|
|
518
|
+
Specifies a timeout for your step.
|
|
519
|
+
|
|
520
|
+
This decorator is useful if this step may hang indefinitely.
|
|
521
|
+
|
|
522
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
523
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
524
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
525
|
+
|
|
526
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
527
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
Parameters
|
|
531
|
+
----------
|
|
532
|
+
seconds : int, default 0
|
|
533
|
+
Number of seconds to wait prior to timing out.
|
|
534
|
+
minutes : int, default 0
|
|
535
|
+
Number of minutes to wait prior to timing out.
|
|
536
|
+
hours : int, default 0
|
|
537
|
+
Number of hours to wait prior to timing out.
|
|
800
538
|
"""
|
|
801
539
|
...
|
|
802
540
|
|
|
803
541
|
@typing.overload
|
|
804
|
-
def
|
|
542
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
805
543
|
...
|
|
806
544
|
|
|
807
|
-
|
|
545
|
+
@typing.overload
|
|
546
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
547
|
+
...
|
|
548
|
+
|
|
549
|
+
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):
|
|
808
550
|
"""
|
|
809
|
-
|
|
810
|
-
|
|
551
|
+
Specifies a timeout for your step.
|
|
552
|
+
|
|
553
|
+
This decorator is useful if this step may hang indefinitely.
|
|
554
|
+
|
|
555
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
556
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
557
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
558
|
+
|
|
559
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
560
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
Parameters
|
|
564
|
+
----------
|
|
565
|
+
seconds : int, default 0
|
|
566
|
+
Number of seconds to wait prior to timing out.
|
|
567
|
+
minutes : int, default 0
|
|
568
|
+
Number of minutes to wait prior to timing out.
|
|
569
|
+
hours : int, default 0
|
|
570
|
+
Number of hours to wait prior to timing out.
|
|
811
571
|
"""
|
|
812
572
|
...
|
|
813
573
|
|
|
814
574
|
@typing.overload
|
|
815
|
-
def
|
|
575
|
+
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]]]:
|
|
816
576
|
"""
|
|
817
|
-
Specifies the
|
|
577
|
+
Specifies that the step will success under all circumstances.
|
|
818
578
|
|
|
819
|
-
|
|
820
|
-
|
|
579
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
580
|
+
contains the exception raised. You can use it to detect the presence
|
|
581
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
582
|
+
are missing.
|
|
821
583
|
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
584
|
+
|
|
585
|
+
Parameters
|
|
586
|
+
----------
|
|
587
|
+
var : str, optional, default None
|
|
588
|
+
Name of the artifact in which to store the caught exception.
|
|
589
|
+
If not specified, the exception is not stored.
|
|
590
|
+
print_exception : bool, default True
|
|
591
|
+
Determines whether or not the exception is printed to
|
|
592
|
+
stdout when caught.
|
|
593
|
+
"""
|
|
594
|
+
...
|
|
595
|
+
|
|
596
|
+
@typing.overload
|
|
597
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
598
|
+
...
|
|
599
|
+
|
|
600
|
+
@typing.overload
|
|
601
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
602
|
+
...
|
|
603
|
+
|
|
604
|
+
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):
|
|
605
|
+
"""
|
|
606
|
+
Specifies that the step will success under all circumstances.
|
|
607
|
+
|
|
608
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
609
|
+
contains the exception raised. You can use it to detect the presence
|
|
610
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
611
|
+
are missing.
|
|
832
612
|
|
|
833
613
|
|
|
834
614
|
Parameters
|
|
835
615
|
----------
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
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.
|
|
616
|
+
var : str, optional, default None
|
|
617
|
+
Name of the artifact in which to store the caught exception.
|
|
618
|
+
If not specified, the exception is not stored.
|
|
619
|
+
print_exception : bool, default True
|
|
620
|
+
Determines whether or not the exception is printed to
|
|
621
|
+
stdout when caught.
|
|
847
622
|
"""
|
|
848
623
|
...
|
|
849
624
|
|
|
850
625
|
@typing.overload
|
|
851
|
-
def
|
|
626
|
+
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]]]:
|
|
627
|
+
"""
|
|
628
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
629
|
+
|
|
630
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
Parameters
|
|
634
|
+
----------
|
|
635
|
+
type : str, default 'default'
|
|
636
|
+
Card type.
|
|
637
|
+
id : str, optional, default None
|
|
638
|
+
If multiple cards are present, use this id to identify this card.
|
|
639
|
+
options : Dict[str, Any], default {}
|
|
640
|
+
Options passed to the card. The contents depend on the card type.
|
|
641
|
+
timeout : int, default 45
|
|
642
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
643
|
+
"""
|
|
852
644
|
...
|
|
853
645
|
|
|
854
646
|
@typing.overload
|
|
855
|
-
def
|
|
647
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
856
648
|
...
|
|
857
649
|
|
|
858
|
-
|
|
650
|
+
@typing.overload
|
|
651
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
652
|
+
...
|
|
653
|
+
|
|
654
|
+
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):
|
|
859
655
|
"""
|
|
860
|
-
|
|
656
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
861
657
|
|
|
862
|
-
|
|
863
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
658
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
864
659
|
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
660
|
+
|
|
661
|
+
Parameters
|
|
662
|
+
----------
|
|
663
|
+
type : str, default 'default'
|
|
664
|
+
Card type.
|
|
665
|
+
id : str, optional, default None
|
|
666
|
+
If multiple cards are present, use this id to identify this card.
|
|
667
|
+
options : Dict[str, Any], default {}
|
|
668
|
+
Options passed to the card. The contents depend on the card type.
|
|
669
|
+
timeout : int, default 45
|
|
670
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
671
|
+
"""
|
|
672
|
+
...
|
|
673
|
+
|
|
674
|
+
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[typing.Dict[str, 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]]]:
|
|
675
|
+
"""
|
|
676
|
+
Specifies that this step should execute on Kubernetes.
|
|
875
677
|
|
|
876
678
|
|
|
877
679
|
Parameters
|
|
878
680
|
----------
|
|
879
681
|
cpu : int, default 1
|
|
880
|
-
Number of CPUs required for this step.
|
|
881
|
-
|
|
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.
|
|
682
|
+
Number of CPUs required for this step. If `@resources` is
|
|
683
|
+
also present, the maximum value from all decorators is used.
|
|
885
684
|
memory : int, default 4096
|
|
886
|
-
Memory size (in MB) required for this step.
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
685
|
+
Memory size (in MB) required for this step. If
|
|
686
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
687
|
+
used.
|
|
688
|
+
disk : int, default 10240
|
|
689
|
+
Disk size (in MB) required for this step. If
|
|
690
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
691
|
+
used.
|
|
692
|
+
image : str, optional, default None
|
|
693
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
|
694
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
|
695
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
696
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
|
697
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
|
698
|
+
image_pull_secrets: List[str], default []
|
|
699
|
+
The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
|
|
700
|
+
Kubernetes image pull secrets to use when pulling container images
|
|
701
|
+
in Kubernetes.
|
|
702
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
|
703
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
|
704
|
+
secrets : List[str], optional, default None
|
|
705
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
|
706
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
|
707
|
+
in Metaflow configuration.
|
|
708
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
|
709
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
|
710
|
+
Can be passed in as a comma separated string of values e.g.
|
|
711
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
|
712
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
|
713
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
|
714
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
|
715
|
+
gpu : int, optional, default None
|
|
716
|
+
Number of GPUs required for this step. A value of zero implies that
|
|
717
|
+
the scheduled node should not have GPUs.
|
|
718
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
|
719
|
+
The vendor of the GPUs to be used for this step.
|
|
720
|
+
tolerations : List[Dict[str,str]], default []
|
|
721
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
722
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
723
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
724
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
|
725
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
726
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
727
|
+
use_tmpfs : bool, default False
|
|
728
|
+
This enables an explicit tmpfs mount for this step.
|
|
729
|
+
tmpfs_tempdir : bool, default True
|
|
730
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
731
|
+
tmpfs_size : int, optional, default: None
|
|
732
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
733
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
734
|
+
memory allocated for this step.
|
|
735
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
|
736
|
+
Path to tmpfs mount for this step.
|
|
737
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
|
738
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
739
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
740
|
+
shared_memory: int, optional
|
|
741
|
+
Shared memory size (in MiB) required for this step
|
|
742
|
+
port: int, optional
|
|
743
|
+
Port number to specify in the Kubernetes job object
|
|
744
|
+
compute_pool : str, optional, default None
|
|
745
|
+
Compute pool to be used for for this step.
|
|
746
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
|
747
|
+
hostname_resolution_timeout: int, default 10 * 60
|
|
748
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
749
|
+
Only applicable when @parallel is used.
|
|
750
|
+
qos: str, default: Burstable
|
|
751
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
752
|
+
|
|
753
|
+
security_context: Dict[str, Any], optional, default None
|
|
754
|
+
Container security context. Applies to the task container. Allows the following keys:
|
|
755
|
+
- privileged: bool, optional, default None
|
|
756
|
+
- allow_privilege_escalation: bool, optional, default None
|
|
757
|
+
- run_as_user: int, optional, default None
|
|
758
|
+
- run_as_group: int, optional, default None
|
|
759
|
+
- run_as_non_root: bool, optional, default None
|
|
890
760
|
"""
|
|
891
761
|
...
|
|
892
762
|
|
|
893
763
|
@typing.overload
|
|
894
|
-
def
|
|
764
|
+
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]]]:
|
|
895
765
|
"""
|
|
896
|
-
Specifies the PyPI packages for
|
|
766
|
+
Specifies the PyPI packages for the step.
|
|
897
767
|
|
|
898
|
-
|
|
768
|
+
Information in this decorator will augment any
|
|
769
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
770
|
+
you can use `@pypi_base` to set packages required by all
|
|
899
771
|
steps and use `@pypi` to specify step-specific overrides.
|
|
900
772
|
|
|
773
|
+
|
|
901
774
|
Parameters
|
|
902
775
|
----------
|
|
903
776
|
packages : Dict[str, str], default: {}
|
|
904
|
-
Packages to use for this
|
|
777
|
+
Packages to use for this step. The key is the name of the package
|
|
905
778
|
and the value is the version to use.
|
|
906
779
|
python : str, optional, default: None
|
|
907
780
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
@@ -910,20 +783,27 @@ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[s
|
|
|
910
783
|
...
|
|
911
784
|
|
|
912
785
|
@typing.overload
|
|
913
|
-
def
|
|
786
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
914
787
|
...
|
|
915
788
|
|
|
916
|
-
|
|
789
|
+
@typing.overload
|
|
790
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
791
|
+
...
|
|
792
|
+
|
|
793
|
+
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):
|
|
917
794
|
"""
|
|
918
|
-
Specifies the PyPI packages for
|
|
795
|
+
Specifies the PyPI packages for the step.
|
|
919
796
|
|
|
920
|
-
|
|
797
|
+
Information in this decorator will augment any
|
|
798
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
799
|
+
you can use `@pypi_base` to set packages required by all
|
|
921
800
|
steps and use `@pypi` to specify step-specific overrides.
|
|
922
801
|
|
|
802
|
+
|
|
923
803
|
Parameters
|
|
924
804
|
----------
|
|
925
805
|
packages : Dict[str, str], default: {}
|
|
926
|
-
Packages to use for this
|
|
806
|
+
Packages to use for this step. The key is the name of the package
|
|
927
807
|
and the value is the version to use.
|
|
928
808
|
python : str, optional, default: None
|
|
929
809
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
@@ -931,124 +811,82 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
|
931
811
|
"""
|
|
932
812
|
...
|
|
933
813
|
|
|
934
|
-
|
|
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]]]:
|
|
935
816
|
"""
|
|
936
|
-
Specifies
|
|
817
|
+
Specifies the resources needed when executing this step.
|
|
937
818
|
|
|
938
|
-
|
|
939
|
-
|
|
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`.
|
|
940
832
|
|
|
941
833
|
|
|
942
834
|
Parameters
|
|
943
835
|
----------
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
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>`
|
|
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.
|
|
966
847
|
"""
|
|
967
848
|
...
|
|
968
849
|
|
|
969
|
-
|
|
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
|
-
"""
|
|
850
|
+
@typing.overload
|
|
851
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1010
852
|
...
|
|
1011
853
|
|
|
1012
|
-
|
|
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):
|
|
1013
859
|
"""
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
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`.
|
|
1019
875
|
|
|
1020
876
|
|
|
1021
877
|
Parameters
|
|
1022
878
|
----------
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
the
|
|
1033
|
-
|
|
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)
|
|
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.
|
|
1052
890
|
"""
|
|
1053
891
|
...
|
|
1054
892
|
|
|
@@ -1204,54 +1042,46 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
|
1204
1042
|
"""
|
|
1205
1043
|
...
|
|
1206
1044
|
|
|
1207
|
-
|
|
1208
|
-
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
|
-
"""
|
|
1210
|
-
Specifies the Conda environment for all steps of the flow.
|
|
1211
|
-
|
|
1212
|
-
Use `@conda_base` to set common libraries required by all
|
|
1213
|
-
steps and use `@conda` to specify step-specific additions.
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
Parameters
|
|
1217
|
-
----------
|
|
1218
|
-
packages : Dict[str, str], default {}
|
|
1219
|
-
Packages to use for this flow. The key is the name of the package
|
|
1220
|
-
and the value is the version to use.
|
|
1221
|
-
libraries : Dict[str, str], default {}
|
|
1222
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
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
|
-
disabled : bool, default False
|
|
1227
|
-
If set to True, disables Conda.
|
|
1228
|
-
"""
|
|
1229
|
-
...
|
|
1230
|
-
|
|
1231
|
-
@typing.overload
|
|
1232
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1233
|
-
...
|
|
1234
|
-
|
|
1235
|
-
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
|
1045
|
+
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]]:
|
|
1236
1046
|
"""
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1047
|
+
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)
|
|
1048
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1049
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1050
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1051
|
+
starts only after all sensors finish.
|
|
1241
1052
|
|
|
1242
1053
|
|
|
1243
1054
|
Parameters
|
|
1244
1055
|
----------
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1056
|
+
timeout : int
|
|
1057
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1058
|
+
poke_interval : int
|
|
1059
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1060
|
+
mode : str
|
|
1061
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1062
|
+
exponential_backoff : bool
|
|
1063
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1064
|
+
pool : str
|
|
1065
|
+
the slot pool this task should run in,
|
|
1066
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1067
|
+
soft_fail : bool
|
|
1068
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1069
|
+
name : str
|
|
1070
|
+
Name of the sensor on Airflow
|
|
1071
|
+
description : str
|
|
1072
|
+
Description of sensor in the Airflow UI
|
|
1073
|
+
bucket_key : Union[str, List[str]]
|
|
1074
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1075
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1076
|
+
bucket_name : str
|
|
1077
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1078
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1079
|
+
wildcard_match : bool
|
|
1080
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1081
|
+
aws_conn_id : str
|
|
1082
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
|
1083
|
+
verify : bool
|
|
1084
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1255
1085
|
"""
|
|
1256
1086
|
...
|
|
1257
1087
|
|
|
@@ -1348,3 +1178,173 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
|
1348
1178
|
"""
|
|
1349
1179
|
...
|
|
1350
1180
|
|
|
1181
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1182
|
+
"""
|
|
1183
|
+
Specifies what flows belong to the same project.
|
|
1184
|
+
|
|
1185
|
+
A project-specific namespace is created for all flows that
|
|
1186
|
+
use the same `@project(name)`.
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
Parameters
|
|
1190
|
+
----------
|
|
1191
|
+
name : str
|
|
1192
|
+
Project name. Make sure that the name is unique amongst all
|
|
1193
|
+
projects that use the same production scheduler. The name may
|
|
1194
|
+
contain only lowercase alphanumeric characters and underscores.
|
|
1195
|
+
|
|
1196
|
+
branch : Optional[str], default None
|
|
1197
|
+
The branch to use. If not specified, the branch is set to
|
|
1198
|
+
`user.<username>` unless `production` is set to `True`. This can
|
|
1199
|
+
also be set on the command line using `--branch` as a top-level option.
|
|
1200
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
|
1201
|
+
|
|
1202
|
+
production : bool, default False
|
|
1203
|
+
Whether or not the branch is the production branch. This can also be set on the
|
|
1204
|
+
command line using `--production` as a top-level option. It is an error to specify
|
|
1205
|
+
`production` in the decorator and on the command line.
|
|
1206
|
+
The project branch name will be:
|
|
1207
|
+
- if `branch` is specified:
|
|
1208
|
+
- if `production` is True: `prod.<branch>`
|
|
1209
|
+
- if `production` is False: `test.<branch>`
|
|
1210
|
+
- if `branch` is not specified:
|
|
1211
|
+
- if `production` is True: `prod`
|
|
1212
|
+
- if `production` is False: `user.<username>`
|
|
1213
|
+
"""
|
|
1214
|
+
...
|
|
1215
|
+
|
|
1216
|
+
@typing.overload
|
|
1217
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1218
|
+
"""
|
|
1219
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1220
|
+
|
|
1221
|
+
Use `@pypi_base` to set common packages required by all
|
|
1222
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1223
|
+
|
|
1224
|
+
Parameters
|
|
1225
|
+
----------
|
|
1226
|
+
packages : Dict[str, str], default: {}
|
|
1227
|
+
Packages to use for this flow. The key is the name of the package
|
|
1228
|
+
and the value is the version to use.
|
|
1229
|
+
python : str, optional, default: None
|
|
1230
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1231
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1232
|
+
"""
|
|
1233
|
+
...
|
|
1234
|
+
|
|
1235
|
+
@typing.overload
|
|
1236
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1237
|
+
...
|
|
1238
|
+
|
|
1239
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
1240
|
+
"""
|
|
1241
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1242
|
+
|
|
1243
|
+
Use `@pypi_base` to set common packages required by all
|
|
1244
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1245
|
+
|
|
1246
|
+
Parameters
|
|
1247
|
+
----------
|
|
1248
|
+
packages : Dict[str, str], default: {}
|
|
1249
|
+
Packages to use for this flow. The key is the name of the package
|
|
1250
|
+
and the value is the version to use.
|
|
1251
|
+
python : str, optional, default: None
|
|
1252
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1253
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1254
|
+
"""
|
|
1255
|
+
...
|
|
1256
|
+
|
|
1257
|
+
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]]:
|
|
1258
|
+
"""
|
|
1259
|
+
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.
|
|
1260
|
+
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.
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
Parameters
|
|
1264
|
+
----------
|
|
1265
|
+
timeout : int
|
|
1266
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1267
|
+
poke_interval : int
|
|
1268
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1269
|
+
mode : str
|
|
1270
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1271
|
+
exponential_backoff : bool
|
|
1272
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1273
|
+
pool : str
|
|
1274
|
+
the slot pool this task should run in,
|
|
1275
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1276
|
+
soft_fail : bool
|
|
1277
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1278
|
+
name : str
|
|
1279
|
+
Name of the sensor on Airflow
|
|
1280
|
+
description : str
|
|
1281
|
+
Description of sensor in the Airflow UI
|
|
1282
|
+
external_dag_id : str
|
|
1283
|
+
The dag_id that contains the task you want to wait for.
|
|
1284
|
+
external_task_ids : List[str]
|
|
1285
|
+
The list of task_ids that you want to wait for.
|
|
1286
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1287
|
+
allowed_states : List[str]
|
|
1288
|
+
Iterable of allowed states, (Default: ['success'])
|
|
1289
|
+
failed_states : List[str]
|
|
1290
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
|
1291
|
+
execution_delta : datetime.timedelta
|
|
1292
|
+
time difference with the previous execution to look at,
|
|
1293
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1294
|
+
check_existence: bool
|
|
1295
|
+
Set to True to check if the external task exists or check if
|
|
1296
|
+
the DAG to wait for exists. (Default: True)
|
|
1297
|
+
"""
|
|
1298
|
+
...
|
|
1299
|
+
|
|
1300
|
+
@typing.overload
|
|
1301
|
+
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]]:
|
|
1302
|
+
"""
|
|
1303
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1304
|
+
|
|
1305
|
+
Use `@conda_base` to set common libraries required by all
|
|
1306
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1307
|
+
|
|
1308
|
+
|
|
1309
|
+
Parameters
|
|
1310
|
+
----------
|
|
1311
|
+
packages : Dict[str, str], default {}
|
|
1312
|
+
Packages to use for this flow. The key is the name of the package
|
|
1313
|
+
and the value is the version to use.
|
|
1314
|
+
libraries : Dict[str, str], default {}
|
|
1315
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1316
|
+
python : str, optional, default None
|
|
1317
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1318
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1319
|
+
disabled : bool, default False
|
|
1320
|
+
If set to True, disables Conda.
|
|
1321
|
+
"""
|
|
1322
|
+
...
|
|
1323
|
+
|
|
1324
|
+
@typing.overload
|
|
1325
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1326
|
+
...
|
|
1327
|
+
|
|
1328
|
+
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
|
1329
|
+
"""
|
|
1330
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1331
|
+
|
|
1332
|
+
Use `@conda_base` to set common libraries required by all
|
|
1333
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1334
|
+
|
|
1335
|
+
|
|
1336
|
+
Parameters
|
|
1337
|
+
----------
|
|
1338
|
+
packages : Dict[str, str], default {}
|
|
1339
|
+
Packages to use for this flow. The key is the name of the package
|
|
1340
|
+
and the value is the version to use.
|
|
1341
|
+
libraries : Dict[str, str], default {}
|
|
1342
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1343
|
+
python : str, optional, default None
|
|
1344
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1345
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1346
|
+
disabled : bool, default False
|
|
1347
|
+
If set to True, disables Conda.
|
|
1348
|
+
"""
|
|
1349
|
+
...
|
|
1350
|
+
|