metaflow-stubs 2.14.2__py2.py3-none-any.whl → 2.15.0__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 +567 -567
- 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 +6 -6
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +2 -2
- 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 +4 -2
- metaflow-stubs/metaflow_current.pyi +17 -17
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +2 -2
- metaflow-stubs/plugins/__init__.pyi +13 -13
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/aws/__init__.pyi +3 -3
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +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 +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 +4 -4
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +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 +4 -4
- 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 +4 -4
- 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 +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 +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +3 -3
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +4 -4
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- 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 +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +4 -4
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.14.2.dist-info → metaflow_stubs-2.15.0.dist-info}/METADATA +2 -2
- metaflow_stubs-2.15.0.dist-info/RECORD +145 -0
- {metaflow_stubs-2.14.2.dist-info → metaflow_stubs-2.15.0.dist-info}/WHEEL +1 -1
- metaflow_stubs-2.14.2.dist-info/RECORD +0 -145
- {metaflow_stubs-2.14.2.dist-info → metaflow_stubs-2.15.0.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.
|
4
|
-
# Generated on 2025-02-
|
3
|
+
# MF version: 2.15.0 #
|
4
|
+
# Generated on 2025-02-25T21:21:51.409752 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -35,8 +35,8 @@ 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 tuple_util as tuple_util
|
39
38
|
from . import events as events
|
39
|
+
from . import tuple_util as tuple_util
|
40
40
|
from . import runner as runner
|
41
41
|
from . import plugins as plugins
|
42
42
|
from .plugins.datatools.s3.s3 import S3 as S3
|
@@ -143,237 +143,61 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
143
143
|
...
|
144
144
|
|
145
145
|
@typing.overload
|
146
|
-
def
|
147
|
-
"""
|
148
|
-
Specifies environment variables to be set prior to the execution of a step.
|
149
|
-
|
150
|
-
|
151
|
-
Parameters
|
152
|
-
----------
|
153
|
-
vars : Dict[str, str], default {}
|
154
|
-
Dictionary of environment variables to set.
|
155
|
-
"""
|
156
|
-
...
|
157
|
-
|
158
|
-
@typing.overload
|
159
|
-
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
160
|
-
...
|
161
|
-
|
162
|
-
@typing.overload
|
163
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
164
|
-
...
|
165
|
-
|
166
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
167
|
-
"""
|
168
|
-
Specifies environment variables to be set prior to the execution of a step.
|
169
|
-
|
170
|
-
|
171
|
-
Parameters
|
172
|
-
----------
|
173
|
-
vars : Dict[str, str], default {}
|
174
|
-
Dictionary of environment variables to set.
|
175
|
-
"""
|
176
|
-
...
|
177
|
-
|
178
|
-
@typing.overload
|
179
|
-
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]]]:
|
180
|
-
"""
|
181
|
-
Specifies the number of times the task corresponding
|
182
|
-
to a step needs to be retried.
|
183
|
-
|
184
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
185
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
186
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
187
|
-
|
188
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
189
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
190
|
-
ensuring that the flow execution can continue.
|
191
|
-
|
192
|
-
|
193
|
-
Parameters
|
194
|
-
----------
|
195
|
-
times : int, default 3
|
196
|
-
Number of times to retry this task.
|
197
|
-
minutes_between_retries : int, default 2
|
198
|
-
Number of minutes between retries.
|
199
|
-
"""
|
200
|
-
...
|
201
|
-
|
202
|
-
@typing.overload
|
203
|
-
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
204
|
-
...
|
205
|
-
|
206
|
-
@typing.overload
|
207
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
208
|
-
...
|
209
|
-
|
210
|
-
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):
|
211
|
-
"""
|
212
|
-
Specifies the number of times the task corresponding
|
213
|
-
to a step needs to be retried.
|
214
|
-
|
215
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
216
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
217
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
218
|
-
|
219
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
220
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
221
|
-
ensuring that the flow execution can continue.
|
222
|
-
|
223
|
-
|
224
|
-
Parameters
|
225
|
-
----------
|
226
|
-
times : int, default 3
|
227
|
-
Number of times to retry this task.
|
228
|
-
minutes_between_retries : int, default 2
|
229
|
-
Number of minutes between retries.
|
230
|
-
"""
|
231
|
-
...
|
232
|
-
|
233
|
-
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') -> 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]]]:
|
234
|
-
"""
|
235
|
-
Specifies that this step should execute on Kubernetes.
|
236
|
-
|
237
|
-
|
238
|
-
Parameters
|
239
|
-
----------
|
240
|
-
cpu : int, default 1
|
241
|
-
Number of CPUs required for this step. If `@resources` is
|
242
|
-
also present, the maximum value from all decorators is used.
|
243
|
-
memory : int, default 4096
|
244
|
-
Memory size (in MB) required for this step. If
|
245
|
-
`@resources` is also present, the maximum value from all decorators is
|
246
|
-
used.
|
247
|
-
disk : int, default 10240
|
248
|
-
Disk size (in MB) required for this step. If
|
249
|
-
`@resources` is also present, the maximum value from all decorators is
|
250
|
-
used.
|
251
|
-
image : str, optional, default None
|
252
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
253
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
254
|
-
not, a default Docker image mapping to the current version of Python is used.
|
255
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
256
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
257
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
258
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
259
|
-
secrets : List[str], optional, default None
|
260
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
261
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
262
|
-
in Metaflow configuration.
|
263
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
264
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
265
|
-
Can be passed in as a comma separated string of values e.g.
|
266
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
267
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
268
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
269
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
270
|
-
gpu : int, optional, default None
|
271
|
-
Number of GPUs required for this step. A value of zero implies that
|
272
|
-
the scheduled node should not have GPUs.
|
273
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
274
|
-
The vendor of the GPUs to be used for this step.
|
275
|
-
tolerations : List[str], default []
|
276
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
277
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
278
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
279
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
280
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
281
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
282
|
-
use_tmpfs : bool, default False
|
283
|
-
This enables an explicit tmpfs mount for this step.
|
284
|
-
tmpfs_tempdir : bool, default True
|
285
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
286
|
-
tmpfs_size : int, optional, default: None
|
287
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
288
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
289
|
-
memory allocated for this step.
|
290
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
291
|
-
Path to tmpfs mount for this step.
|
292
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
293
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
294
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
295
|
-
shared_memory: int, optional
|
296
|
-
Shared memory size (in MiB) required for this step
|
297
|
-
port: int, optional
|
298
|
-
Port number to specify in the Kubernetes job object
|
299
|
-
compute_pool : str, optional, default None
|
300
|
-
Compute pool to be used for for this step.
|
301
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
302
|
-
hostname_resolution_timeout: int, default 10 * 60
|
303
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
304
|
-
Only applicable when @parallel is used.
|
305
|
-
qos: str, default: Burstable
|
306
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
307
|
-
"""
|
308
|
-
...
|
309
|
-
|
310
|
-
@typing.overload
|
311
|
-
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]]]:
|
146
|
+
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]]]:
|
312
147
|
"""
|
313
|
-
Specifies the
|
148
|
+
Specifies the Conda environment for the step.
|
314
149
|
|
315
150
|
Information in this decorator will augment any
|
316
|
-
attributes set in the `@
|
317
|
-
you can use `@
|
318
|
-
steps and use `@
|
151
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
152
|
+
you can use `@conda_base` to set packages required by all
|
153
|
+
steps and use `@conda` to specify step-specific overrides.
|
319
154
|
|
320
155
|
|
321
156
|
Parameters
|
322
157
|
----------
|
323
|
-
packages : Dict[str, str], default
|
158
|
+
packages : Dict[str, str], default {}
|
324
159
|
Packages to use for this step. The key is the name of the package
|
325
160
|
and the value is the version to use.
|
326
|
-
|
161
|
+
libraries : Dict[str, str], default {}
|
162
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
163
|
+
python : str, optional, default None
|
327
164
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
328
165
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
166
|
+
disabled : bool, default False
|
167
|
+
If set to True, disables @conda.
|
329
168
|
"""
|
330
169
|
...
|
331
170
|
|
332
171
|
@typing.overload
|
333
|
-
def
|
172
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
334
173
|
...
|
335
174
|
|
336
175
|
@typing.overload
|
337
|
-
def
|
176
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
338
177
|
...
|
339
178
|
|
340
|
-
def
|
179
|
+
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):
|
341
180
|
"""
|
342
|
-
Specifies the
|
181
|
+
Specifies the Conda environment for the step.
|
343
182
|
|
344
183
|
Information in this decorator will augment any
|
345
|
-
attributes set in the `@
|
346
|
-
you can use `@
|
347
|
-
steps and use `@
|
184
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
185
|
+
you can use `@conda_base` to set packages required by all
|
186
|
+
steps and use `@conda` to specify step-specific overrides.
|
348
187
|
|
349
188
|
|
350
189
|
Parameters
|
351
190
|
----------
|
352
|
-
packages : Dict[str, str], default
|
191
|
+
packages : Dict[str, str], default {}
|
353
192
|
Packages to use for this step. The key is the name of the package
|
354
193
|
and the value is the version to use.
|
355
|
-
|
194
|
+
libraries : Dict[str, str], default {}
|
195
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
196
|
+
python : str, optional, default None
|
356
197
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
357
198
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
@typing.overload
|
362
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
363
|
-
"""
|
364
|
-
Parameters
|
365
|
-
----------
|
366
|
-
"""
|
367
|
-
...
|
368
|
-
|
369
|
-
@typing.overload
|
370
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
371
|
-
...
|
372
|
-
|
373
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
374
|
-
"""
|
375
|
-
Parameters
|
376
|
-
----------
|
199
|
+
disabled : bool, default False
|
200
|
+
If set to True, disables @conda.
|
377
201
|
"""
|
378
202
|
...
|
379
203
|
|
@@ -457,112 +281,105 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
457
281
|
...
|
458
282
|
|
459
283
|
@typing.overload
|
460
|
-
def
|
284
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
461
285
|
"""
|
462
|
-
Specifies that the step will success under all circumstances.
|
463
|
-
|
464
|
-
The decorator will create an optional artifact, specified by `var`, which
|
465
|
-
contains the exception raised. You can use it to detect the presence
|
466
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
467
|
-
are missing.
|
468
|
-
|
469
|
-
|
470
286
|
Parameters
|
471
287
|
----------
|
472
|
-
var : str, optional, default None
|
473
|
-
Name of the artifact in which to store the caught exception.
|
474
|
-
If not specified, the exception is not stored.
|
475
|
-
print_exception : bool, default True
|
476
|
-
Determines whether or not the exception is printed to
|
477
|
-
stdout when caught.
|
478
288
|
"""
|
479
289
|
...
|
480
290
|
|
481
291
|
@typing.overload
|
482
|
-
def
|
292
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
483
293
|
...
|
484
294
|
|
485
|
-
|
486
|
-
|
295
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
296
|
+
"""
|
297
|
+
Parameters
|
298
|
+
----------
|
299
|
+
"""
|
487
300
|
...
|
488
301
|
|
489
|
-
|
302
|
+
@typing.overload
|
303
|
+
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]]]:
|
490
304
|
"""
|
491
|
-
Specifies
|
492
|
-
|
493
|
-
The decorator will create an optional artifact, specified by `var`, which
|
494
|
-
contains the exception raised. You can use it to detect the presence
|
495
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
496
|
-
are missing.
|
305
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
306
|
+
the execution of a step.
|
497
307
|
|
498
308
|
|
499
309
|
Parameters
|
500
310
|
----------
|
501
|
-
|
502
|
-
|
503
|
-
If not specified, the exception is not stored.
|
504
|
-
print_exception : bool, default True
|
505
|
-
Determines whether or not the exception is printed to
|
506
|
-
stdout when caught.
|
311
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
312
|
+
List of secret specs, defining how the secrets are to be retrieved
|
507
313
|
"""
|
508
314
|
...
|
509
315
|
|
510
316
|
@typing.overload
|
511
|
-
def
|
317
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
318
|
+
...
|
319
|
+
|
320
|
+
@typing.overload
|
321
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
322
|
+
...
|
323
|
+
|
324
|
+
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]]] = []):
|
512
325
|
"""
|
513
|
-
Specifies
|
326
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
327
|
+
the execution of a step.
|
514
328
|
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
329
|
+
|
330
|
+
Parameters
|
331
|
+
----------
|
332
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
333
|
+
List of secret specs, defining how the secrets are to be retrieved
|
334
|
+
"""
|
335
|
+
...
|
336
|
+
|
337
|
+
@typing.overload
|
338
|
+
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]]]:
|
339
|
+
"""
|
340
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
341
|
+
|
342
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
519
343
|
|
520
344
|
|
521
345
|
Parameters
|
522
346
|
----------
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
disabled : bool, default False
|
532
|
-
If set to True, disables @conda.
|
347
|
+
type : str, default 'default'
|
348
|
+
Card type.
|
349
|
+
id : str, optional, default None
|
350
|
+
If multiple cards are present, use this id to identify this card.
|
351
|
+
options : Dict[str, Any], default {}
|
352
|
+
Options passed to the card. The contents depend on the card type.
|
353
|
+
timeout : int, default 45
|
354
|
+
Interrupt reporting if it takes more than this many seconds.
|
533
355
|
"""
|
534
356
|
...
|
535
357
|
|
536
358
|
@typing.overload
|
537
|
-
def
|
359
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
538
360
|
...
|
539
361
|
|
540
362
|
@typing.overload
|
541
|
-
def
|
363
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
542
364
|
...
|
543
365
|
|
544
|
-
def
|
366
|
+
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):
|
545
367
|
"""
|
546
|
-
|
368
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
547
369
|
|
548
|
-
|
549
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
550
|
-
you can use `@conda_base` to set packages required by all
|
551
|
-
steps and use `@conda` to specify step-specific overrides.
|
370
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
552
371
|
|
553
372
|
|
554
373
|
Parameters
|
555
374
|
----------
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
disabled : bool, default False
|
565
|
-
If set to True, disables @conda.
|
375
|
+
type : str, default 'default'
|
376
|
+
Card type.
|
377
|
+
id : str, optional, default None
|
378
|
+
If multiple cards are present, use this id to identify this card.
|
379
|
+
options : Dict[str, Any], default {}
|
380
|
+
Options passed to the card. The contents depend on the card type.
|
381
|
+
timeout : int, default 45
|
382
|
+
Interrupt reporting if it takes more than this many seconds.
|
566
383
|
"""
|
567
384
|
...
|
568
385
|
|
@@ -716,180 +533,421 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
716
533
|
...
|
717
534
|
|
718
535
|
@typing.overload
|
719
|
-
def
|
536
|
+
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]]]:
|
720
537
|
"""
|
721
|
-
Specifies
|
722
|
-
|
538
|
+
Specifies the PyPI packages for the step.
|
539
|
+
|
540
|
+
Information in this decorator will augment any
|
541
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
542
|
+
you can use `@pypi_base` to set packages required by all
|
543
|
+
steps and use `@pypi` to specify step-specific overrides.
|
723
544
|
|
724
545
|
|
725
546
|
Parameters
|
726
547
|
----------
|
727
|
-
|
728
|
-
|
548
|
+
packages : Dict[str, str], default: {}
|
549
|
+
Packages to use for this step. The key is the name of the package
|
550
|
+
and the value is the version to use.
|
551
|
+
python : str, optional, default: None
|
552
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
553
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
729
554
|
"""
|
730
555
|
...
|
731
556
|
|
732
557
|
@typing.overload
|
733
|
-
def
|
558
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
734
559
|
...
|
735
560
|
|
736
561
|
@typing.overload
|
737
|
-
def
|
562
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
738
563
|
...
|
739
564
|
|
740
|
-
def
|
565
|
+
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):
|
741
566
|
"""
|
742
|
-
Specifies
|
743
|
-
|
567
|
+
Specifies the PyPI packages for the step.
|
568
|
+
|
569
|
+
Information in this decorator will augment any
|
570
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
571
|
+
you can use `@pypi_base` to set packages required by all
|
572
|
+
steps and use `@pypi` to specify step-specific overrides.
|
744
573
|
|
745
574
|
|
746
575
|
Parameters
|
747
576
|
----------
|
748
|
-
|
749
|
-
|
577
|
+
packages : Dict[str, str], default: {}
|
578
|
+
Packages to use for this step. The key is the name of the package
|
579
|
+
and the value is the version to use.
|
580
|
+
python : str, optional, default: None
|
581
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
582
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
750
583
|
"""
|
751
584
|
...
|
752
585
|
|
753
586
|
@typing.overload
|
754
|
-
def
|
587
|
+
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]]]:
|
755
588
|
"""
|
756
|
-
Specifies
|
757
|
-
|
758
|
-
This decorator is useful if this step may hang indefinitely.
|
759
|
-
|
760
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
761
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
762
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
589
|
+
Specifies that the step will success under all circumstances.
|
763
590
|
|
764
|
-
|
765
|
-
|
591
|
+
The decorator will create an optional artifact, specified by `var`, which
|
592
|
+
contains the exception raised. You can use it to detect the presence
|
593
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
594
|
+
are missing.
|
766
595
|
|
767
596
|
|
768
597
|
Parameters
|
769
598
|
----------
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
599
|
+
var : str, optional, default None
|
600
|
+
Name of the artifact in which to store the caught exception.
|
601
|
+
If not specified, the exception is not stored.
|
602
|
+
print_exception : bool, default True
|
603
|
+
Determines whether or not the exception is printed to
|
604
|
+
stdout when caught.
|
776
605
|
"""
|
777
606
|
...
|
778
607
|
|
779
608
|
@typing.overload
|
780
|
-
def
|
609
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
781
610
|
...
|
782
611
|
|
783
612
|
@typing.overload
|
784
|
-
def
|
613
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
785
614
|
...
|
786
615
|
|
787
|
-
def
|
616
|
+
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):
|
788
617
|
"""
|
789
|
-
Specifies
|
790
|
-
|
791
|
-
This decorator is useful if this step may hang indefinitely.
|
792
|
-
|
793
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
794
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
795
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
618
|
+
Specifies that the step will success under all circumstances.
|
796
619
|
|
797
|
-
|
798
|
-
|
620
|
+
The decorator will create an optional artifact, specified by `var`, which
|
621
|
+
contains the exception raised. You can use it to detect the presence
|
622
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
623
|
+
are missing.
|
799
624
|
|
800
625
|
|
801
626
|
Parameters
|
802
627
|
----------
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
628
|
+
var : str, optional, default None
|
629
|
+
Name of the artifact in which to store the caught exception.
|
630
|
+
If not specified, the exception is not stored.
|
631
|
+
print_exception : bool, default True
|
632
|
+
Determines whether or not the exception is printed to
|
633
|
+
stdout when caught.
|
809
634
|
"""
|
810
635
|
...
|
811
636
|
|
812
637
|
@typing.overload
|
813
|
-
def
|
638
|
+
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]]]:
|
814
639
|
"""
|
815
|
-
|
640
|
+
Specifies the number of times the task corresponding
|
641
|
+
to a step needs to be retried.
|
816
642
|
|
817
|
-
|
643
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
644
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
645
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
646
|
+
|
647
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
648
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
649
|
+
ensuring that the flow execution can continue.
|
818
650
|
|
819
651
|
|
820
652
|
Parameters
|
821
653
|
----------
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
options : Dict[str, Any], default {}
|
827
|
-
Options passed to the card. The contents depend on the card type.
|
828
|
-
timeout : int, default 45
|
829
|
-
Interrupt reporting if it takes more than this many seconds.
|
654
|
+
times : int, default 3
|
655
|
+
Number of times to retry this task.
|
656
|
+
minutes_between_retries : int, default 2
|
657
|
+
Number of minutes between retries.
|
830
658
|
"""
|
831
659
|
...
|
832
660
|
|
833
661
|
@typing.overload
|
834
|
-
def
|
662
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
835
663
|
...
|
836
664
|
|
837
665
|
@typing.overload
|
838
|
-
def
|
666
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
839
667
|
...
|
840
668
|
|
841
|
-
def
|
669
|
+
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):
|
842
670
|
"""
|
843
|
-
|
671
|
+
Specifies the number of times the task corresponding
|
672
|
+
to a step needs to be retried.
|
844
673
|
|
845
|
-
|
674
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
675
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
676
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
677
|
+
|
678
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
679
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
680
|
+
ensuring that the flow execution can continue.
|
846
681
|
|
847
682
|
|
848
683
|
Parameters
|
849
684
|
----------
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
options : Dict[str, Any], default {}
|
855
|
-
Options passed to the card. The contents depend on the card type.
|
856
|
-
timeout : int, default 45
|
857
|
-
Interrupt reporting if it takes more than this many seconds.
|
685
|
+
times : int, default 3
|
686
|
+
Number of times to retry this task.
|
687
|
+
minutes_between_retries : int, default 2
|
688
|
+
Number of minutes between retries.
|
858
689
|
"""
|
859
690
|
...
|
860
691
|
|
861
|
-
def
|
692
|
+
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') -> 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]]]:
|
862
693
|
"""
|
863
|
-
Specifies
|
864
|
-
|
865
|
-
A project-specific namespace is created for all flows that
|
866
|
-
use the same `@project(name)`.
|
694
|
+
Specifies that this step should execute on Kubernetes.
|
867
695
|
|
868
696
|
|
869
697
|
Parameters
|
870
698
|
----------
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
699
|
+
cpu : int, default 1
|
700
|
+
Number of CPUs required for this step. If `@resources` is
|
701
|
+
also present, the maximum value from all decorators is used.
|
702
|
+
memory : int, default 4096
|
703
|
+
Memory size (in MB) required for this step. If
|
704
|
+
`@resources` is also present, the maximum value from all decorators is
|
705
|
+
used.
|
706
|
+
disk : int, default 10240
|
707
|
+
Disk size (in MB) required for this step. If
|
708
|
+
`@resources` is also present, the maximum value from all decorators is
|
709
|
+
used.
|
710
|
+
image : str, optional, default None
|
711
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
712
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
713
|
+
not, a default Docker image mapping to the current version of Python is used.
|
714
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
715
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
716
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
717
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
718
|
+
secrets : List[str], optional, default None
|
719
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
720
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
721
|
+
in Metaflow configuration.
|
722
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
723
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
724
|
+
Can be passed in as a comma separated string of values e.g.
|
725
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
726
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
727
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
728
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
729
|
+
gpu : int, optional, default None
|
730
|
+
Number of GPUs required for this step. A value of zero implies that
|
731
|
+
the scheduled node should not have GPUs.
|
732
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
733
|
+
The vendor of the GPUs to be used for this step.
|
734
|
+
tolerations : List[str], default []
|
735
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
736
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
737
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
738
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
739
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
740
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
741
|
+
use_tmpfs : bool, default False
|
742
|
+
This enables an explicit tmpfs mount for this step.
|
743
|
+
tmpfs_tempdir : bool, default True
|
744
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
745
|
+
tmpfs_size : int, optional, default: None
|
746
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
747
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
748
|
+
memory allocated for this step.
|
749
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
750
|
+
Path to tmpfs mount for this step.
|
751
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
752
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
753
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
754
|
+
shared_memory: int, optional
|
755
|
+
Shared memory size (in MiB) required for this step
|
756
|
+
port: int, optional
|
757
|
+
Port number to specify in the Kubernetes job object
|
758
|
+
compute_pool : str, optional, default None
|
759
|
+
Compute pool to be used for for this step.
|
760
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
761
|
+
hostname_resolution_timeout: int, default 10 * 60
|
762
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
763
|
+
Only applicable when @parallel is used.
|
764
|
+
qos: str, default: Burstable
|
765
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
766
|
+
"""
|
767
|
+
...
|
768
|
+
|
769
|
+
@typing.overload
|
770
|
+
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]]]:
|
771
|
+
"""
|
772
|
+
Specifies a timeout for your step.
|
875
773
|
|
876
|
-
|
877
|
-
The branch to use. If not specified, the branch is set to
|
878
|
-
`user.<username>` unless `production` is set to `True`. This can
|
879
|
-
also be set on the command line using `--branch` as a top-level option.
|
880
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
774
|
+
This decorator is useful if this step may hang indefinitely.
|
881
775
|
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
776
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
777
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
778
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
779
|
+
|
780
|
+
Note that all the values specified in parameters are added together so if you specify
|
781
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
782
|
+
|
783
|
+
|
784
|
+
Parameters
|
785
|
+
----------
|
786
|
+
seconds : int, default 0
|
787
|
+
Number of seconds to wait prior to timing out.
|
788
|
+
minutes : int, default 0
|
789
|
+
Number of minutes to wait prior to timing out.
|
790
|
+
hours : int, default 0
|
791
|
+
Number of hours to wait prior to timing out.
|
792
|
+
"""
|
793
|
+
...
|
794
|
+
|
795
|
+
@typing.overload
|
796
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
797
|
+
...
|
798
|
+
|
799
|
+
@typing.overload
|
800
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
801
|
+
...
|
802
|
+
|
803
|
+
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):
|
804
|
+
"""
|
805
|
+
Specifies a timeout for your step.
|
806
|
+
|
807
|
+
This decorator is useful if this step may hang indefinitely.
|
808
|
+
|
809
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
810
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
811
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
812
|
+
|
813
|
+
Note that all the values specified in parameters are added together so if you specify
|
814
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
815
|
+
|
816
|
+
|
817
|
+
Parameters
|
818
|
+
----------
|
819
|
+
seconds : int, default 0
|
820
|
+
Number of seconds to wait prior to timing out.
|
821
|
+
minutes : int, default 0
|
822
|
+
Number of minutes to wait prior to timing out.
|
823
|
+
hours : int, default 0
|
824
|
+
Number of hours to wait prior to timing out.
|
825
|
+
"""
|
826
|
+
...
|
827
|
+
|
828
|
+
@typing.overload
|
829
|
+
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]]]:
|
830
|
+
"""
|
831
|
+
Specifies environment variables to be set prior to the execution of a step.
|
832
|
+
|
833
|
+
|
834
|
+
Parameters
|
835
|
+
----------
|
836
|
+
vars : Dict[str, str], default {}
|
837
|
+
Dictionary of environment variables to set.
|
838
|
+
"""
|
839
|
+
...
|
840
|
+
|
841
|
+
@typing.overload
|
842
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
843
|
+
...
|
844
|
+
|
845
|
+
@typing.overload
|
846
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
847
|
+
...
|
848
|
+
|
849
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
850
|
+
"""
|
851
|
+
Specifies environment variables to be set prior to the execution of a step.
|
852
|
+
|
853
|
+
|
854
|
+
Parameters
|
855
|
+
----------
|
856
|
+
vars : Dict[str, str], default {}
|
857
|
+
Dictionary of environment variables to set.
|
858
|
+
"""
|
859
|
+
...
|
860
|
+
|
861
|
+
@typing.overload
|
862
|
+
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]]:
|
863
|
+
"""
|
864
|
+
Specifies the event(s) that this flow depends on.
|
865
|
+
|
866
|
+
```
|
867
|
+
@trigger(event='foo')
|
868
|
+
```
|
869
|
+
or
|
870
|
+
```
|
871
|
+
@trigger(events=['foo', 'bar'])
|
872
|
+
```
|
873
|
+
|
874
|
+
Additionally, you can specify the parameter mappings
|
875
|
+
to map event payload to Metaflow parameters for the flow.
|
876
|
+
```
|
877
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
878
|
+
```
|
879
|
+
or
|
880
|
+
```
|
881
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
882
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
883
|
+
```
|
884
|
+
|
885
|
+
'parameters' can also be a list of strings and tuples like so:
|
886
|
+
```
|
887
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
888
|
+
```
|
889
|
+
This is equivalent to:
|
890
|
+
```
|
891
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
892
|
+
```
|
893
|
+
|
894
|
+
|
895
|
+
Parameters
|
896
|
+
----------
|
897
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
898
|
+
Event dependency for this flow.
|
899
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
900
|
+
Events dependency for this flow.
|
901
|
+
options : Dict[str, Any], default {}
|
902
|
+
Backend-specific configuration for tuning eventing behavior.
|
903
|
+
"""
|
904
|
+
...
|
905
|
+
|
906
|
+
@typing.overload
|
907
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
908
|
+
...
|
909
|
+
|
910
|
+
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] = {}):
|
911
|
+
"""
|
912
|
+
Specifies the event(s) that this flow depends on.
|
913
|
+
|
914
|
+
```
|
915
|
+
@trigger(event='foo')
|
916
|
+
```
|
917
|
+
or
|
918
|
+
```
|
919
|
+
@trigger(events=['foo', 'bar'])
|
920
|
+
```
|
921
|
+
|
922
|
+
Additionally, you can specify the parameter mappings
|
923
|
+
to map event payload to Metaflow parameters for the flow.
|
924
|
+
```
|
925
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
926
|
+
```
|
927
|
+
or
|
928
|
+
```
|
929
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
930
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
931
|
+
```
|
932
|
+
|
933
|
+
'parameters' can also be a list of strings and tuples like so:
|
934
|
+
```
|
935
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
936
|
+
```
|
937
|
+
This is equivalent to:
|
938
|
+
```
|
939
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
940
|
+
```
|
941
|
+
|
942
|
+
|
943
|
+
Parameters
|
944
|
+
----------
|
945
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
946
|
+
Event dependency for this flow.
|
947
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
948
|
+
Events dependency for this flow.
|
949
|
+
options : Dict[str, Any], default {}
|
950
|
+
Backend-specific configuration for tuning eventing behavior.
|
893
951
|
"""
|
894
952
|
...
|
895
953
|
|
@@ -944,6 +1002,107 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
944
1002
|
"""
|
945
1003
|
...
|
946
1004
|
|
1005
|
+
@typing.overload
|
1006
|
+
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]]:
|
1007
|
+
"""
|
1008
|
+
Specifies the flow(s) that this flow depends on.
|
1009
|
+
|
1010
|
+
```
|
1011
|
+
@trigger_on_finish(flow='FooFlow')
|
1012
|
+
```
|
1013
|
+
or
|
1014
|
+
```
|
1015
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1016
|
+
```
|
1017
|
+
This decorator respects the @project decorator and triggers the flow
|
1018
|
+
when upstream runs within the same namespace complete successfully
|
1019
|
+
|
1020
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1021
|
+
by specifying the fully qualified project_flow_name.
|
1022
|
+
```
|
1023
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1024
|
+
```
|
1025
|
+
or
|
1026
|
+
```
|
1027
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1028
|
+
```
|
1029
|
+
|
1030
|
+
You can also specify just the project or project branch (other values will be
|
1031
|
+
inferred from the current project or project branch):
|
1032
|
+
```
|
1033
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1034
|
+
```
|
1035
|
+
|
1036
|
+
Note that `branch` is typically one of:
|
1037
|
+
- `prod`
|
1038
|
+
- `user.bob`
|
1039
|
+
- `test.my_experiment`
|
1040
|
+
- `prod.staging`
|
1041
|
+
|
1042
|
+
|
1043
|
+
Parameters
|
1044
|
+
----------
|
1045
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1046
|
+
Upstream flow dependency for this flow.
|
1047
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1048
|
+
Upstream flow dependencies for this flow.
|
1049
|
+
options : Dict[str, Any], default {}
|
1050
|
+
Backend-specific configuration for tuning eventing behavior.
|
1051
|
+
"""
|
1052
|
+
...
|
1053
|
+
|
1054
|
+
@typing.overload
|
1055
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1056
|
+
...
|
1057
|
+
|
1058
|
+
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] = {}):
|
1059
|
+
"""
|
1060
|
+
Specifies the flow(s) that this flow depends on.
|
1061
|
+
|
1062
|
+
```
|
1063
|
+
@trigger_on_finish(flow='FooFlow')
|
1064
|
+
```
|
1065
|
+
or
|
1066
|
+
```
|
1067
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1068
|
+
```
|
1069
|
+
This decorator respects the @project decorator and triggers the flow
|
1070
|
+
when upstream runs within the same namespace complete successfully
|
1071
|
+
|
1072
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1073
|
+
by specifying the fully qualified project_flow_name.
|
1074
|
+
```
|
1075
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1076
|
+
```
|
1077
|
+
or
|
1078
|
+
```
|
1079
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1080
|
+
```
|
1081
|
+
|
1082
|
+
You can also specify just the project or project branch (other values will be
|
1083
|
+
inferred from the current project or project branch):
|
1084
|
+
```
|
1085
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1086
|
+
```
|
1087
|
+
|
1088
|
+
Note that `branch` is typically one of:
|
1089
|
+
- `prod`
|
1090
|
+
- `user.bob`
|
1091
|
+
- `test.my_experiment`
|
1092
|
+
- `prod.staging`
|
1093
|
+
|
1094
|
+
|
1095
|
+
Parameters
|
1096
|
+
----------
|
1097
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1098
|
+
Upstream flow dependency for this flow.
|
1099
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1100
|
+
Upstream flow dependencies for this flow.
|
1101
|
+
options : Dict[str, Any], default {}
|
1102
|
+
Backend-specific configuration for tuning eventing behavior.
|
1103
|
+
"""
|
1104
|
+
...
|
1105
|
+
|
947
1106
|
@typing.overload
|
948
1107
|
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]]:
|
949
1108
|
"""
|
@@ -995,47 +1154,6 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
995
1154
|
"""
|
996
1155
|
...
|
997
1156
|
|
998
|
-
@typing.overload
|
999
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1000
|
-
"""
|
1001
|
-
Specifies the PyPI packages for all steps of the flow.
|
1002
|
-
|
1003
|
-
Use `@pypi_base` to set common packages required by all
|
1004
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1005
|
-
|
1006
|
-
Parameters
|
1007
|
-
----------
|
1008
|
-
packages : Dict[str, str], default: {}
|
1009
|
-
Packages to use for this flow. The key is the name of the package
|
1010
|
-
and the value is the version to use.
|
1011
|
-
python : str, optional, default: None
|
1012
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1013
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1014
|
-
"""
|
1015
|
-
...
|
1016
|
-
|
1017
|
-
@typing.overload
|
1018
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1019
|
-
...
|
1020
|
-
|
1021
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1022
|
-
"""
|
1023
|
-
Specifies the PyPI packages for all steps of the flow.
|
1024
|
-
|
1025
|
-
Use `@pypi_base` to set common packages required by all
|
1026
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1027
|
-
|
1028
|
-
Parameters
|
1029
|
-
----------
|
1030
|
-
packages : Dict[str, str], default: {}
|
1031
|
-
Packages to use for this flow. The key is the name of the package
|
1032
|
-
and the value is the version to use.
|
1033
|
-
python : str, optional, default: None
|
1034
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1035
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1036
|
-
"""
|
1037
|
-
...
|
1038
|
-
|
1039
1157
|
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]]:
|
1040
1158
|
"""
|
1041
1159
|
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)
|
@@ -1079,96 +1197,38 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1079
1197
|
"""
|
1080
1198
|
...
|
1081
1199
|
|
1082
|
-
|
1083
|
-
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]]:
|
1200
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1084
1201
|
"""
|
1085
|
-
Specifies
|
1086
|
-
|
1087
|
-
```
|
1088
|
-
@trigger(event='foo')
|
1089
|
-
```
|
1090
|
-
or
|
1091
|
-
```
|
1092
|
-
@trigger(events=['foo', 'bar'])
|
1093
|
-
```
|
1094
|
-
|
1095
|
-
Additionally, you can specify the parameter mappings
|
1096
|
-
to map event payload to Metaflow parameters for the flow.
|
1097
|
-
```
|
1098
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1099
|
-
```
|
1100
|
-
or
|
1101
|
-
```
|
1102
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1103
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1104
|
-
```
|
1202
|
+
Specifies what flows belong to the same project.
|
1105
1203
|
|
1106
|
-
|
1107
|
-
|
1108
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1109
|
-
```
|
1110
|
-
This is equivalent to:
|
1111
|
-
```
|
1112
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1113
|
-
```
|
1204
|
+
A project-specific namespace is created for all flows that
|
1205
|
+
use the same `@project(name)`.
|
1114
1206
|
|
1115
1207
|
|
1116
1208
|
Parameters
|
1117
1209
|
----------
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
options : Dict[str, Any], default {}
|
1123
|
-
Backend-specific configuration for tuning eventing behavior.
|
1124
|
-
"""
|
1125
|
-
...
|
1126
|
-
|
1127
|
-
@typing.overload
|
1128
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1129
|
-
...
|
1130
|
-
|
1131
|
-
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] = {}):
|
1132
|
-
"""
|
1133
|
-
Specifies the event(s) that this flow depends on.
|
1134
|
-
|
1135
|
-
```
|
1136
|
-
@trigger(event='foo')
|
1137
|
-
```
|
1138
|
-
or
|
1139
|
-
```
|
1140
|
-
@trigger(events=['foo', 'bar'])
|
1141
|
-
```
|
1142
|
-
|
1143
|
-
Additionally, you can specify the parameter mappings
|
1144
|
-
to map event payload to Metaflow parameters for the flow.
|
1145
|
-
```
|
1146
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1147
|
-
```
|
1148
|
-
or
|
1149
|
-
```
|
1150
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1151
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1152
|
-
```
|
1153
|
-
|
1154
|
-
'parameters' can also be a list of strings and tuples like so:
|
1155
|
-
```
|
1156
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1157
|
-
```
|
1158
|
-
This is equivalent to:
|
1159
|
-
```
|
1160
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1161
|
-
```
|
1210
|
+
name : str
|
1211
|
+
Project name. Make sure that the name is unique amongst all
|
1212
|
+
projects that use the same production scheduler. The name may
|
1213
|
+
contain only lowercase alphanumeric characters and underscores.
|
1162
1214
|
|
1215
|
+
branch : Optional[str], default None
|
1216
|
+
The branch to use. If not specified, the branch is set to
|
1217
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1218
|
+
also be set on the command line using `--branch` as a top-level option.
|
1219
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1163
1220
|
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1221
|
+
production : bool, default False
|
1222
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1223
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1224
|
+
`production` in the decorator and on the command line.
|
1225
|
+
The project branch name will be:
|
1226
|
+
- if `branch` is specified:
|
1227
|
+
- if `production` is True: `prod.<branch>`
|
1228
|
+
- if `production` is False: `test.<branch>`
|
1229
|
+
- if `branch` is not specified:
|
1230
|
+
- if `production` is True: `prod`
|
1231
|
+
- if `production` is False: `user.<username>`
|
1172
1232
|
"""
|
1173
1233
|
...
|
1174
1234
|
|
@@ -1216,103 +1276,43 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
1216
1276
|
...
|
1217
1277
|
|
1218
1278
|
@typing.overload
|
1219
|
-
def
|
1279
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1220
1280
|
"""
|
1221
|
-
Specifies the
|
1222
|
-
|
1223
|
-
```
|
1224
|
-
@trigger_on_finish(flow='FooFlow')
|
1225
|
-
```
|
1226
|
-
or
|
1227
|
-
```
|
1228
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1229
|
-
```
|
1230
|
-
This decorator respects the @project decorator and triggers the flow
|
1231
|
-
when upstream runs within the same namespace complete successfully
|
1232
|
-
|
1233
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1234
|
-
by specifying the fully qualified project_flow_name.
|
1235
|
-
```
|
1236
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1237
|
-
```
|
1238
|
-
or
|
1239
|
-
```
|
1240
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1241
|
-
```
|
1242
|
-
|
1243
|
-
You can also specify just the project or project branch (other values will be
|
1244
|
-
inferred from the current project or project branch):
|
1245
|
-
```
|
1246
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1247
|
-
```
|
1248
|
-
|
1249
|
-
Note that `branch` is typically one of:
|
1250
|
-
- `prod`
|
1251
|
-
- `user.bob`
|
1252
|
-
- `test.my_experiment`
|
1253
|
-
- `prod.staging`
|
1281
|
+
Specifies the PyPI packages for all steps of the flow.
|
1254
1282
|
|
1283
|
+
Use `@pypi_base` to set common packages required by all
|
1284
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1255
1285
|
|
1256
1286
|
Parameters
|
1257
1287
|
----------
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1288
|
+
packages : Dict[str, str], default: {}
|
1289
|
+
Packages to use for this flow. The key is the name of the package
|
1290
|
+
and the value is the version to use.
|
1291
|
+
python : str, optional, default: None
|
1292
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1293
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1264
1294
|
"""
|
1265
1295
|
...
|
1266
1296
|
|
1267
1297
|
@typing.overload
|
1268
|
-
def
|
1298
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1269
1299
|
...
|
1270
1300
|
|
1271
|
-
def
|
1301
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1272
1302
|
"""
|
1273
|
-
Specifies the
|
1274
|
-
|
1275
|
-
```
|
1276
|
-
@trigger_on_finish(flow='FooFlow')
|
1277
|
-
```
|
1278
|
-
or
|
1279
|
-
```
|
1280
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1281
|
-
```
|
1282
|
-
This decorator respects the @project decorator and triggers the flow
|
1283
|
-
when upstream runs within the same namespace complete successfully
|
1284
|
-
|
1285
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1286
|
-
by specifying the fully qualified project_flow_name.
|
1287
|
-
```
|
1288
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1289
|
-
```
|
1290
|
-
or
|
1291
|
-
```
|
1292
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1293
|
-
```
|
1294
|
-
|
1295
|
-
You can also specify just the project or project branch (other values will be
|
1296
|
-
inferred from the current project or project branch):
|
1297
|
-
```
|
1298
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1299
|
-
```
|
1300
|
-
|
1301
|
-
Note that `branch` is typically one of:
|
1302
|
-
- `prod`
|
1303
|
-
- `user.bob`
|
1304
|
-
- `test.my_experiment`
|
1305
|
-
- `prod.staging`
|
1303
|
+
Specifies the PyPI packages for all steps of the flow.
|
1306
1304
|
|
1305
|
+
Use `@pypi_base` to set common packages required by all
|
1306
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1307
1307
|
|
1308
1308
|
Parameters
|
1309
1309
|
----------
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1310
|
+
packages : Dict[str, str], default: {}
|
1311
|
+
Packages to use for this flow. The key is the name of the package
|
1312
|
+
and the value is the version to use.
|
1313
|
+
python : str, optional, default: None
|
1314
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1315
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1316
1316
|
"""
|
1317
1317
|
...
|
1318
1318
|
|