metaflow-stubs 2.15.15__py2.py3-none-any.whl → 2.15.16__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 +595 -595
- 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 +24 -24
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/events.pyi +5 -5
- 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 +35 -35
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/multicore_utils.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 +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -5
- 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 +2 -2
- 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 +4 -4
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
- 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 +3 -3
- 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 +15 -15
- 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 +2 -2
- 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 +3 -3
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
- 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 +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 +32 -29
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +4 -4
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +3 -3
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +3 -3
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_decorators.pyi +5 -5
- metaflow-stubs/user_configs/config_options.pyi +3 -3
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.15.15.dist-info → metaflow_stubs-2.15.16.dist-info}/METADATA +2 -2
- metaflow_stubs-2.15.16.dist-info/RECORD +149 -0
- metaflow_stubs-2.15.15.dist-info/RECORD +0 -149
- {metaflow_stubs-2.15.15.dist-info → metaflow_stubs-2.15.16.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.15.15.dist-info → metaflow_stubs-2.15.16.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-
|
3
|
+
# MF version: 2.15.16 #
|
4
|
+
# Generated on 2025-06-10T23:43:51.639260 #
|
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
|
-
from . import tuple_util as tuple_util
|
40
38
|
from . import metaflow_git as metaflow_git
|
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 requirements_txt_parser as requirements_txt_parser
|
47
46
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
47
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_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,157 +147,96 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
147
147
|
...
|
148
148
|
|
149
149
|
@typing.overload
|
150
|
-
def
|
150
|
+
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]]]:
|
151
151
|
"""
|
152
|
-
Specifies
|
153
|
-
|
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.
|
152
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
153
|
+
the execution of a step.
|
158
154
|
|
159
155
|
|
160
156
|
Parameters
|
161
157
|
----------
|
162
|
-
|
163
|
-
|
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.
|
158
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
159
|
+
List of secret specs, defining how the secrets are to be retrieved
|
168
160
|
"""
|
169
161
|
...
|
170
162
|
|
171
163
|
@typing.overload
|
172
|
-
def
|
164
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
173
165
|
...
|
174
166
|
|
175
167
|
@typing.overload
|
176
|
-
def
|
168
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
177
169
|
...
|
178
170
|
|
179
|
-
def
|
171
|
+
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]]] = []):
|
180
172
|
"""
|
181
|
-
Specifies
|
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.
|
173
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
174
|
+
the execution of a step.
|
187
175
|
|
188
176
|
|
189
177
|
Parameters
|
190
178
|
----------
|
191
|
-
|
192
|
-
|
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.
|
179
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
180
|
+
List of secret specs, defining how the secrets are to be retrieved
|
197
181
|
"""
|
198
182
|
...
|
199
183
|
|
200
184
|
@typing.overload
|
201
|
-
def
|
185
|
+
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]]]:
|
202
186
|
"""
|
203
|
-
|
204
|
-
|
187
|
+
Specifies the Conda environment for the step.
|
188
|
+
|
189
|
+
Information in this decorator will augment any
|
190
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
191
|
+
you can use `@conda_base` to set packages required by all
|
192
|
+
steps and use `@conda` to specify step-specific overrides.
|
193
|
+
|
194
|
+
|
195
|
+
Parameters
|
196
|
+
----------
|
197
|
+
packages : Dict[str, str], default {}
|
198
|
+
Packages to use for this step. The key is the name of the package
|
199
|
+
and the value is the version to use.
|
200
|
+
libraries : Dict[str, str], default {}
|
201
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
202
|
+
python : str, optional, default None
|
203
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
204
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
205
|
+
disabled : bool, default False
|
206
|
+
If set to True, disables @conda.
|
205
207
|
"""
|
206
208
|
...
|
207
209
|
|
208
210
|
@typing.overload
|
209
|
-
def
|
211
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
210
212
|
...
|
211
213
|
|
212
|
-
|
213
|
-
|
214
|
-
Decorator prototype for all step decorators. This function gets specialized
|
215
|
-
and imported for all decorators types by _import_plugin_decorators().
|
216
|
-
"""
|
214
|
+
@typing.overload
|
215
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
217
216
|
...
|
218
217
|
|
219
|
-
def
|
218
|
+
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):
|
220
219
|
"""
|
221
|
-
Specifies
|
220
|
+
Specifies the Conda environment for the step.
|
221
|
+
|
222
|
+
Information in this decorator will augment any
|
223
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
224
|
+
you can use `@conda_base` to set packages required by all
|
225
|
+
steps and use `@conda` to specify step-specific overrides.
|
222
226
|
|
223
227
|
|
224
228
|
Parameters
|
225
229
|
----------
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
used.
|
237
|
-
image : str, optional, default None
|
238
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
239
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
240
|
-
not, a default Docker image mapping to the current version of Python is used.
|
241
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
242
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
243
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
244
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
245
|
-
secrets : List[str], optional, default None
|
246
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
247
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
248
|
-
in Metaflow configuration.
|
249
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
250
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
251
|
-
Can be passed in as a comma separated string of values e.g.
|
252
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
253
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
254
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
255
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
256
|
-
gpu : int, optional, default None
|
257
|
-
Number of GPUs required for this step. A value of zero implies that
|
258
|
-
the scheduled node should not have GPUs.
|
259
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
260
|
-
The vendor of the GPUs to be used for this step.
|
261
|
-
tolerations : List[str], default []
|
262
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
263
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
264
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
265
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
266
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
267
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
268
|
-
use_tmpfs : bool, default False
|
269
|
-
This enables an explicit tmpfs mount for this step.
|
270
|
-
tmpfs_tempdir : bool, default True
|
271
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
272
|
-
tmpfs_size : int, optional, default: None
|
273
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
274
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
275
|
-
memory allocated for this step.
|
276
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
277
|
-
Path to tmpfs mount for this step.
|
278
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
279
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
280
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
281
|
-
shared_memory: int, optional
|
282
|
-
Shared memory size (in MiB) required for this step
|
283
|
-
port: int, optional
|
284
|
-
Port number to specify in the Kubernetes job object
|
285
|
-
compute_pool : str, optional, default None
|
286
|
-
Compute pool to be used for for this step.
|
287
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
288
|
-
hostname_resolution_timeout: int, default 10 * 60
|
289
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
290
|
-
Only applicable when @parallel is used.
|
291
|
-
qos: str, default: Burstable
|
292
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
293
|
-
|
294
|
-
security_context: Dict[str, Any], optional, default None
|
295
|
-
Container security context. Applies to the task container. Allows the following keys:
|
296
|
-
- privileged: bool, optional, default None
|
297
|
-
- allow_privilege_escalation: bool, optional, default None
|
298
|
-
- run_as_user: int, optional, default None
|
299
|
-
- run_as_group: int, optional, default None
|
300
|
-
- run_as_non_root: bool, optional, default None
|
230
|
+
packages : Dict[str, str], default {}
|
231
|
+
Packages to use for this step. The key is the name of the package
|
232
|
+
and the value is the version to use.
|
233
|
+
libraries : Dict[str, str], default {}
|
234
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
235
|
+
python : str, optional, default None
|
236
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
237
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
238
|
+
disabled : bool, default False
|
239
|
+
If set to True, disables @conda.
|
301
240
|
"""
|
302
241
|
...
|
303
242
|
|
@@ -500,145 +439,146 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
500
439
|
...
|
501
440
|
|
502
441
|
@typing.overload
|
503
|
-
def
|
442
|
+
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]]]:
|
504
443
|
"""
|
505
|
-
Specifies
|
444
|
+
Specifies a timeout for your step.
|
506
445
|
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
446
|
+
This decorator is useful if this step may hang indefinitely.
|
447
|
+
|
448
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
449
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
450
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
451
|
+
|
452
|
+
Note that all the values specified in parameters are added together so if you specify
|
453
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
511
454
|
|
512
455
|
|
513
456
|
Parameters
|
514
457
|
----------
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
458
|
+
seconds : int, default 0
|
459
|
+
Number of seconds to wait prior to timing out.
|
460
|
+
minutes : int, default 0
|
461
|
+
Number of minutes to wait prior to timing out.
|
462
|
+
hours : int, default 0
|
463
|
+
Number of hours to wait prior to timing out.
|
521
464
|
"""
|
522
465
|
...
|
523
466
|
|
524
467
|
@typing.overload
|
525
|
-
def
|
468
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
526
469
|
...
|
527
470
|
|
528
471
|
@typing.overload
|
529
|
-
def
|
472
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
530
473
|
...
|
531
474
|
|
532
|
-
def
|
475
|
+
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):
|
533
476
|
"""
|
534
|
-
Specifies
|
477
|
+
Specifies a timeout for your step.
|
535
478
|
|
536
|
-
|
537
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
538
|
-
you can use `@pypi_base` to set packages required by all
|
539
|
-
steps and use `@pypi` to specify step-specific overrides.
|
479
|
+
This decorator is useful if this step may hang indefinitely.
|
540
480
|
|
481
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
482
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
483
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
541
484
|
|
542
|
-
|
543
|
-
|
544
|
-
packages : Dict[str, str], default: {}
|
545
|
-
Packages to use for this step. The key is the name of the package
|
546
|
-
and the value is the version to use.
|
547
|
-
python : str, optional, default: None
|
548
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
549
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
550
|
-
"""
|
551
|
-
...
|
552
|
-
|
553
|
-
@typing.overload
|
554
|
-
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]]]:
|
555
|
-
"""
|
556
|
-
Specifies environment variables to be set prior to the execution of a step.
|
485
|
+
Note that all the values specified in parameters are added together so if you specify
|
486
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
557
487
|
|
558
488
|
|
559
489
|
Parameters
|
560
490
|
----------
|
561
|
-
|
562
|
-
|
491
|
+
seconds : int, default 0
|
492
|
+
Number of seconds to wait prior to timing out.
|
493
|
+
minutes : int, default 0
|
494
|
+
Number of minutes to wait prior to timing out.
|
495
|
+
hours : int, default 0
|
496
|
+
Number of hours to wait prior to timing out.
|
563
497
|
"""
|
564
498
|
...
|
565
499
|
|
566
|
-
|
567
|
-
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
568
|
-
...
|
569
|
-
|
570
|
-
@typing.overload
|
571
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
572
|
-
...
|
573
|
-
|
574
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
500
|
+
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]]]:
|
575
501
|
"""
|
576
|
-
Specifies
|
502
|
+
Specifies that this step should execute on Kubernetes.
|
577
503
|
|
578
504
|
|
579
505
|
Parameters
|
580
506
|
----------
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
507
|
+
cpu : int, default 1
|
508
|
+
Number of CPUs required for this step. If `@resources` is
|
509
|
+
also present, the maximum value from all decorators is used.
|
510
|
+
memory : int, default 4096
|
511
|
+
Memory size (in MB) required for this step. If
|
512
|
+
`@resources` is also present, the maximum value from all decorators is
|
513
|
+
used.
|
514
|
+
disk : int, default 10240
|
515
|
+
Disk size (in MB) required for this step. If
|
516
|
+
`@resources` is also present, the maximum value from all decorators is
|
517
|
+
used.
|
518
|
+
image : str, optional, default None
|
519
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
520
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
521
|
+
not, a default Docker image mapping to the current version of Python is used.
|
522
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
523
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
524
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
525
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
526
|
+
secrets : List[str], optional, default None
|
527
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
528
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
529
|
+
in Metaflow configuration.
|
530
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
531
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
532
|
+
Can be passed in as a comma separated string of values e.g.
|
533
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
534
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
535
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
536
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
537
|
+
gpu : int, optional, default None
|
538
|
+
Number of GPUs required for this step. A value of zero implies that
|
539
|
+
the scheduled node should not have GPUs.
|
540
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
541
|
+
The vendor of the GPUs to be used for this step.
|
542
|
+
tolerations : List[str], default []
|
543
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
544
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
545
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
546
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
547
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
548
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
549
|
+
use_tmpfs : bool, default False
|
550
|
+
This enables an explicit tmpfs mount for this step.
|
551
|
+
tmpfs_tempdir : bool, default True
|
552
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
553
|
+
tmpfs_size : int, optional, default: None
|
554
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
555
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
556
|
+
memory allocated for this step.
|
557
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
558
|
+
Path to tmpfs mount for this step.
|
559
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
560
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
561
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
562
|
+
shared_memory: int, optional
|
563
|
+
Shared memory size (in MiB) required for this step
|
564
|
+
port: int, optional
|
565
|
+
Port number to specify in the Kubernetes job object
|
566
|
+
compute_pool : str, optional, default None
|
567
|
+
Compute pool to be used for for this step.
|
568
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
569
|
+
hostname_resolution_timeout: int, default 10 * 60
|
570
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
571
|
+
Only applicable when @parallel is used.
|
572
|
+
qos: str, default: Burstable
|
573
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
629
574
|
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
python : str, optional, default None
|
638
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
639
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
640
|
-
disabled : bool, default False
|
641
|
-
If set to True, disables @conda.
|
575
|
+
security_context: Dict[str, Any], optional, default None
|
576
|
+
Container security context. Applies to the task container. Allows the following keys:
|
577
|
+
- privileged: bool, optional, default None
|
578
|
+
- allow_privilege_escalation: bool, optional, default None
|
579
|
+
- run_as_user: int, optional, default None
|
580
|
+
- run_as_group: int, optional, default None
|
581
|
+
- run_as_non_root: bool, optional, default None
|
642
582
|
"""
|
643
583
|
...
|
644
584
|
|
@@ -698,445 +638,286 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
698
638
|
...
|
699
639
|
|
700
640
|
@typing.overload
|
701
|
-
def
|
641
|
+
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]]]:
|
702
642
|
"""
|
703
|
-
Specifies the
|
704
|
-
|
705
|
-
Use `@resources` to specify the resource requirements
|
706
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
643
|
+
Specifies the PyPI packages for the step.
|
707
644
|
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
or
|
713
|
-
```
|
714
|
-
python myflow.py run --with kubernetes
|
715
|
-
```
|
716
|
-
which executes the flow on the desired system using the
|
717
|
-
requirements specified in `@resources`.
|
645
|
+
Information in this decorator will augment any
|
646
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
647
|
+
you can use `@pypi_base` to set packages required by all
|
648
|
+
steps and use `@pypi` to specify step-specific overrides.
|
718
649
|
|
719
650
|
|
720
651
|
Parameters
|
721
652
|
----------
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
memory : int, default 4096
|
729
|
-
Memory size (in MB) required for this step.
|
730
|
-
shared_memory : int, optional, default None
|
731
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
732
|
-
This parameter maps to the `--shm-size` option in Docker.
|
653
|
+
packages : Dict[str, str], default: {}
|
654
|
+
Packages to use for this step. The key is the name of the package
|
655
|
+
and the value is the version to use.
|
656
|
+
python : str, optional, default: None
|
657
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
658
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
733
659
|
"""
|
734
660
|
...
|
735
661
|
|
736
662
|
@typing.overload
|
737
|
-
def
|
663
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
738
664
|
...
|
739
665
|
|
740
666
|
@typing.overload
|
741
|
-
def
|
667
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
742
668
|
...
|
743
669
|
|
744
|
-
def
|
670
|
+
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):
|
745
671
|
"""
|
746
|
-
Specifies the
|
747
|
-
|
748
|
-
Use `@resources` to specify the resource requirements
|
749
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
672
|
+
Specifies the PyPI packages for the step.
|
750
673
|
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
or
|
756
|
-
```
|
757
|
-
python myflow.py run --with kubernetes
|
758
|
-
```
|
759
|
-
which executes the flow on the desired system using the
|
760
|
-
requirements specified in `@resources`.
|
674
|
+
Information in this decorator will augment any
|
675
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
676
|
+
you can use `@pypi_base` to set packages required by all
|
677
|
+
steps and use `@pypi` to specify step-specific overrides.
|
761
678
|
|
762
679
|
|
763
680
|
Parameters
|
764
681
|
----------
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
memory : int, default 4096
|
772
|
-
Memory size (in MB) required for this step.
|
773
|
-
shared_memory : int, optional, default None
|
774
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
775
|
-
This parameter maps to the `--shm-size` option in Docker.
|
682
|
+
packages : Dict[str, str], default: {}
|
683
|
+
Packages to use for this step. The key is the name of the package
|
684
|
+
and the value is the version to use.
|
685
|
+
python : str, optional, default: None
|
686
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
687
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
776
688
|
"""
|
777
689
|
...
|
778
690
|
|
779
691
|
@typing.overload
|
780
|
-
def
|
692
|
+
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]]]:
|
781
693
|
"""
|
782
|
-
Specifies
|
783
|
-
the execution of a step.
|
694
|
+
Specifies environment variables to be set prior to the execution of a step.
|
784
695
|
|
785
696
|
|
786
697
|
Parameters
|
787
698
|
----------
|
788
|
-
|
789
|
-
|
699
|
+
vars : Dict[str, str], default {}
|
700
|
+
Dictionary of environment variables to set.
|
790
701
|
"""
|
791
702
|
...
|
792
703
|
|
793
704
|
@typing.overload
|
794
|
-
def
|
705
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
795
706
|
...
|
796
707
|
|
797
708
|
@typing.overload
|
798
|
-
def
|
709
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
799
710
|
...
|
800
711
|
|
801
|
-
def
|
712
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
802
713
|
"""
|
803
|
-
Specifies
|
804
|
-
the execution of a step.
|
714
|
+
Specifies environment variables to be set prior to the execution of a step.
|
805
715
|
|
806
716
|
|
807
717
|
Parameters
|
808
718
|
----------
|
809
|
-
|
810
|
-
|
719
|
+
vars : Dict[str, str], default {}
|
720
|
+
Dictionary of environment variables to set.
|
811
721
|
"""
|
812
722
|
...
|
813
723
|
|
814
724
|
@typing.overload
|
815
|
-
def
|
725
|
+
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
726
|
"""
|
817
|
-
Specifies
|
818
|
-
|
819
|
-
This decorator is useful if this step may hang indefinitely.
|
820
|
-
|
821
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
822
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
823
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
727
|
+
Specifies that the step will success under all circumstances.
|
824
728
|
|
825
|
-
|
826
|
-
|
729
|
+
The decorator will create an optional artifact, specified by `var`, which
|
730
|
+
contains the exception raised. You can use it to detect the presence
|
731
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
732
|
+
are missing.
|
827
733
|
|
828
734
|
|
829
735
|
Parameters
|
830
736
|
----------
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
737
|
+
var : str, optional, default None
|
738
|
+
Name of the artifact in which to store the caught exception.
|
739
|
+
If not specified, the exception is not stored.
|
740
|
+
print_exception : bool, default True
|
741
|
+
Determines whether or not the exception is printed to
|
742
|
+
stdout when caught.
|
837
743
|
"""
|
838
744
|
...
|
839
745
|
|
840
746
|
@typing.overload
|
841
|
-
def
|
747
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
842
748
|
...
|
843
749
|
|
844
750
|
@typing.overload
|
845
|
-
def
|
846
|
-
...
|
847
|
-
|
848
|
-
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):
|
849
|
-
"""
|
850
|
-
Specifies a timeout for your step.
|
851
|
-
|
852
|
-
This decorator is useful if this step may hang indefinitely.
|
853
|
-
|
854
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
855
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
856
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
857
|
-
|
858
|
-
Note that all the values specified in parameters are added together so if you specify
|
859
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
860
|
-
|
861
|
-
|
862
|
-
Parameters
|
863
|
-
----------
|
864
|
-
seconds : int, default 0
|
865
|
-
Number of seconds to wait prior to timing out.
|
866
|
-
minutes : int, default 0
|
867
|
-
Number of minutes to wait prior to timing out.
|
868
|
-
hours : int, default 0
|
869
|
-
Number of hours to wait prior to timing out.
|
870
|
-
"""
|
751
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
871
752
|
...
|
872
753
|
|
873
|
-
|
874
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
754
|
+
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):
|
875
755
|
"""
|
876
|
-
Specifies the
|
877
|
-
|
878
|
-
Use `@pypi_base` to set common packages required by all
|
879
|
-
steps and use `@pypi` to specify step-specific overrides.
|
756
|
+
Specifies that the step will success under all circumstances.
|
880
757
|
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
and the value is the version to use.
|
886
|
-
python : str, optional, default: None
|
887
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
888
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
889
|
-
"""
|
890
|
-
...
|
891
|
-
|
892
|
-
@typing.overload
|
893
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
894
|
-
...
|
895
|
-
|
896
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
897
|
-
"""
|
898
|
-
Specifies the PyPI packages for all steps of the flow.
|
758
|
+
The decorator will create an optional artifact, specified by `var`, which
|
759
|
+
contains the exception raised. You can use it to detect the presence
|
760
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
761
|
+
are missing.
|
899
762
|
|
900
|
-
Use `@pypi_base` to set common packages required by all
|
901
|
-
steps and use `@pypi` to specify step-specific overrides.
|
902
763
|
|
903
764
|
Parameters
|
904
765
|
----------
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
766
|
+
var : str, optional, default None
|
767
|
+
Name of the artifact in which to store the caught exception.
|
768
|
+
If not specified, the exception is not stored.
|
769
|
+
print_exception : bool, default True
|
770
|
+
Determines whether or not the exception is printed to
|
771
|
+
stdout when caught.
|
911
772
|
"""
|
912
773
|
...
|
913
774
|
|
914
775
|
@typing.overload
|
915
|
-
def
|
776
|
+
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]]]:
|
916
777
|
"""
|
917
|
-
Specifies the
|
778
|
+
Specifies the resources needed when executing this step.
|
918
779
|
|
919
|
-
|
920
|
-
|
921
|
-
```
|
922
|
-
or
|
923
|
-
```
|
924
|
-
@trigger(events=['foo', 'bar'])
|
925
|
-
```
|
780
|
+
Use `@resources` to specify the resource requirements
|
781
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
926
782
|
|
927
|
-
|
928
|
-
to map event payload to Metaflow parameters for the flow.
|
783
|
+
You can choose the compute layer on the command line by executing e.g.
|
929
784
|
```
|
930
|
-
|
785
|
+
python myflow.py run --with batch
|
931
786
|
```
|
932
787
|
or
|
933
788
|
```
|
934
|
-
|
935
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
936
|
-
```
|
937
|
-
|
938
|
-
'parameters' can also be a list of strings and tuples like so:
|
939
|
-
```
|
940
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
941
|
-
```
|
942
|
-
This is equivalent to:
|
943
|
-
```
|
944
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
789
|
+
python myflow.py run --with kubernetes
|
945
790
|
```
|
791
|
+
which executes the flow on the desired system using the
|
792
|
+
requirements specified in `@resources`.
|
946
793
|
|
947
794
|
|
948
795
|
Parameters
|
949
796
|
----------
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
797
|
+
cpu : int, default 1
|
798
|
+
Number of CPUs required for this step.
|
799
|
+
gpu : int, optional, default None
|
800
|
+
Number of GPUs required for this step.
|
801
|
+
disk : int, optional, default None
|
802
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
803
|
+
memory : int, default 4096
|
804
|
+
Memory size (in MB) required for this step.
|
805
|
+
shared_memory : int, optional, default None
|
806
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
807
|
+
This parameter maps to the `--shm-size` option in Docker.
|
956
808
|
"""
|
957
809
|
...
|
958
810
|
|
959
811
|
@typing.overload
|
960
|
-
def
|
812
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
961
813
|
...
|
962
814
|
|
963
|
-
|
815
|
+
@typing.overload
|
816
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
817
|
+
...
|
818
|
+
|
819
|
+
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):
|
964
820
|
"""
|
965
|
-
Specifies the
|
821
|
+
Specifies the resources needed when executing this step.
|
966
822
|
|
967
|
-
|
968
|
-
|
969
|
-
```
|
970
|
-
or
|
971
|
-
```
|
972
|
-
@trigger(events=['foo', 'bar'])
|
973
|
-
```
|
823
|
+
Use `@resources` to specify the resource requirements
|
824
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
974
825
|
|
975
|
-
|
976
|
-
to map event payload to Metaflow parameters for the flow.
|
826
|
+
You can choose the compute layer on the command line by executing e.g.
|
977
827
|
```
|
978
|
-
|
828
|
+
python myflow.py run --with batch
|
979
829
|
```
|
980
830
|
or
|
981
831
|
```
|
982
|
-
|
983
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
984
|
-
```
|
985
|
-
|
986
|
-
'parameters' can also be a list of strings and tuples like so:
|
987
|
-
```
|
988
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
989
|
-
```
|
990
|
-
This is equivalent to:
|
991
|
-
```
|
992
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
832
|
+
python myflow.py run --with kubernetes
|
993
833
|
```
|
834
|
+
which executes the flow on the desired system using the
|
835
|
+
requirements specified in `@resources`.
|
994
836
|
|
995
837
|
|
996
838
|
Parameters
|
997
839
|
----------
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
840
|
+
cpu : int, default 1
|
841
|
+
Number of CPUs required for this step.
|
842
|
+
gpu : int, optional, default None
|
843
|
+
Number of GPUs required for this step.
|
844
|
+
disk : int, optional, default None
|
845
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
846
|
+
memory : int, default 4096
|
847
|
+
Memory size (in MB) required for this step.
|
848
|
+
shared_memory : int, optional, default None
|
849
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
850
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1004
851
|
"""
|
1005
852
|
...
|
1006
853
|
|
1007
854
|
@typing.overload
|
1008
|
-
def
|
855
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1009
856
|
"""
|
1010
|
-
|
1011
|
-
|
1012
|
-
```
|
1013
|
-
@trigger_on_finish(flow='FooFlow')
|
1014
|
-
```
|
1015
|
-
or
|
1016
|
-
```
|
1017
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1018
|
-
```
|
1019
|
-
This decorator respects the @project decorator and triggers the flow
|
1020
|
-
when upstream runs within the same namespace complete successfully
|
1021
|
-
|
1022
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1023
|
-
by specifying the fully qualified project_flow_name.
|
1024
|
-
```
|
1025
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1026
|
-
```
|
1027
|
-
or
|
1028
|
-
```
|
1029
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1030
|
-
```
|
1031
|
-
|
1032
|
-
You can also specify just the project or project branch (other values will be
|
1033
|
-
inferred from the current project or project branch):
|
1034
|
-
```
|
1035
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1036
|
-
```
|
1037
|
-
|
1038
|
-
Note that `branch` is typically one of:
|
1039
|
-
- `prod`
|
1040
|
-
- `user.bob`
|
1041
|
-
- `test.my_experiment`
|
1042
|
-
- `prod.staging`
|
1043
|
-
|
1044
|
-
|
1045
|
-
Parameters
|
1046
|
-
----------
|
1047
|
-
flow : Union[str, Dict[str, str]], optional, default None
|
1048
|
-
Upstream flow dependency for this flow.
|
1049
|
-
flows : List[Union[str, Dict[str, str]]], default []
|
1050
|
-
Upstream flow dependencies for this flow.
|
1051
|
-
options : Dict[str, Any], default {}
|
1052
|
-
Backend-specific configuration for tuning eventing behavior.
|
857
|
+
Decorator prototype for all step decorators. This function gets specialized
|
858
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1053
859
|
"""
|
1054
860
|
...
|
1055
861
|
|
1056
862
|
@typing.overload
|
1057
|
-
def
|
863
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1058
864
|
...
|
1059
865
|
|
1060
|
-
def
|
866
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1061
867
|
"""
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
This decorator respects the @project decorator and triggers the flow
|
1072
|
-
when upstream runs within the same namespace complete successfully
|
1073
|
-
|
1074
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1075
|
-
by specifying the fully qualified project_flow_name.
|
1076
|
-
```
|
1077
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1078
|
-
```
|
1079
|
-
or
|
1080
|
-
```
|
1081
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1082
|
-
```
|
1083
|
-
|
1084
|
-
You can also specify just the project or project branch (other values will be
|
1085
|
-
inferred from the current project or project branch):
|
1086
|
-
```
|
1087
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1088
|
-
```
|
868
|
+
Decorator prototype for all step decorators. This function gets specialized
|
869
|
+
and imported for all decorators types by _import_plugin_decorators().
|
870
|
+
"""
|
871
|
+
...
|
872
|
+
|
873
|
+
@typing.overload
|
874
|
+
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]]:
|
875
|
+
"""
|
876
|
+
Specifies the Conda environment for all steps of the flow.
|
1089
877
|
|
1090
|
-
|
1091
|
-
|
1092
|
-
- `user.bob`
|
1093
|
-
- `test.my_experiment`
|
1094
|
-
- `prod.staging`
|
878
|
+
Use `@conda_base` to set common libraries required by all
|
879
|
+
steps and use `@conda` to specify step-specific additions.
|
1095
880
|
|
1096
881
|
|
1097
882
|
Parameters
|
1098
883
|
----------
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
884
|
+
packages : Dict[str, str], default {}
|
885
|
+
Packages to use for this flow. The key is the name of the package
|
886
|
+
and the value is the version to use.
|
887
|
+
libraries : Dict[str, str], default {}
|
888
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
889
|
+
python : str, optional, default None
|
890
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
891
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
892
|
+
disabled : bool, default False
|
893
|
+
If set to True, disables Conda.
|
1105
894
|
"""
|
1106
895
|
...
|
1107
896
|
|
1108
|
-
|
897
|
+
@typing.overload
|
898
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
899
|
+
...
|
900
|
+
|
901
|
+
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):
|
1109
902
|
"""
|
1110
|
-
Specifies
|
903
|
+
Specifies the Conda environment for all steps of the flow.
|
1111
904
|
|
1112
|
-
|
1113
|
-
use
|
905
|
+
Use `@conda_base` to set common libraries required by all
|
906
|
+
steps and use `@conda` to specify step-specific additions.
|
1114
907
|
|
1115
908
|
|
1116
909
|
Parameters
|
1117
910
|
----------
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
production : bool, default False
|
1130
|
-
Whether or not the branch is the production branch. This can also be set on the
|
1131
|
-
command line using `--production` as a top-level option. It is an error to specify
|
1132
|
-
`production` in the decorator and on the command line.
|
1133
|
-
The project branch name will be:
|
1134
|
-
- if `branch` is specified:
|
1135
|
-
- if `production` is True: `prod.<branch>`
|
1136
|
-
- if `production` is False: `test.<branch>`
|
1137
|
-
- if `branch` is not specified:
|
1138
|
-
- if `production` is True: `prod`
|
1139
|
-
- if `production` is False: `user.<username>`
|
911
|
+
packages : Dict[str, str], default {}
|
912
|
+
Packages to use for this flow. The key is the name of the package
|
913
|
+
and the value is the version to use.
|
914
|
+
libraries : Dict[str, str], default {}
|
915
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
916
|
+
python : str, optional, default None
|
917
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
918
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
919
|
+
disabled : bool, default False
|
920
|
+
If set to True, disables Conda.
|
1140
921
|
"""
|
1141
922
|
...
|
1142
923
|
|
@@ -1183,97 +964,180 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
1183
964
|
"""
|
1184
965
|
...
|
1185
966
|
|
1186
|
-
def
|
967
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
968
|
+
"""
|
969
|
+
Specifies what flows belong to the same project.
|
970
|
+
|
971
|
+
A project-specific namespace is created for all flows that
|
972
|
+
use the same `@project(name)`.
|
973
|
+
|
974
|
+
|
975
|
+
Parameters
|
976
|
+
----------
|
977
|
+
name : str
|
978
|
+
Project name. Make sure that the name is unique amongst all
|
979
|
+
projects that use the same production scheduler. The name may
|
980
|
+
contain only lowercase alphanumeric characters and underscores.
|
981
|
+
|
982
|
+
branch : Optional[str], default None
|
983
|
+
The branch to use. If not specified, the branch is set to
|
984
|
+
`user.<username>` unless `production` is set to `True`. This can
|
985
|
+
also be set on the command line using `--branch` as a top-level option.
|
986
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
987
|
+
|
988
|
+
production : bool, default False
|
989
|
+
Whether or not the branch is the production branch. This can also be set on the
|
990
|
+
command line using `--production` as a top-level option. It is an error to specify
|
991
|
+
`production` in the decorator and on the command line.
|
992
|
+
The project branch name will be:
|
993
|
+
- if `branch` is specified:
|
994
|
+
- if `production` is True: `prod.<branch>`
|
995
|
+
- if `production` is False: `test.<branch>`
|
996
|
+
- if `branch` is not specified:
|
997
|
+
- if `production` is True: `prod`
|
998
|
+
- if `production` is False: `user.<username>`
|
999
|
+
"""
|
1000
|
+
...
|
1001
|
+
|
1002
|
+
@typing.overload
|
1003
|
+
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1004
|
+
"""
|
1005
|
+
Specifies the flow(s) that this flow depends on.
|
1006
|
+
|
1007
|
+
```
|
1008
|
+
@trigger_on_finish(flow='FooFlow')
|
1009
|
+
```
|
1010
|
+
or
|
1011
|
+
```
|
1012
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1013
|
+
```
|
1014
|
+
This decorator respects the @project decorator and triggers the flow
|
1015
|
+
when upstream runs within the same namespace complete successfully
|
1016
|
+
|
1017
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1018
|
+
by specifying the fully qualified project_flow_name.
|
1019
|
+
```
|
1020
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1021
|
+
```
|
1022
|
+
or
|
1023
|
+
```
|
1024
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1025
|
+
```
|
1026
|
+
|
1027
|
+
You can also specify just the project or project branch (other values will be
|
1028
|
+
inferred from the current project or project branch):
|
1029
|
+
```
|
1030
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1031
|
+
```
|
1032
|
+
|
1033
|
+
Note that `branch` is typically one of:
|
1034
|
+
- `prod`
|
1035
|
+
- `user.bob`
|
1036
|
+
- `test.my_experiment`
|
1037
|
+
- `prod.staging`
|
1038
|
+
|
1039
|
+
|
1040
|
+
Parameters
|
1041
|
+
----------
|
1042
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1043
|
+
Upstream flow dependency for this flow.
|
1044
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1045
|
+
Upstream flow dependencies for this flow.
|
1046
|
+
options : Dict[str, Any], default {}
|
1047
|
+
Backend-specific configuration for tuning eventing behavior.
|
1048
|
+
"""
|
1049
|
+
...
|
1050
|
+
|
1051
|
+
@typing.overload
|
1052
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1053
|
+
...
|
1054
|
+
|
1055
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1187
1056
|
"""
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1057
|
+
Specifies the flow(s) that this flow depends on.
|
1058
|
+
|
1059
|
+
```
|
1060
|
+
@trigger_on_finish(flow='FooFlow')
|
1061
|
+
```
|
1062
|
+
or
|
1063
|
+
```
|
1064
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1065
|
+
```
|
1066
|
+
This decorator respects the @project decorator and triggers the flow
|
1067
|
+
when upstream runs within the same namespace complete successfully
|
1068
|
+
|
1069
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1070
|
+
by specifying the fully qualified project_flow_name.
|
1071
|
+
```
|
1072
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1073
|
+
```
|
1074
|
+
or
|
1075
|
+
```
|
1076
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1077
|
+
```
|
1078
|
+
|
1079
|
+
You can also specify just the project or project branch (other values will be
|
1080
|
+
inferred from the current project or project branch):
|
1081
|
+
```
|
1082
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1083
|
+
```
|
1084
|
+
|
1085
|
+
Note that `branch` is typically one of:
|
1086
|
+
- `prod`
|
1087
|
+
- `user.bob`
|
1088
|
+
- `test.my_experiment`
|
1089
|
+
- `prod.staging`
|
1193
1090
|
|
1194
1091
|
|
1195
1092
|
Parameters
|
1196
1093
|
----------
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
exponential_backoff : bool
|
1204
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1205
|
-
pool : str
|
1206
|
-
the slot pool this task should run in,
|
1207
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1208
|
-
soft_fail : bool
|
1209
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1210
|
-
name : str
|
1211
|
-
Name of the sensor on Airflow
|
1212
|
-
description : str
|
1213
|
-
Description of sensor in the Airflow UI
|
1214
|
-
bucket_key : Union[str, List[str]]
|
1215
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1216
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1217
|
-
bucket_name : str
|
1218
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1219
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1220
|
-
wildcard_match : bool
|
1221
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1222
|
-
aws_conn_id : str
|
1223
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1224
|
-
verify : bool
|
1225
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1094
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1095
|
+
Upstream flow dependency for this flow.
|
1096
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1097
|
+
Upstream flow dependencies for this flow.
|
1098
|
+
options : Dict[str, Any], default {}
|
1099
|
+
Backend-specific configuration for tuning eventing behavior.
|
1226
1100
|
"""
|
1227
1101
|
...
|
1228
1102
|
|
1229
1103
|
@typing.overload
|
1230
|
-
def
|
1104
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1231
1105
|
"""
|
1232
|
-
Specifies the
|
1233
|
-
|
1234
|
-
Use `@conda_base` to set common libraries required by all
|
1235
|
-
steps and use `@conda` to specify step-specific additions.
|
1106
|
+
Specifies the PyPI packages for all steps of the flow.
|
1236
1107
|
|
1108
|
+
Use `@pypi_base` to set common packages required by all
|
1109
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1237
1110
|
|
1238
1111
|
Parameters
|
1239
1112
|
----------
|
1240
|
-
packages : Dict[str, str], default {}
|
1113
|
+
packages : Dict[str, str], default: {}
|
1241
1114
|
Packages to use for this flow. The key is the name of the package
|
1242
1115
|
and the value is the version to use.
|
1243
|
-
|
1244
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1245
|
-
python : str, optional, default None
|
1116
|
+
python : str, optional, default: None
|
1246
1117
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1247
1118
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1248
|
-
disabled : bool, default False
|
1249
|
-
If set to True, disables Conda.
|
1250
1119
|
"""
|
1251
1120
|
...
|
1252
1121
|
|
1253
1122
|
@typing.overload
|
1254
|
-
def
|
1123
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1255
1124
|
...
|
1256
1125
|
|
1257
|
-
def
|
1126
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1258
1127
|
"""
|
1259
|
-
Specifies the
|
1260
|
-
|
1261
|
-
Use `@conda_base` to set common libraries required by all
|
1262
|
-
steps and use `@conda` to specify step-specific additions.
|
1128
|
+
Specifies the PyPI packages for all steps of the flow.
|
1263
1129
|
|
1130
|
+
Use `@pypi_base` to set common packages required by all
|
1131
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1264
1132
|
|
1265
1133
|
Parameters
|
1266
1134
|
----------
|
1267
|
-
packages : Dict[str, str], default {}
|
1135
|
+
packages : Dict[str, str], default: {}
|
1268
1136
|
Packages to use for this flow. The key is the name of the package
|
1269
1137
|
and the value is the version to use.
|
1270
|
-
|
1271
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1272
|
-
python : str, optional, default None
|
1138
|
+
python : str, optional, default: None
|
1273
1139
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1274
1140
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1275
|
-
disabled : bool, default False
|
1276
|
-
If set to True, disables Conda.
|
1277
1141
|
"""
|
1278
1142
|
...
|
1279
1143
|
|
@@ -1328,3 +1192,139 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1328
1192
|
"""
|
1329
1193
|
...
|
1330
1194
|
|
1195
|
+
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]]:
|
1196
|
+
"""
|
1197
|
+
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)
|
1198
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1199
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1200
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1201
|
+
starts only after all sensors finish.
|
1202
|
+
|
1203
|
+
|
1204
|
+
Parameters
|
1205
|
+
----------
|
1206
|
+
timeout : int
|
1207
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1208
|
+
poke_interval : int
|
1209
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1210
|
+
mode : str
|
1211
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1212
|
+
exponential_backoff : bool
|
1213
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1214
|
+
pool : str
|
1215
|
+
the slot pool this task should run in,
|
1216
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1217
|
+
soft_fail : bool
|
1218
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1219
|
+
name : str
|
1220
|
+
Name of the sensor on Airflow
|
1221
|
+
description : str
|
1222
|
+
Description of sensor in the Airflow UI
|
1223
|
+
bucket_key : Union[str, List[str]]
|
1224
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1225
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1226
|
+
bucket_name : str
|
1227
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1228
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1229
|
+
wildcard_match : bool
|
1230
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1231
|
+
aws_conn_id : str
|
1232
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1233
|
+
verify : bool
|
1234
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1235
|
+
"""
|
1236
|
+
...
|
1237
|
+
|
1238
|
+
@typing.overload
|
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]]:
|
1240
|
+
"""
|
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
|
+
```
|
1270
|
+
|
1271
|
+
|
1272
|
+
Parameters
|
1273
|
+
----------
|
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.
|
1280
|
+
"""
|
1281
|
+
...
|
1282
|
+
|
1283
|
+
@typing.overload
|
1284
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1285
|
+
...
|
1286
|
+
|
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] = {}):
|
1288
|
+
"""
|
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
|
+
```
|
1318
|
+
|
1319
|
+
|
1320
|
+
Parameters
|
1321
|
+
----------
|
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
|
+
"""
|
1329
|
+
...
|
1330
|
+
|