metaflow-stubs 2.15.10__py2.py3-none-any.whl → 2.15.11__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metaflow-stubs/__init__.pyi +546 -546
- 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 +4 -4
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +3 -3
- metaflow-stubs/info_file.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 +6 -6
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +12 -12
- 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 +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/aws/__init__.pyi +4 -4
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +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 +2 -2
- 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 +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +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 +3 -3
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +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 +3 -3
- 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/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 +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +29 -29
- 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_decorators.pyi +4 -4
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.15.10.dist-info → metaflow_stubs-2.15.11.dist-info}/METADATA +2 -2
- metaflow_stubs-2.15.11.dist-info/RECORD +149 -0
- {metaflow_stubs-2.15.10.dist-info → metaflow_stubs-2.15.11.dist-info}/WHEEL +1 -1
- metaflow_stubs-2.15.10.dist-info/RECORD +0 -149
- {metaflow_stubs-2.15.10.dist-info → metaflow_stubs-2.15.11.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.15.
|
4
|
-
# Generated on 2025-05-
|
3
|
+
# MF version: 2.15.11 #
|
4
|
+
# Generated on 2025-05-06T23:47:09.203033 #
|
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
|
|
@@ -35,16 +35,16 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
|
|
35
35
|
from .user_configs.config_parameters import config_expr as config_expr
|
36
36
|
from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
38
|
-
from . import events as events
|
39
38
|
from . import metaflow_git as metaflow_git
|
40
39
|
from . import tuple_util as tuple_util
|
40
|
+
from . import events as events
|
41
41
|
from . import runner as runner
|
42
42
|
from . import plugins as plugins
|
43
43
|
from .plugins.datatools.s3.s3 import S3 as S3
|
44
44
|
from . import includefile as includefile
|
45
45
|
from .includefile import IncludeFile as IncludeFile
|
46
|
-
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
47
46
|
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
47
|
+
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
48
48
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
49
49
|
from . import cards as cards
|
50
50
|
from . import client as client
|
@@ -147,369 +147,277 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
147
147
|
...
|
148
148
|
|
149
149
|
@typing.overload
|
150
|
-
def
|
150
|
+
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]]]:
|
151
151
|
"""
|
152
|
-
|
152
|
+
Specifies that the step will success under all circumstances.
|
153
153
|
|
154
|
-
|
154
|
+
The decorator will create an optional artifact, specified by `var`, which
|
155
|
+
contains the exception raised. You can use it to detect the presence
|
156
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
157
|
+
are missing.
|
155
158
|
|
156
159
|
|
157
160
|
Parameters
|
158
161
|
----------
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
timeout : int, default 45
|
166
|
-
Interrupt reporting if it takes more than this many seconds.
|
162
|
+
var : str, optional, default None
|
163
|
+
Name of the artifact in which to store the caught exception.
|
164
|
+
If not specified, the exception is not stored.
|
165
|
+
print_exception : bool, default True
|
166
|
+
Determines whether or not the exception is printed to
|
167
|
+
stdout when caught.
|
167
168
|
"""
|
168
169
|
...
|
169
170
|
|
170
171
|
@typing.overload
|
171
|
-
def
|
172
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
172
173
|
...
|
173
174
|
|
174
175
|
@typing.overload
|
175
|
-
def
|
176
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
176
177
|
...
|
177
178
|
|
178
|
-
def
|
179
|
+
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):
|
179
180
|
"""
|
180
|
-
|
181
|
+
Specifies that the step will success under all circumstances.
|
181
182
|
|
182
|
-
|
183
|
+
The decorator will create an optional artifact, specified by `var`, which
|
184
|
+
contains the exception raised. You can use it to detect the presence
|
185
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
186
|
+
are missing.
|
183
187
|
|
184
188
|
|
185
189
|
Parameters
|
186
190
|
----------
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
timeout : int, default 45
|
194
|
-
Interrupt reporting if it takes more than this many seconds.
|
191
|
+
var : str, optional, default None
|
192
|
+
Name of the artifact in which to store the caught exception.
|
193
|
+
If not specified, the exception is not stored.
|
194
|
+
print_exception : bool, default True
|
195
|
+
Determines whether or not the exception is printed to
|
196
|
+
stdout when caught.
|
195
197
|
"""
|
196
198
|
...
|
197
199
|
|
198
200
|
@typing.overload
|
199
|
-
def
|
201
|
+
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]]]:
|
200
202
|
"""
|
201
|
-
Specifies
|
202
|
-
|
203
|
-
Information in this decorator will augment any
|
204
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
205
|
-
you can use `@pypi_base` to set packages required by all
|
206
|
-
steps and use `@pypi` to specify step-specific overrides.
|
203
|
+
Specifies environment variables to be set prior to the execution of a step.
|
207
204
|
|
208
205
|
|
209
206
|
Parameters
|
210
207
|
----------
|
211
|
-
|
212
|
-
|
213
|
-
and the value is the version to use.
|
214
|
-
python : str, optional, default: None
|
215
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
216
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
208
|
+
vars : Dict[str, str], default {}
|
209
|
+
Dictionary of environment variables to set.
|
217
210
|
"""
|
218
211
|
...
|
219
212
|
|
220
213
|
@typing.overload
|
221
|
-
def
|
214
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
222
215
|
...
|
223
216
|
|
224
217
|
@typing.overload
|
225
|
-
def
|
218
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
226
219
|
...
|
227
220
|
|
228
|
-
def
|
221
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
229
222
|
"""
|
230
|
-
Specifies
|
231
|
-
|
232
|
-
Information in this decorator will augment any
|
233
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
234
|
-
you can use `@pypi_base` to set packages required by all
|
235
|
-
steps and use `@pypi` to specify step-specific overrides.
|
223
|
+
Specifies environment variables to be set prior to the execution of a step.
|
236
224
|
|
237
225
|
|
238
226
|
Parameters
|
239
227
|
----------
|
240
|
-
|
241
|
-
|
242
|
-
and the value is the version to use.
|
243
|
-
python : str, optional, default: None
|
244
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
245
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
228
|
+
vars : Dict[str, str], default {}
|
229
|
+
Dictionary of environment variables to set.
|
246
230
|
"""
|
247
231
|
...
|
248
232
|
|
249
233
|
@typing.overload
|
250
|
-
def
|
234
|
+
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]]]:
|
251
235
|
"""
|
252
|
-
Specifies
|
253
|
-
|
254
|
-
This decorator is useful if this step may hang indefinitely.
|
236
|
+
Specifies the number of times the task corresponding
|
237
|
+
to a step needs to be retried.
|
255
238
|
|
256
|
-
This
|
257
|
-
|
258
|
-
|
239
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
240
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
241
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
259
242
|
|
260
|
-
|
261
|
-
|
243
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
244
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
245
|
+
ensuring that the flow execution can continue.
|
262
246
|
|
263
247
|
|
264
248
|
Parameters
|
265
249
|
----------
|
266
|
-
|
267
|
-
Number of
|
268
|
-
|
269
|
-
Number of minutes
|
270
|
-
hours : int, default 0
|
271
|
-
Number of hours to wait prior to timing out.
|
250
|
+
times : int, default 3
|
251
|
+
Number of times to retry this task.
|
252
|
+
minutes_between_retries : int, default 2
|
253
|
+
Number of minutes between retries.
|
272
254
|
"""
|
273
255
|
...
|
274
256
|
|
275
257
|
@typing.overload
|
276
|
-
def
|
258
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
277
259
|
...
|
278
260
|
|
279
261
|
@typing.overload
|
280
|
-
def
|
262
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
281
263
|
...
|
282
264
|
|
283
|
-
def
|
265
|
+
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):
|
284
266
|
"""
|
285
|
-
Specifies
|
286
|
-
|
287
|
-
This decorator is useful if this step may hang indefinitely.
|
267
|
+
Specifies the number of times the task corresponding
|
268
|
+
to a step needs to be retried.
|
288
269
|
|
289
|
-
This
|
290
|
-
|
291
|
-
|
270
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
271
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
272
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
292
273
|
|
293
|
-
|
294
|
-
|
274
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
275
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
276
|
+
ensuring that the flow execution can continue.
|
295
277
|
|
296
278
|
|
297
279
|
Parameters
|
298
280
|
----------
|
299
|
-
|
300
|
-
Number of
|
301
|
-
|
302
|
-
Number of minutes
|
303
|
-
hours : int, default 0
|
304
|
-
Number of hours to wait prior to timing out.
|
305
|
-
"""
|
306
|
-
...
|
307
|
-
|
308
|
-
@typing.overload
|
309
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
310
|
-
"""
|
311
|
-
Decorator prototype for all step decorators. This function gets specialized
|
312
|
-
and imported for all decorators types by _import_plugin_decorators().
|
281
|
+
times : int, default 3
|
282
|
+
Number of times to retry this task.
|
283
|
+
minutes_between_retries : int, default 2
|
284
|
+
Number of minutes between retries.
|
313
285
|
"""
|
314
286
|
...
|
315
287
|
|
316
|
-
|
317
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
318
|
-
...
|
319
|
-
|
320
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
288
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], 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]]]:
|
321
289
|
"""
|
322
|
-
|
323
|
-
|
290
|
+
Specifies that this step should execute on Kubernetes.
|
291
|
+
|
292
|
+
|
293
|
+
Parameters
|
294
|
+
----------
|
295
|
+
cpu : int, default 1
|
296
|
+
Number of CPUs required for this step. If `@resources` is
|
297
|
+
also present, the maximum value from all decorators is used.
|
298
|
+
memory : int, default 4096
|
299
|
+
Memory size (in MB) required for this step. If
|
300
|
+
`@resources` is also present, the maximum value from all decorators is
|
301
|
+
used.
|
302
|
+
disk : int, default 10240
|
303
|
+
Disk size (in MB) required for this step. If
|
304
|
+
`@resources` is also present, the maximum value from all decorators is
|
305
|
+
used.
|
306
|
+
image : str, optional, default None
|
307
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
308
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
309
|
+
not, a default Docker image mapping to the current version of Python is used.
|
310
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
311
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
312
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
313
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
314
|
+
secrets : List[str], optional, default None
|
315
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
316
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
317
|
+
in Metaflow configuration.
|
318
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
319
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
320
|
+
Can be passed in as a comma separated string of values e.g.
|
321
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
322
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
323
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
324
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
325
|
+
gpu : int, optional, default None
|
326
|
+
Number of GPUs required for this step. A value of zero implies that
|
327
|
+
the scheduled node should not have GPUs.
|
328
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
329
|
+
The vendor of the GPUs to be used for this step.
|
330
|
+
tolerations : List[str], default []
|
331
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
332
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
333
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
334
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
335
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
336
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
337
|
+
use_tmpfs : bool, default False
|
338
|
+
This enables an explicit tmpfs mount for this step.
|
339
|
+
tmpfs_tempdir : bool, default True
|
340
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
341
|
+
tmpfs_size : int, optional, default: None
|
342
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
343
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
344
|
+
memory allocated for this step.
|
345
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
346
|
+
Path to tmpfs mount for this step.
|
347
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
348
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
349
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
350
|
+
shared_memory: int, optional
|
351
|
+
Shared memory size (in MiB) required for this step
|
352
|
+
port: int, optional
|
353
|
+
Port number to specify in the Kubernetes job object
|
354
|
+
compute_pool : str, optional, default None
|
355
|
+
Compute pool to be used for for this step.
|
356
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
357
|
+
hostname_resolution_timeout: int, default 10 * 60
|
358
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
359
|
+
Only applicable when @parallel is used.
|
360
|
+
qos: str, default: Burstable
|
361
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
362
|
+
|
363
|
+
security_context: Dict[str, Any], optional, default None
|
364
|
+
Container security context. Applies to the task container. Allows the following keys:
|
365
|
+
- privileged: bool, optional, default None
|
366
|
+
- allow_privilege_escalation: bool, optional, default None
|
367
|
+
- run_as_user: int, optional, default None
|
368
|
+
- run_as_group: int, optional, default None
|
369
|
+
- run_as_non_root: bool, optional, default None
|
324
370
|
"""
|
325
371
|
...
|
326
372
|
|
327
373
|
@typing.overload
|
328
|
-
def
|
374
|
+
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]]]:
|
329
375
|
"""
|
330
|
-
Specifies the
|
376
|
+
Specifies the PyPI packages for the step.
|
331
377
|
|
332
378
|
Information in this decorator will augment any
|
333
|
-
attributes set in the `@
|
334
|
-
you can use `@
|
335
|
-
steps and use `@
|
379
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
380
|
+
you can use `@pypi_base` to set packages required by all
|
381
|
+
steps and use `@pypi` to specify step-specific overrides.
|
336
382
|
|
337
383
|
|
338
384
|
Parameters
|
339
385
|
----------
|
340
|
-
packages : Dict[str, str], default {}
|
386
|
+
packages : Dict[str, str], default: {}
|
341
387
|
Packages to use for this step. The key is the name of the package
|
342
388
|
and the value is the version to use.
|
343
|
-
|
344
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
345
|
-
python : str, optional, default None
|
389
|
+
python : str, optional, default: None
|
346
390
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
347
391
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
348
|
-
disabled : bool, default False
|
349
|
-
If set to True, disables @conda.
|
350
392
|
"""
|
351
393
|
...
|
352
394
|
|
353
395
|
@typing.overload
|
354
|
-
def
|
396
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
355
397
|
...
|
356
398
|
|
357
399
|
@typing.overload
|
358
|
-
def
|
400
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
359
401
|
...
|
360
402
|
|
361
|
-
def
|
403
|
+
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):
|
362
404
|
"""
|
363
|
-
Specifies the
|
405
|
+
Specifies the PyPI packages for the step.
|
364
406
|
|
365
407
|
Information in this decorator will augment any
|
366
|
-
attributes set in the `@
|
367
|
-
you can use `@
|
368
|
-
steps and use `@
|
408
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
409
|
+
you can use `@pypi_base` to set packages required by all
|
410
|
+
steps and use `@pypi` to specify step-specific overrides.
|
369
411
|
|
370
412
|
|
371
413
|
Parameters
|
372
414
|
----------
|
373
|
-
packages : Dict[str, str], default {}
|
415
|
+
packages : Dict[str, str], default: {}
|
374
416
|
Packages to use for this step. The key is the name of the package
|
375
417
|
and the value is the version to use.
|
376
|
-
|
377
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
378
|
-
python : str, optional, default None
|
418
|
+
python : str, optional, default: None
|
379
419
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
380
420
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
381
|
-
disabled : bool, default False
|
382
|
-
If set to True, disables @conda.
|
383
|
-
"""
|
384
|
-
...
|
385
|
-
|
386
|
-
@typing.overload
|
387
|
-
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]]]:
|
388
|
-
"""
|
389
|
-
Specifies the resources needed when executing this step.
|
390
|
-
|
391
|
-
Use `@resources` to specify the resource requirements
|
392
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
393
|
-
|
394
|
-
You can choose the compute layer on the command line by executing e.g.
|
395
|
-
```
|
396
|
-
python myflow.py run --with batch
|
397
|
-
```
|
398
|
-
or
|
399
|
-
```
|
400
|
-
python myflow.py run --with kubernetes
|
401
|
-
```
|
402
|
-
which executes the flow on the desired system using the
|
403
|
-
requirements specified in `@resources`.
|
404
|
-
|
405
|
-
|
406
|
-
Parameters
|
407
|
-
----------
|
408
|
-
cpu : int, default 1
|
409
|
-
Number of CPUs required for this step.
|
410
|
-
gpu : int, optional, default None
|
411
|
-
Number of GPUs required for this step.
|
412
|
-
disk : int, optional, default None
|
413
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
414
|
-
memory : int, default 4096
|
415
|
-
Memory size (in MB) required for this step.
|
416
|
-
shared_memory : int, optional, default None
|
417
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
418
|
-
This parameter maps to the `--shm-size` option in Docker.
|
419
|
-
"""
|
420
|
-
...
|
421
|
-
|
422
|
-
@typing.overload
|
423
|
-
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
424
|
-
...
|
425
|
-
|
426
|
-
@typing.overload
|
427
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
428
|
-
...
|
429
|
-
|
430
|
-
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):
|
431
|
-
"""
|
432
|
-
Specifies the resources needed when executing this step.
|
433
|
-
|
434
|
-
Use `@resources` to specify the resource requirements
|
435
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
436
|
-
|
437
|
-
You can choose the compute layer on the command line by executing e.g.
|
438
|
-
```
|
439
|
-
python myflow.py run --with batch
|
440
|
-
```
|
441
|
-
or
|
442
|
-
```
|
443
|
-
python myflow.py run --with kubernetes
|
444
|
-
```
|
445
|
-
which executes the flow on the desired system using the
|
446
|
-
requirements specified in `@resources`.
|
447
|
-
|
448
|
-
|
449
|
-
Parameters
|
450
|
-
----------
|
451
|
-
cpu : int, default 1
|
452
|
-
Number of CPUs required for this step.
|
453
|
-
gpu : int, optional, default None
|
454
|
-
Number of GPUs required for this step.
|
455
|
-
disk : int, optional, default None
|
456
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
457
|
-
memory : int, default 4096
|
458
|
-
Memory size (in MB) required for this step.
|
459
|
-
shared_memory : int, optional, default None
|
460
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
461
|
-
This parameter maps to the `--shm-size` option in Docker.
|
462
|
-
"""
|
463
|
-
...
|
464
|
-
|
465
|
-
@typing.overload
|
466
|
-
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]]]:
|
467
|
-
"""
|
468
|
-
Specifies that the step will success under all circumstances.
|
469
|
-
|
470
|
-
The decorator will create an optional artifact, specified by `var`, which
|
471
|
-
contains the exception raised. You can use it to detect the presence
|
472
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
473
|
-
are missing.
|
474
|
-
|
475
|
-
|
476
|
-
Parameters
|
477
|
-
----------
|
478
|
-
var : str, optional, default None
|
479
|
-
Name of the artifact in which to store the caught exception.
|
480
|
-
If not specified, the exception is not stored.
|
481
|
-
print_exception : bool, default True
|
482
|
-
Determines whether or not the exception is printed to
|
483
|
-
stdout when caught.
|
484
|
-
"""
|
485
|
-
...
|
486
|
-
|
487
|
-
@typing.overload
|
488
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
489
|
-
...
|
490
|
-
|
491
|
-
@typing.overload
|
492
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
493
|
-
...
|
494
|
-
|
495
|
-
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):
|
496
|
-
"""
|
497
|
-
Specifies that the step will success under all circumstances.
|
498
|
-
|
499
|
-
The decorator will create an optional artifact, specified by `var`, which
|
500
|
-
contains the exception raised. You can use it to detect the presence
|
501
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
502
|
-
are missing.
|
503
|
-
|
504
|
-
|
505
|
-
Parameters
|
506
|
-
----------
|
507
|
-
var : str, optional, default None
|
508
|
-
Name of the artifact in which to store the caught exception.
|
509
|
-
If not specified, the exception is not stored.
|
510
|
-
print_exception : bool, default True
|
511
|
-
Determines whether or not the exception is printed to
|
512
|
-
stdout when caught.
|
513
421
|
"""
|
514
422
|
...
|
515
423
|
|
@@ -663,354 +571,353 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
663
571
|
...
|
664
572
|
|
665
573
|
@typing.overload
|
666
|
-
def
|
574
|
+
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]]]:
|
667
575
|
"""
|
668
|
-
|
669
|
-
to a step needs to be retried.
|
670
|
-
|
671
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
672
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
673
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
576
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
674
577
|
|
675
|
-
|
676
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
677
|
-
ensuring that the flow execution can continue.
|
578
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
678
579
|
|
679
580
|
|
680
581
|
Parameters
|
681
582
|
----------
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
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.
|
686
591
|
"""
|
687
592
|
...
|
688
593
|
|
689
594
|
@typing.overload
|
690
|
-
def
|
595
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
691
596
|
...
|
692
597
|
|
693
598
|
@typing.overload
|
694
|
-
def
|
599
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
695
600
|
...
|
696
601
|
|
697
|
-
def
|
602
|
+
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):
|
698
603
|
"""
|
699
|
-
|
700
|
-
to a step needs to be retried.
|
701
|
-
|
702
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
703
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
704
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
604
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
705
605
|
|
706
|
-
|
707
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
708
|
-
ensuring that the flow execution can continue.
|
606
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
709
607
|
|
710
608
|
|
711
609
|
Parameters
|
712
610
|
----------
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
611
|
+
type : str, default 'default'
|
612
|
+
Card type.
|
613
|
+
id : str, optional, default None
|
614
|
+
If multiple cards are present, use this id to identify this card.
|
615
|
+
options : Dict[str, Any], default {}
|
616
|
+
Options passed to the card. The contents depend on the card type.
|
617
|
+
timeout : int, default 45
|
618
|
+
Interrupt reporting if it takes more than this many seconds.
|
717
619
|
"""
|
718
620
|
...
|
719
621
|
|
720
|
-
|
622
|
+
@typing.overload
|
623
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
721
624
|
"""
|
722
|
-
|
625
|
+
Decorator prototype for all step decorators. This function gets specialized
|
626
|
+
and imported for all decorators types by _import_plugin_decorators().
|
627
|
+
"""
|
628
|
+
...
|
629
|
+
|
630
|
+
@typing.overload
|
631
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
632
|
+
...
|
633
|
+
|
634
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
635
|
+
"""
|
636
|
+
Decorator prototype for all step decorators. This function gets specialized
|
637
|
+
and imported for all decorators types by _import_plugin_decorators().
|
638
|
+
"""
|
639
|
+
...
|
640
|
+
|
641
|
+
@typing.overload
|
642
|
+
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]]]:
|
643
|
+
"""
|
644
|
+
Specifies the resources needed when executing this step.
|
645
|
+
|
646
|
+
Use `@resources` to specify the resource requirements
|
647
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
648
|
+
|
649
|
+
You can choose the compute layer on the command line by executing e.g.
|
650
|
+
```
|
651
|
+
python myflow.py run --with batch
|
652
|
+
```
|
653
|
+
or
|
654
|
+
```
|
655
|
+
python myflow.py run --with kubernetes
|
656
|
+
```
|
657
|
+
which executes the flow on the desired system using the
|
658
|
+
requirements specified in `@resources`.
|
723
659
|
|
724
660
|
|
725
661
|
Parameters
|
726
662
|
----------
|
727
663
|
cpu : int, default 1
|
728
|
-
Number of CPUs required for this step.
|
729
|
-
also present, the maximum value from all decorators is used.
|
730
|
-
memory : int, default 4096
|
731
|
-
Memory size (in MB) required for this step. If
|
732
|
-
`@resources` is also present, the maximum value from all decorators is
|
733
|
-
used.
|
734
|
-
disk : int, default 10240
|
735
|
-
Disk size (in MB) required for this step. If
|
736
|
-
`@resources` is also present, the maximum value from all decorators is
|
737
|
-
used.
|
738
|
-
image : str, optional, default None
|
739
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
740
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
741
|
-
not, a default Docker image mapping to the current version of Python is used.
|
742
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
743
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
744
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
745
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
746
|
-
secrets : List[str], optional, default None
|
747
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
748
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
749
|
-
in Metaflow configuration.
|
750
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
751
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
752
|
-
Can be passed in as a comma separated string of values e.g.
|
753
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
754
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
755
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
756
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
664
|
+
Number of CPUs required for this step.
|
757
665
|
gpu : int, optional, default None
|
758
|
-
Number of GPUs required for this step.
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
767
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
768
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
769
|
-
use_tmpfs : bool, default False
|
770
|
-
This enables an explicit tmpfs mount for this step.
|
771
|
-
tmpfs_tempdir : bool, default True
|
772
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
773
|
-
tmpfs_size : int, optional, default: None
|
774
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
775
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
776
|
-
memory allocated for this step.
|
777
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
778
|
-
Path to tmpfs mount for this step.
|
779
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
780
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
781
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
782
|
-
shared_memory: int, optional
|
783
|
-
Shared memory size (in MiB) required for this step
|
784
|
-
port: int, optional
|
785
|
-
Port number to specify in the Kubernetes job object
|
786
|
-
compute_pool : str, optional, default None
|
787
|
-
Compute pool to be used for for this step.
|
788
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
789
|
-
hostname_resolution_timeout: int, default 10 * 60
|
790
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
791
|
-
Only applicable when @parallel is used.
|
792
|
-
qos: str, default: Burstable
|
793
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
794
|
-
|
795
|
-
security_context: Dict[str, Any], optional, default None
|
796
|
-
Container security context. Applies to the task container. Allows the following keys:
|
797
|
-
- privileged: bool, optional, default None
|
798
|
-
- allow_privilege_escalation: bool, optional, default None
|
799
|
-
- run_as_user: int, optional, default None
|
800
|
-
- run_as_group: int, optional, default None
|
801
|
-
- run_as_non_root: bool, optional, default None
|
802
|
-
"""
|
803
|
-
...
|
804
|
-
|
805
|
-
@typing.overload
|
806
|
-
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
807
|
-
"""
|
808
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
809
|
-
the execution of a step.
|
810
|
-
|
811
|
-
|
812
|
-
Parameters
|
813
|
-
----------
|
814
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
815
|
-
List of secret specs, defining how the secrets are to be retrieved
|
666
|
+
Number of GPUs required for this step.
|
667
|
+
disk : int, optional, default None
|
668
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
669
|
+
memory : int, default 4096
|
670
|
+
Memory size (in MB) required for this step.
|
671
|
+
shared_memory : int, optional, default None
|
672
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
673
|
+
This parameter maps to the `--shm-size` option in Docker.
|
816
674
|
"""
|
817
675
|
...
|
818
676
|
|
819
677
|
@typing.overload
|
820
|
-
def
|
678
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
821
679
|
...
|
822
680
|
|
823
681
|
@typing.overload
|
824
|
-
def
|
682
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
825
683
|
...
|
826
684
|
|
827
|
-
def
|
685
|
+
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):
|
828
686
|
"""
|
829
|
-
Specifies
|
830
|
-
|
687
|
+
Specifies the resources needed when executing this step.
|
688
|
+
|
689
|
+
Use `@resources` to specify the resource requirements
|
690
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
691
|
+
|
692
|
+
You can choose the compute layer on the command line by executing e.g.
|
693
|
+
```
|
694
|
+
python myflow.py run --with batch
|
695
|
+
```
|
696
|
+
or
|
697
|
+
```
|
698
|
+
python myflow.py run --with kubernetes
|
699
|
+
```
|
700
|
+
which executes the flow on the desired system using the
|
701
|
+
requirements specified in `@resources`.
|
831
702
|
|
832
703
|
|
833
704
|
Parameters
|
834
705
|
----------
|
835
|
-
|
836
|
-
|
706
|
+
cpu : int, default 1
|
707
|
+
Number of CPUs required for this step.
|
708
|
+
gpu : int, optional, default None
|
709
|
+
Number of GPUs required for this step.
|
710
|
+
disk : int, optional, default None
|
711
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
712
|
+
memory : int, default 4096
|
713
|
+
Memory size (in MB) required for this step.
|
714
|
+
shared_memory : int, optional, default None
|
715
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
716
|
+
This parameter maps to the `--shm-size` option in Docker.
|
837
717
|
"""
|
838
718
|
...
|
839
719
|
|
840
720
|
@typing.overload
|
841
|
-
def
|
721
|
+
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]]]:
|
842
722
|
"""
|
843
|
-
Specifies
|
723
|
+
Specifies the Conda environment for the step.
|
724
|
+
|
725
|
+
Information in this decorator will augment any
|
726
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
727
|
+
you can use `@conda_base` to set packages required by all
|
728
|
+
steps and use `@conda` to specify step-specific overrides.
|
844
729
|
|
845
730
|
|
846
731
|
Parameters
|
847
732
|
----------
|
848
|
-
|
849
|
-
|
733
|
+
packages : Dict[str, str], default {}
|
734
|
+
Packages to use for this step. The key is the name of the package
|
735
|
+
and the value is the version to use.
|
736
|
+
libraries : Dict[str, str], default {}
|
737
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
738
|
+
python : str, optional, default None
|
739
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
740
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
741
|
+
disabled : bool, default False
|
742
|
+
If set to True, disables @conda.
|
850
743
|
"""
|
851
744
|
...
|
852
745
|
|
853
746
|
@typing.overload
|
854
|
-
def
|
747
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
855
748
|
...
|
856
749
|
|
857
750
|
@typing.overload
|
858
|
-
def
|
751
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
859
752
|
...
|
860
753
|
|
861
|
-
def
|
754
|
+
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):
|
862
755
|
"""
|
863
|
-
Specifies
|
756
|
+
Specifies the Conda environment for the step.
|
757
|
+
|
758
|
+
Information in this decorator will augment any
|
759
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
760
|
+
you can use `@conda_base` to set packages required by all
|
761
|
+
steps and use `@conda` to specify step-specific overrides.
|
864
762
|
|
865
763
|
|
866
764
|
Parameters
|
867
765
|
----------
|
868
|
-
|
869
|
-
|
766
|
+
packages : Dict[str, str], default {}
|
767
|
+
Packages to use for this step. The key is the name of the package
|
768
|
+
and the value is the version to use.
|
769
|
+
libraries : Dict[str, str], default {}
|
770
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
771
|
+
python : str, optional, default None
|
772
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
773
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
774
|
+
disabled : bool, default False
|
775
|
+
If set to True, disables @conda.
|
870
776
|
"""
|
871
777
|
...
|
872
778
|
|
873
779
|
@typing.overload
|
874
|
-
def
|
780
|
+
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]]]:
|
875
781
|
"""
|
876
|
-
Specifies
|
782
|
+
Specifies a timeout for your step.
|
877
783
|
|
878
|
-
|
879
|
-
@trigger(event='foo')
|
880
|
-
```
|
881
|
-
or
|
882
|
-
```
|
883
|
-
@trigger(events=['foo', 'bar'])
|
884
|
-
```
|
784
|
+
This decorator is useful if this step may hang indefinitely.
|
885
785
|
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
890
|
-
```
|
891
|
-
or
|
892
|
-
```
|
893
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
894
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
895
|
-
```
|
786
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
787
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
788
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
896
789
|
|
897
|
-
|
898
|
-
|
899
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
900
|
-
```
|
901
|
-
This is equivalent to:
|
902
|
-
```
|
903
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
904
|
-
```
|
790
|
+
Note that all the values specified in parameters are added together so if you specify
|
791
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
905
792
|
|
906
793
|
|
907
794
|
Parameters
|
908
795
|
----------
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
796
|
+
seconds : int, default 0
|
797
|
+
Number of seconds to wait prior to timing out.
|
798
|
+
minutes : int, default 0
|
799
|
+
Number of minutes to wait prior to timing out.
|
800
|
+
hours : int, default 0
|
801
|
+
Number of hours to wait prior to timing out.
|
915
802
|
"""
|
916
803
|
...
|
917
804
|
|
918
805
|
@typing.overload
|
919
|
-
def
|
806
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
920
807
|
...
|
921
808
|
|
922
|
-
|
809
|
+
@typing.overload
|
810
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
811
|
+
...
|
812
|
+
|
813
|
+
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):
|
923
814
|
"""
|
924
|
-
Specifies
|
815
|
+
Specifies a timeout for your step.
|
925
816
|
|
926
|
-
|
927
|
-
@trigger(event='foo')
|
928
|
-
```
|
929
|
-
or
|
930
|
-
```
|
931
|
-
@trigger(events=['foo', 'bar'])
|
932
|
-
```
|
817
|
+
This decorator is useful if this step may hang indefinitely.
|
933
818
|
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
938
|
-
```
|
939
|
-
or
|
940
|
-
```
|
941
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
942
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
943
|
-
```
|
819
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
820
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
821
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
944
822
|
|
945
|
-
|
946
|
-
|
947
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
948
|
-
```
|
949
|
-
This is equivalent to:
|
950
|
-
```
|
951
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
952
|
-
```
|
823
|
+
Note that all the values specified in parameters are added together so if you specify
|
824
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
953
825
|
|
954
826
|
|
955
827
|
Parameters
|
956
828
|
----------
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
829
|
+
seconds : int, default 0
|
830
|
+
Number of seconds to wait prior to timing out.
|
831
|
+
minutes : int, default 0
|
832
|
+
Number of minutes to wait prior to timing out.
|
833
|
+
hours : int, default 0
|
834
|
+
Number of hours to wait prior to timing out.
|
963
835
|
"""
|
964
836
|
...
|
965
837
|
|
966
838
|
@typing.overload
|
967
|
-
def
|
839
|
+
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
968
840
|
"""
|
969
|
-
Specifies
|
841
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
842
|
+
the execution of a step.
|
970
843
|
|
971
|
-
|
972
|
-
|
844
|
+
|
845
|
+
Parameters
|
846
|
+
----------
|
847
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
848
|
+
List of secret specs, defining how the secrets are to be retrieved
|
849
|
+
"""
|
850
|
+
...
|
851
|
+
|
852
|
+
@typing.overload
|
853
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
854
|
+
...
|
855
|
+
|
856
|
+
@typing.overload
|
857
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
858
|
+
...
|
859
|
+
|
860
|
+
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]]] = []):
|
861
|
+
"""
|
862
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
863
|
+
the execution of a step.
|
973
864
|
|
974
865
|
|
975
866
|
Parameters
|
976
867
|
----------
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
868
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
869
|
+
List of secret specs, defining how the secrets are to be retrieved
|
870
|
+
"""
|
871
|
+
...
|
872
|
+
|
873
|
+
@typing.overload
|
874
|
+
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
875
|
+
"""
|
876
|
+
Specifies the times when the flow should be run when running on a
|
877
|
+
production scheduler.
|
878
|
+
|
879
|
+
|
880
|
+
Parameters
|
881
|
+
----------
|
882
|
+
hourly : bool, default False
|
883
|
+
Run the workflow hourly.
|
884
|
+
daily : bool, default True
|
885
|
+
Run the workflow daily.
|
886
|
+
weekly : bool, default False
|
887
|
+
Run the workflow weekly.
|
888
|
+
cron : str, optional, default None
|
889
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
890
|
+
specified by this expression.
|
891
|
+
timezone : str, optional, default None
|
892
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
893
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
987
894
|
"""
|
988
895
|
...
|
989
896
|
|
990
897
|
@typing.overload
|
991
|
-
def
|
898
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
992
899
|
...
|
993
900
|
|
994
|
-
def
|
901
|
+
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
995
902
|
"""
|
996
|
-
Specifies the
|
997
|
-
|
998
|
-
Use `@conda_base` to set common libraries required by all
|
999
|
-
steps and use `@conda` to specify step-specific additions.
|
903
|
+
Specifies the times when the flow should be run when running on a
|
904
|
+
production scheduler.
|
1000
905
|
|
1001
906
|
|
1002
907
|
Parameters
|
1003
908
|
----------
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
909
|
+
hourly : bool, default False
|
910
|
+
Run the workflow hourly.
|
911
|
+
daily : bool, default True
|
912
|
+
Run the workflow daily.
|
913
|
+
weekly : bool, default False
|
914
|
+
Run the workflow weekly.
|
915
|
+
cron : str, optional, default None
|
916
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
917
|
+
specified by this expression.
|
918
|
+
timezone : str, optional, default None
|
919
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
920
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1014
921
|
"""
|
1015
922
|
...
|
1016
923
|
|
@@ -1115,38 +1022,54 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1115
1022
|
"""
|
1116
1023
|
...
|
1117
1024
|
|
1118
|
-
|
1025
|
+
@typing.overload
|
1026
|
+
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]]:
|
1119
1027
|
"""
|
1120
|
-
Specifies
|
1028
|
+
Specifies the Conda environment for all steps of the flow.
|
1121
1029
|
|
1122
|
-
|
1123
|
-
use
|
1030
|
+
Use `@conda_base` to set common libraries required by all
|
1031
|
+
steps and use `@conda` to specify step-specific additions.
|
1124
1032
|
|
1125
1033
|
|
1126
1034
|
Parameters
|
1127
1035
|
----------
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1036
|
+
packages : Dict[str, str], default {}
|
1037
|
+
Packages to use for this flow. The key is the name of the package
|
1038
|
+
and the value is the version to use.
|
1039
|
+
libraries : Dict[str, str], default {}
|
1040
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1041
|
+
python : str, optional, default None
|
1042
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1043
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1044
|
+
disabled : bool, default False
|
1045
|
+
If set to True, disables Conda.
|
1046
|
+
"""
|
1047
|
+
...
|
1048
|
+
|
1049
|
+
@typing.overload
|
1050
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1051
|
+
...
|
1052
|
+
|
1053
|
+
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):
|
1054
|
+
"""
|
1055
|
+
Specifies the Conda environment for all steps of the flow.
|
1132
1056
|
|
1133
|
-
|
1134
|
-
|
1135
|
-
`user.<username>` unless `production` is set to `True`. This can
|
1136
|
-
also be set on the command line using `--branch` as a top-level option.
|
1137
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
1057
|
+
Use `@conda_base` to set common libraries required by all
|
1058
|
+
steps and use `@conda` to specify step-specific additions.
|
1138
1059
|
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
The
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1060
|
+
|
1061
|
+
Parameters
|
1062
|
+
----------
|
1063
|
+
packages : Dict[str, str], default {}
|
1064
|
+
Packages to use for this flow. The key is the name of the package
|
1065
|
+
and the value is the version to use.
|
1066
|
+
libraries : Dict[str, str], default {}
|
1067
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1068
|
+
python : str, optional, default None
|
1069
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1070
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1071
|
+
disabled : bool, default False
|
1072
|
+
If set to True, disables Conda.
|
1150
1073
|
"""
|
1151
1074
|
...
|
1152
1075
|
|
@@ -1277,54 +1200,131 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
1277
1200
|
"""
|
1278
1201
|
...
|
1279
1202
|
|
1203
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1204
|
+
"""
|
1205
|
+
Specifies what flows belong to the same project.
|
1206
|
+
|
1207
|
+
A project-specific namespace is created for all flows that
|
1208
|
+
use the same `@project(name)`.
|
1209
|
+
|
1210
|
+
|
1211
|
+
Parameters
|
1212
|
+
----------
|
1213
|
+
name : str
|
1214
|
+
Project name. Make sure that the name is unique amongst all
|
1215
|
+
projects that use the same production scheduler. The name may
|
1216
|
+
contain only lowercase alphanumeric characters and underscores.
|
1217
|
+
|
1218
|
+
branch : Optional[str], default None
|
1219
|
+
The branch to use. If not specified, the branch is set to
|
1220
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1221
|
+
also be set on the command line using `--branch` as a top-level option.
|
1222
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1223
|
+
|
1224
|
+
production : bool, default False
|
1225
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1226
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1227
|
+
`production` in the decorator and on the command line.
|
1228
|
+
The project branch name will be:
|
1229
|
+
- if `branch` is specified:
|
1230
|
+
- if `production` is True: `prod.<branch>`
|
1231
|
+
- if `production` is False: `test.<branch>`
|
1232
|
+
- if `branch` is not specified:
|
1233
|
+
- if `production` is True: `prod`
|
1234
|
+
- if `production` is False: `user.<username>`
|
1235
|
+
"""
|
1236
|
+
...
|
1237
|
+
|
1280
1238
|
@typing.overload
|
1281
|
-
def
|
1239
|
+
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]]:
|
1282
1240
|
"""
|
1283
|
-
Specifies the
|
1284
|
-
|
1241
|
+
Specifies the event(s) that this flow depends on.
|
1242
|
+
|
1243
|
+
```
|
1244
|
+
@trigger(event='foo')
|
1245
|
+
```
|
1246
|
+
or
|
1247
|
+
```
|
1248
|
+
@trigger(events=['foo', 'bar'])
|
1249
|
+
```
|
1250
|
+
|
1251
|
+
Additionally, you can specify the parameter mappings
|
1252
|
+
to map event payload to Metaflow parameters for the flow.
|
1253
|
+
```
|
1254
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1255
|
+
```
|
1256
|
+
or
|
1257
|
+
```
|
1258
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1259
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1260
|
+
```
|
1261
|
+
|
1262
|
+
'parameters' can also be a list of strings and tuples like so:
|
1263
|
+
```
|
1264
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1265
|
+
```
|
1266
|
+
This is equivalent to:
|
1267
|
+
```
|
1268
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1269
|
+
```
|
1285
1270
|
|
1286
1271
|
|
1287
1272
|
Parameters
|
1288
1273
|
----------
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
cron : str, optional, default None
|
1296
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1297
|
-
specified by this expression.
|
1298
|
-
timezone : str, optional, default None
|
1299
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1300
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1274
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1275
|
+
Event dependency for this flow.
|
1276
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1277
|
+
Events dependency for this flow.
|
1278
|
+
options : Dict[str, Any], default {}
|
1279
|
+
Backend-specific configuration for tuning eventing behavior.
|
1301
1280
|
"""
|
1302
1281
|
...
|
1303
1282
|
|
1304
1283
|
@typing.overload
|
1305
|
-
def
|
1284
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1306
1285
|
...
|
1307
1286
|
|
1308
|
-
def
|
1287
|
+
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1309
1288
|
"""
|
1310
|
-
Specifies the
|
1311
|
-
|
1289
|
+
Specifies the event(s) that this flow depends on.
|
1290
|
+
|
1291
|
+
```
|
1292
|
+
@trigger(event='foo')
|
1293
|
+
```
|
1294
|
+
or
|
1295
|
+
```
|
1296
|
+
@trigger(events=['foo', 'bar'])
|
1297
|
+
```
|
1298
|
+
|
1299
|
+
Additionally, you can specify the parameter mappings
|
1300
|
+
to map event payload to Metaflow parameters for the flow.
|
1301
|
+
```
|
1302
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1303
|
+
```
|
1304
|
+
or
|
1305
|
+
```
|
1306
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1307
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1308
|
+
```
|
1309
|
+
|
1310
|
+
'parameters' can also be a list of strings and tuples like so:
|
1311
|
+
```
|
1312
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1313
|
+
```
|
1314
|
+
This is equivalent to:
|
1315
|
+
```
|
1316
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1317
|
+
```
|
1312
1318
|
|
1313
1319
|
|
1314
1320
|
Parameters
|
1315
1321
|
----------
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
cron : str, optional, default None
|
1323
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1324
|
-
specified by this expression.
|
1325
|
-
timezone : str, optional, default None
|
1326
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1327
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1322
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1323
|
+
Event dependency for this flow.
|
1324
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1325
|
+
Events dependency for this flow.
|
1326
|
+
options : Dict[str, Any], default {}
|
1327
|
+
Backend-specific configuration for tuning eventing behavior.
|
1328
1328
|
"""
|
1329
1329
|
...
|
1330
1330
|
|