ob-metaflow-stubs 5.8__py2.py3-none-any.whl → 5.8.1__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 +495 -495
- metaflow-stubs/cards.pyi +4 -4
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +3 -3
- metaflow-stubs/client/core.pyi +5 -5
- metaflow-stubs/client/filecache.pyi +1 -1
- metaflow-stubs/clone_util.pyi +1 -1
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +2 -2
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +3 -3
- metaflow-stubs/metadata/metadata.pyi +1 -1
- metaflow-stubs/metadata/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +26 -26
- metaflow-stubs/mflog/mflog.pyi +1 -1
- metaflow-stubs/multicore_utils.pyi +1 -1
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
- metaflow-stubs/plugins/airflow/exception.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
- metaflow-stubs/plugins/argo/__init__.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +1 -1
- metaflow-stubs/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +1 -1
- metaflow-stubs/plugins/azure/__init__.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
- metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/cards/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_cli.pyi +3 -3
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +1 -1
- metaflow-stubs/plugins/catch_decorator.pyi +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/s3/s3.pyi +5 -5
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
- metaflow-stubs/plugins/debug_logger.pyi +1 -1
- metaflow-stubs/plugins/debug_monitor.pyi +1 -1
- metaflow-stubs/plugins/environment_decorator.pyi +1 -1
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
- metaflow-stubs/plugins/frameworks/pytorch.pyi +3 -3
- metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/logs_cli.pyi +1 -1
- metaflow-stubs/plugins/package_cli.pyi +1 -1
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/perimeters.pyi +1 -1
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
- metaflow-stubs/plugins/pypi/utils.pyi +1 -1
- metaflow-stubs/plugins/resources_decorator.pyi +1 -1
- metaflow-stubs/plugins/retry_decorator.pyi +1 -1
- metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +1 -1
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/tag_cli.pyi +4 -4
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/procpoll.pyi +1 -1
- metaflow-stubs/profilers/__init__.pyi +1 -1
- metaflow-stubs/pylint_wrapper.pyi +1 -1
- metaflow-stubs/runner/__init__.pyi +1 -1
- metaflow-stubs/runner/deployer.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +4 -4
- metaflow-stubs/runner/nbdeploy.pyi +1 -1
- metaflow-stubs/runner/nbrun.pyi +1 -1
- metaflow-stubs/runner/subprocess_manager.pyi +1 -1
- metaflow-stubs/runner/utils.pyi +1 -1
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- {ob_metaflow_stubs-5.8.dist-info → ob_metaflow_stubs-5.8.1.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-5.8.1.dist-info/RECORD +138 -0
- ob_metaflow_stubs-5.8.dist-info/RECORD +0 -138
- {ob_metaflow_stubs-5.8.dist-info → ob_metaflow_stubs-5.8.1.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-5.8.dist-info → ob_metaflow_stubs-5.8.1.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
3
|
# MF version: 2.12.19.1+ob(v1) #
|
4
|
-
# Generated on 2024-09-
|
4
|
+
# Generated on 2024-09-06T08:14:24.914849 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import metaflow.client.core
|
12
11
|
import metaflow.parameters
|
13
|
-
import
|
14
|
-
import metaflow._vendor.click.types
|
15
|
-
import metaflow.runner.metaflow_runner
|
12
|
+
import typing
|
16
13
|
import datetime
|
17
|
-
import metaflow.
|
14
|
+
import metaflow.runner.metaflow_runner
|
18
15
|
import metaflow.datastore.inputs
|
19
|
-
import
|
16
|
+
import metaflow.flowspec
|
17
|
+
import metaflow.events
|
18
|
+
import metaflow.client.core
|
19
|
+
import metaflow._vendor.click.types
|
20
20
|
import metaflow.metaflow_current
|
21
21
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
22
22
|
StepFlag = typing.NewType("StepFlag", bool)
|
@@ -437,214 +437,184 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
437
437
|
"""
|
438
438
|
...
|
439
439
|
|
440
|
-
|
441
|
-
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]]]:
|
442
|
-
"""
|
443
|
-
Specifies a timeout for your step.
|
444
|
-
|
445
|
-
This decorator is useful if this step may hang indefinitely.
|
446
|
-
|
447
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
448
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
449
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
450
|
-
|
451
|
-
Note that all the values specified in parameters are added together so if you specify
|
452
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
453
|
-
|
454
|
-
Parameters
|
455
|
-
----------
|
456
|
-
seconds : int, default 0
|
457
|
-
Number of seconds to wait prior to timing out.
|
458
|
-
minutes : int, default 0
|
459
|
-
Number of minutes to wait prior to timing out.
|
460
|
-
hours : int, default 0
|
461
|
-
Number of hours to wait prior to timing out.
|
462
|
-
"""
|
463
|
-
...
|
464
|
-
|
465
|
-
@typing.overload
|
466
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
467
|
-
...
|
468
|
-
|
469
|
-
@typing.overload
|
470
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
471
|
-
...
|
472
|
-
|
473
|
-
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):
|
440
|
+
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, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], 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) -> 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]]]:
|
474
441
|
"""
|
475
|
-
Specifies
|
476
|
-
|
477
|
-
This decorator is useful if this step may hang indefinitely.
|
478
|
-
|
479
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
480
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
481
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
482
|
-
|
483
|
-
Note that all the values specified in parameters are added together so if you specify
|
484
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
442
|
+
Specifies that this step should execute on Kubernetes.
|
485
443
|
|
486
444
|
Parameters
|
487
445
|
----------
|
488
|
-
|
489
|
-
Number of
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
446
|
+
cpu : int, default 1
|
447
|
+
Number of CPUs required for this step. If `@resources` is
|
448
|
+
also present, the maximum value from all decorators is used.
|
449
|
+
memory : int, default 4096
|
450
|
+
Memory size (in MB) required for this step. If
|
451
|
+
`@resources` is also present, the maximum value from all decorators is
|
452
|
+
used.
|
453
|
+
disk : int, default 10240
|
454
|
+
Disk size (in MB) required for this step. If
|
455
|
+
`@resources` is also present, the maximum value from all decorators is
|
456
|
+
used.
|
457
|
+
image : str, optional, default None
|
458
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
459
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
460
|
+
not, a default Docker image mapping to the current version of Python is used.
|
461
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
462
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
463
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
464
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
465
|
+
secrets : List[str], optional, default None
|
466
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
467
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
468
|
+
in Metaflow configuration.
|
469
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
470
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
471
|
+
gpu : int, optional, default None
|
472
|
+
Number of GPUs required for this step. A value of zero implies that
|
473
|
+
the scheduled node should not have GPUs.
|
474
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
475
|
+
The vendor of the GPUs to be used for this step.
|
476
|
+
tolerations : List[str], default []
|
477
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
478
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
479
|
+
use_tmpfs : bool, default False
|
480
|
+
This enables an explicit tmpfs mount for this step.
|
481
|
+
tmpfs_tempdir : bool, default True
|
482
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
483
|
+
tmpfs_size : int, optional, default: None
|
484
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
485
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
486
|
+
memory allocated for this step.
|
487
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
488
|
+
Path to tmpfs mount for this step.
|
489
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
490
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
491
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
492
|
+
shared_memory: int, optional
|
493
|
+
Shared memory size (in MiB) required for this step
|
494
|
+
port: int, optional
|
495
|
+
Port number to specify in the Kubernetes job object
|
496
|
+
compute_pool : str, optional, default None
|
497
|
+
Compute pool to be used for for this step.
|
498
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
511
499
|
"""
|
512
500
|
...
|
513
501
|
|
514
502
|
@typing.overload
|
515
|
-
def
|
503
|
+
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]]]:
|
516
504
|
"""
|
517
|
-
Specifies the
|
505
|
+
Specifies the PyPI packages for the step.
|
518
506
|
|
519
507
|
Information in this decorator will augment any
|
520
|
-
attributes set in the `@
|
521
|
-
you can use `@
|
522
|
-
steps and use `@
|
508
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
509
|
+
you can use `@pypi_base` to set packages required by all
|
510
|
+
steps and use `@pypi` to specify step-specific overrides.
|
523
511
|
|
524
512
|
Parameters
|
525
513
|
----------
|
526
|
-
packages : Dict[str, str], default {}
|
514
|
+
packages : Dict[str, str], default: {}
|
527
515
|
Packages to use for this step. The key is the name of the package
|
528
516
|
and the value is the version to use.
|
529
|
-
|
530
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
531
|
-
python : str, optional, default None
|
517
|
+
python : str, optional, default: None
|
532
518
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
533
519
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
534
|
-
disabled : bool, default False
|
535
|
-
If set to True, disables @conda.
|
536
520
|
"""
|
537
521
|
...
|
538
522
|
|
539
523
|
@typing.overload
|
540
|
-
def
|
524
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
541
525
|
...
|
542
526
|
|
543
527
|
@typing.overload
|
544
|
-
def
|
528
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
545
529
|
...
|
546
530
|
|
547
|
-
def
|
531
|
+
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):
|
548
532
|
"""
|
549
|
-
Specifies the
|
533
|
+
Specifies the PyPI packages for the step.
|
550
534
|
|
551
535
|
Information in this decorator will augment any
|
552
|
-
attributes set in the `@
|
553
|
-
you can use `@
|
554
|
-
steps and use `@
|
536
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
537
|
+
you can use `@pypi_base` to set packages required by all
|
538
|
+
steps and use `@pypi` to specify step-specific overrides.
|
555
539
|
|
556
540
|
Parameters
|
557
541
|
----------
|
558
|
-
packages : Dict[str, str], default {}
|
542
|
+
packages : Dict[str, str], default: {}
|
559
543
|
Packages to use for this step. The key is the name of the package
|
560
544
|
and the value is the version to use.
|
561
|
-
|
562
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
563
|
-
python : str, optional, default None
|
545
|
+
python : str, optional, default: None
|
564
546
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
565
547
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
566
|
-
disabled : bool, default False
|
567
|
-
If set to True, disables @conda.
|
568
548
|
"""
|
569
549
|
...
|
570
550
|
|
571
551
|
@typing.overload
|
572
|
-
def
|
552
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
573
553
|
"""
|
574
|
-
|
575
|
-
|
576
|
-
Parameters
|
577
|
-
----------
|
578
|
-
vars : Dict[str, str], default {}
|
579
|
-
Dictionary of environment variables to set.
|
554
|
+
Decorator prototype for all step decorators. This function gets specialized
|
555
|
+
and imported for all decorators types by _import_plugin_decorators().
|
580
556
|
"""
|
581
557
|
...
|
582
558
|
|
583
559
|
@typing.overload
|
584
|
-
def
|
585
|
-
...
|
586
|
-
|
587
|
-
@typing.overload
|
588
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
560
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
589
561
|
...
|
590
562
|
|
591
|
-
def
|
563
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
592
564
|
"""
|
593
|
-
|
594
|
-
|
595
|
-
Parameters
|
596
|
-
----------
|
597
|
-
vars : Dict[str, str], default {}
|
598
|
-
Dictionary of environment variables to set.
|
565
|
+
Decorator prototype for all step decorators. This function gets specialized
|
566
|
+
and imported for all decorators types by _import_plugin_decorators().
|
599
567
|
"""
|
600
568
|
...
|
601
569
|
|
602
570
|
@typing.overload
|
603
|
-
def
|
571
|
+
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]]]:
|
604
572
|
"""
|
605
|
-
|
573
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
606
574
|
|
607
|
-
|
608
|
-
contains the exception raised. You can use it to detect the presence
|
609
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
610
|
-
are missing.
|
575
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
611
576
|
|
612
577
|
Parameters
|
613
578
|
----------
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
579
|
+
type : str, default 'default'
|
580
|
+
Card type.
|
581
|
+
id : str, optional, default None
|
582
|
+
If multiple cards are present, use this id to identify this card.
|
583
|
+
options : Dict[str, Any], default {}
|
584
|
+
Options passed to the card. The contents depend on the card type.
|
585
|
+
timeout : int, default 45
|
586
|
+
Interrupt reporting if it takes more than this many seconds.
|
587
|
+
|
588
|
+
|
620
589
|
"""
|
621
590
|
...
|
622
591
|
|
623
592
|
@typing.overload
|
624
|
-
def
|
593
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
625
594
|
...
|
626
595
|
|
627
596
|
@typing.overload
|
628
|
-
def
|
597
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
629
598
|
...
|
630
599
|
|
631
|
-
def
|
600
|
+
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):
|
632
601
|
"""
|
633
|
-
|
602
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
634
603
|
|
635
|
-
|
636
|
-
contains the exception raised. You can use it to detect the presence
|
637
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
638
|
-
are missing.
|
604
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
639
605
|
|
640
606
|
Parameters
|
641
607
|
----------
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
608
|
+
type : str, default 'default'
|
609
|
+
Card type.
|
610
|
+
id : str, optional, default None
|
611
|
+
If multiple cards are present, use this id to identify this card.
|
612
|
+
options : Dict[str, Any], default {}
|
613
|
+
Options passed to the card. The contents depend on the card type.
|
614
|
+
timeout : int, default 45
|
615
|
+
Interrupt reporting if it takes more than this many seconds.
|
616
|
+
|
617
|
+
|
648
618
|
"""
|
649
619
|
...
|
650
620
|
|
@@ -701,119 +671,6 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
701
671
|
"""
|
702
672
|
...
|
703
673
|
|
704
|
-
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, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], 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) -> 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]]]:
|
705
|
-
"""
|
706
|
-
Specifies that this step should execute on Kubernetes.
|
707
|
-
|
708
|
-
Parameters
|
709
|
-
----------
|
710
|
-
cpu : int, default 1
|
711
|
-
Number of CPUs required for this step. If `@resources` is
|
712
|
-
also present, the maximum value from all decorators is used.
|
713
|
-
memory : int, default 4096
|
714
|
-
Memory size (in MB) required for this step. If
|
715
|
-
`@resources` is also present, the maximum value from all decorators is
|
716
|
-
used.
|
717
|
-
disk : int, default 10240
|
718
|
-
Disk size (in MB) required for this step. If
|
719
|
-
`@resources` is also present, the maximum value from all decorators is
|
720
|
-
used.
|
721
|
-
image : str, optional, default None
|
722
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
723
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
724
|
-
not, a default Docker image mapping to the current version of Python is used.
|
725
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
726
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
727
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
728
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
729
|
-
secrets : List[str], optional, default None
|
730
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
731
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
732
|
-
in Metaflow configuration.
|
733
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
734
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
735
|
-
gpu : int, optional, default None
|
736
|
-
Number of GPUs required for this step. A value of zero implies that
|
737
|
-
the scheduled node should not have GPUs.
|
738
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
739
|
-
The vendor of the GPUs to be used for this step.
|
740
|
-
tolerations : List[str], default []
|
741
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
742
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
743
|
-
use_tmpfs : bool, default False
|
744
|
-
This enables an explicit tmpfs mount for this step.
|
745
|
-
tmpfs_tempdir : bool, default True
|
746
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
747
|
-
tmpfs_size : int, optional, default: None
|
748
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
749
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
750
|
-
memory allocated for this step.
|
751
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
752
|
-
Path to tmpfs mount for this step.
|
753
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
754
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
755
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
756
|
-
shared_memory: int, optional
|
757
|
-
Shared memory size (in MiB) required for this step
|
758
|
-
port: int, optional
|
759
|
-
Port number to specify in the Kubernetes job object
|
760
|
-
compute_pool : str, optional, default None
|
761
|
-
Compute pool to be used for for this step.
|
762
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
763
|
-
"""
|
764
|
-
...
|
765
|
-
|
766
|
-
@typing.overload
|
767
|
-
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]]]:
|
768
|
-
"""
|
769
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
770
|
-
|
771
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
772
|
-
|
773
|
-
Parameters
|
774
|
-
----------
|
775
|
-
type : str, default 'default'
|
776
|
-
Card type.
|
777
|
-
id : str, optional, default None
|
778
|
-
If multiple cards are present, use this id to identify this card.
|
779
|
-
options : Dict[str, Any], default {}
|
780
|
-
Options passed to the card. The contents depend on the card type.
|
781
|
-
timeout : int, default 45
|
782
|
-
Interrupt reporting if it takes more than this many seconds.
|
783
|
-
|
784
|
-
|
785
|
-
"""
|
786
|
-
...
|
787
|
-
|
788
|
-
@typing.overload
|
789
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
790
|
-
...
|
791
|
-
|
792
|
-
@typing.overload
|
793
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
794
|
-
...
|
795
|
-
|
796
|
-
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):
|
797
|
-
"""
|
798
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
799
|
-
|
800
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
801
|
-
|
802
|
-
Parameters
|
803
|
-
----------
|
804
|
-
type : str, default 'default'
|
805
|
-
Card type.
|
806
|
-
id : str, optional, default None
|
807
|
-
If multiple cards are present, use this id to identify this card.
|
808
|
-
options : Dict[str, Any], default {}
|
809
|
-
Options passed to the card. The contents depend on the card type.
|
810
|
-
timeout : int, default 45
|
811
|
-
Interrupt reporting if it takes more than this many seconds.
|
812
|
-
|
813
|
-
|
814
|
-
"""
|
815
|
-
...
|
816
|
-
|
817
674
|
@typing.overload
|
818
675
|
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]]]:
|
819
676
|
"""
|
@@ -848,70 +705,90 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
848
705
|
...
|
849
706
|
|
850
707
|
@typing.overload
|
851
|
-
def
|
708
|
+
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]]]:
|
852
709
|
"""
|
853
|
-
|
854
|
-
|
710
|
+
Specifies environment variables to be set prior to the execution of a step.
|
711
|
+
|
712
|
+
Parameters
|
713
|
+
----------
|
714
|
+
vars : Dict[str, str], default {}
|
715
|
+
Dictionary of environment variables to set.
|
855
716
|
"""
|
856
717
|
...
|
857
718
|
|
858
719
|
@typing.overload
|
859
|
-
def
|
720
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
860
721
|
...
|
861
722
|
|
862
|
-
|
723
|
+
@typing.overload
|
724
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
725
|
+
...
|
726
|
+
|
727
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
863
728
|
"""
|
864
|
-
|
865
|
-
|
729
|
+
Specifies environment variables to be set prior to the execution of a step.
|
730
|
+
|
731
|
+
Parameters
|
732
|
+
----------
|
733
|
+
vars : Dict[str, str], default {}
|
734
|
+
Dictionary of environment variables to set.
|
866
735
|
"""
|
867
736
|
...
|
868
737
|
|
869
738
|
@typing.overload
|
870
|
-
def
|
739
|
+
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]]]:
|
871
740
|
"""
|
872
|
-
Specifies
|
741
|
+
Specifies a timeout for your step.
|
873
742
|
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
743
|
+
This decorator is useful if this step may hang indefinitely.
|
744
|
+
|
745
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
746
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
747
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
748
|
+
|
749
|
+
Note that all the values specified in parameters are added together so if you specify
|
750
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
878
751
|
|
879
752
|
Parameters
|
880
753
|
----------
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
754
|
+
seconds : int, default 0
|
755
|
+
Number of seconds to wait prior to timing out.
|
756
|
+
minutes : int, default 0
|
757
|
+
Number of minutes to wait prior to timing out.
|
758
|
+
hours : int, default 0
|
759
|
+
Number of hours to wait prior to timing out.
|
887
760
|
"""
|
888
761
|
...
|
889
762
|
|
890
763
|
@typing.overload
|
891
|
-
def
|
764
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
892
765
|
...
|
893
766
|
|
894
767
|
@typing.overload
|
895
|
-
def
|
768
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
896
769
|
...
|
897
770
|
|
898
|
-
def
|
771
|
+
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):
|
899
772
|
"""
|
900
|
-
Specifies
|
773
|
+
Specifies a timeout for your step.
|
901
774
|
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
775
|
+
This decorator is useful if this step may hang indefinitely.
|
776
|
+
|
777
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
778
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
779
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
780
|
+
|
781
|
+
Note that all the values specified in parameters are added together so if you specify
|
782
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
906
783
|
|
907
784
|
Parameters
|
908
785
|
----------
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
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.
|
915
792
|
"""
|
916
793
|
...
|
917
794
|
|
@@ -993,139 +870,125 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
993
870
|
...
|
994
871
|
|
995
872
|
@typing.overload
|
996
|
-
def
|
873
|
+
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]]]:
|
997
874
|
"""
|
998
|
-
Specifies the
|
999
|
-
|
1000
|
-
```
|
1001
|
-
@trigger(event='foo')
|
1002
|
-
```
|
1003
|
-
or
|
1004
|
-
```
|
1005
|
-
@trigger(events=['foo', 'bar'])
|
1006
|
-
```
|
1007
|
-
|
1008
|
-
Additionally, you can specify the parameter mappings
|
1009
|
-
to map event payload to Metaflow parameters for the flow.
|
1010
|
-
```
|
1011
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1012
|
-
```
|
1013
|
-
or
|
1014
|
-
```
|
1015
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1016
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1017
|
-
```
|
875
|
+
Specifies that the step will success under all circumstances.
|
1018
876
|
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
This is equivalent to:
|
1024
|
-
```
|
1025
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1026
|
-
```
|
877
|
+
The decorator will create an optional artifact, specified by `var`, which
|
878
|
+
contains the exception raised. You can use it to detect the presence
|
879
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
880
|
+
are missing.
|
1027
881
|
|
1028
882
|
Parameters
|
1029
883
|
----------
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
884
|
+
var : str, optional, default None
|
885
|
+
Name of the artifact in which to store the caught exception.
|
886
|
+
If not specified, the exception is not stored.
|
887
|
+
print_exception : bool, default True
|
888
|
+
Determines whether or not the exception is printed to
|
889
|
+
stdout when caught.
|
1038
890
|
"""
|
1039
891
|
...
|
1040
892
|
|
1041
893
|
@typing.overload
|
1042
|
-
def
|
894
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1043
895
|
...
|
1044
896
|
|
1045
|
-
|
897
|
+
@typing.overload
|
898
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
899
|
+
...
|
900
|
+
|
901
|
+
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):
|
1046
902
|
"""
|
1047
|
-
Specifies the
|
903
|
+
Specifies that the step will success under all circumstances.
|
1048
904
|
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
```
|
1054
|
-
@trigger(events=['foo', 'bar'])
|
1055
|
-
```
|
1056
|
-
|
1057
|
-
Additionally, you can specify the parameter mappings
|
1058
|
-
to map event payload to Metaflow parameters for the flow.
|
1059
|
-
```
|
1060
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1061
|
-
```
|
1062
|
-
or
|
1063
|
-
```
|
1064
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1065
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1066
|
-
```
|
1067
|
-
|
1068
|
-
'parameters' can also be a list of strings and tuples like so:
|
1069
|
-
```
|
1070
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1071
|
-
```
|
1072
|
-
This is equivalent to:
|
1073
|
-
```
|
1074
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1075
|
-
```
|
905
|
+
The decorator will create an optional artifact, specified by `var`, which
|
906
|
+
contains the exception raised. You can use it to detect the presence
|
907
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
908
|
+
are missing.
|
1076
909
|
|
1077
910
|
Parameters
|
1078
911
|
----------
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
912
|
+
var : str, optional, default None
|
913
|
+
Name of the artifact in which to store the caught exception.
|
914
|
+
If not specified, the exception is not stored.
|
915
|
+
print_exception : bool, default True
|
916
|
+
Determines whether or not the exception is printed to
|
917
|
+
stdout when caught.
|
918
|
+
"""
|
919
|
+
...
|
920
|
+
|
921
|
+
@typing.overload
|
922
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
923
|
+
"""
|
924
|
+
Internal decorator to support Fast bakery
|
925
|
+
"""
|
926
|
+
...
|
927
|
+
|
928
|
+
@typing.overload
|
929
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
930
|
+
...
|
931
|
+
|
932
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
933
|
+
"""
|
934
|
+
Internal decorator to support Fast bakery
|
935
|
+
"""
|
936
|
+
...
|
937
|
+
|
938
|
+
@typing.overload
|
939
|
+
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]]]:
|
940
|
+
"""
|
941
|
+
Specifies the Conda environment for the step.
|
1085
942
|
|
943
|
+
Information in this decorator will augment any
|
944
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
945
|
+
you can use `@conda_base` to set packages required by all
|
946
|
+
steps and use `@conda` to specify step-specific overrides.
|
1086
947
|
|
948
|
+
Parameters
|
949
|
+
----------
|
950
|
+
packages : Dict[str, str], default {}
|
951
|
+
Packages to use for this step. The key is the name of the package
|
952
|
+
and the value is the version to use.
|
953
|
+
libraries : Dict[str, str], default {}
|
954
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
955
|
+
python : str, optional, default None
|
956
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
957
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
958
|
+
disabled : bool, default False
|
959
|
+
If set to True, disables @conda.
|
1087
960
|
"""
|
1088
961
|
...
|
1089
962
|
|
1090
|
-
|
963
|
+
@typing.overload
|
964
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
965
|
+
...
|
966
|
+
|
967
|
+
@typing.overload
|
968
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
969
|
+
...
|
970
|
+
|
971
|
+
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):
|
1091
972
|
"""
|
1092
|
-
|
1093
|
-
|
973
|
+
Specifies the Conda environment for the step.
|
974
|
+
|
975
|
+
Information in this decorator will augment any
|
976
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
977
|
+
you can use `@conda_base` to set packages required by all
|
978
|
+
steps and use `@conda` to specify step-specific overrides.
|
1094
979
|
|
1095
980
|
Parameters
|
1096
981
|
----------
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1108
|
-
soft_fail : bool
|
1109
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1110
|
-
name : str
|
1111
|
-
Name of the sensor on Airflow
|
1112
|
-
description : str
|
1113
|
-
Description of sensor in the Airflow UI
|
1114
|
-
external_dag_id : str
|
1115
|
-
The dag_id that contains the task you want to wait for.
|
1116
|
-
external_task_ids : List[str]
|
1117
|
-
The list of task_ids that you want to wait for.
|
1118
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1119
|
-
allowed_states : List[str]
|
1120
|
-
Iterable of allowed states, (Default: ['success'])
|
1121
|
-
failed_states : List[str]
|
1122
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1123
|
-
execution_delta : datetime.timedelta
|
1124
|
-
time difference with the previous execution to look at,
|
1125
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1126
|
-
check_existence: bool
|
1127
|
-
Set to True to check if the external task exists or check if
|
1128
|
-
the DAG to wait for exists. (Default: True)
|
982
|
+
packages : Dict[str, str], default {}
|
983
|
+
Packages to use for this step. The key is the name of the package
|
984
|
+
and the value is the version to use.
|
985
|
+
libraries : Dict[str, str], default {}
|
986
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
987
|
+
python : str, optional, default None
|
988
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
989
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
990
|
+
disabled : bool, default False
|
991
|
+
If set to True, disables @conda.
|
1129
992
|
"""
|
1130
993
|
...
|
1131
994
|
|
@@ -1178,6 +1041,73 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1178
1041
|
"""
|
1179
1042
|
...
|
1180
1043
|
|
1044
|
+
@typing.overload
|
1045
|
+
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]]:
|
1046
|
+
"""
|
1047
|
+
Specifies the Conda environment for all steps of the flow.
|
1048
|
+
|
1049
|
+
Use `@conda_base` to set common libraries required by all
|
1050
|
+
steps and use `@conda` to specify step-specific additions.
|
1051
|
+
|
1052
|
+
Parameters
|
1053
|
+
----------
|
1054
|
+
packages : Dict[str, str], default {}
|
1055
|
+
Packages to use for this flow. The key is the name of the package
|
1056
|
+
and the value is the version to use.
|
1057
|
+
libraries : Dict[str, str], default {}
|
1058
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1059
|
+
python : str, optional, default None
|
1060
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1061
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1062
|
+
disabled : bool, default False
|
1063
|
+
If set to True, disables Conda.
|
1064
|
+
"""
|
1065
|
+
...
|
1066
|
+
|
1067
|
+
@typing.overload
|
1068
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1069
|
+
...
|
1070
|
+
|
1071
|
+
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):
|
1072
|
+
"""
|
1073
|
+
Specifies the Conda environment for all steps of the flow.
|
1074
|
+
|
1075
|
+
Use `@conda_base` to set common libraries required by all
|
1076
|
+
steps and use `@conda` to specify step-specific additions.
|
1077
|
+
|
1078
|
+
Parameters
|
1079
|
+
----------
|
1080
|
+
packages : Dict[str, str], default {}
|
1081
|
+
Packages to use for this flow. The key is the name of the package
|
1082
|
+
and the value is the version to use.
|
1083
|
+
libraries : Dict[str, str], default {}
|
1084
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1085
|
+
python : str, optional, default None
|
1086
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1087
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1088
|
+
disabled : bool, default False
|
1089
|
+
If set to True, disables Conda.
|
1090
|
+
"""
|
1091
|
+
...
|
1092
|
+
|
1093
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1094
|
+
"""
|
1095
|
+
Specifies what flows belong to the same project.
|
1096
|
+
|
1097
|
+
A project-specific namespace is created for all flows that
|
1098
|
+
use the same `@project(name)`.
|
1099
|
+
|
1100
|
+
Parameters
|
1101
|
+
----------
|
1102
|
+
name : str
|
1103
|
+
Project name. Make sure that the name is unique amongst all
|
1104
|
+
projects that use the same production scheduler. The name may
|
1105
|
+
contain only lowercase alphanumeric characters and underscores.
|
1106
|
+
|
1107
|
+
|
1108
|
+
"""
|
1109
|
+
...
|
1110
|
+
|
1181
1111
|
@typing.overload
|
1182
1112
|
def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[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]]:
|
1183
1113
|
"""
|
@@ -1281,52 +1211,45 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1281
1211
|
"""
|
1282
1212
|
...
|
1283
1213
|
|
1284
|
-
def
|
1214
|
+
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]]:
|
1285
1215
|
"""
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1216
|
+
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)
|
1217
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1218
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1219
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1220
|
+
starts only after all sensors finish.
|
1290
1221
|
|
1291
1222
|
Parameters
|
1292
1223
|
----------
|
1224
|
+
timeout : int
|
1225
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1226
|
+
poke_interval : int
|
1227
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1228
|
+
mode : str
|
1229
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1230
|
+
exponential_backoff : bool
|
1231
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1232
|
+
pool : str
|
1233
|
+
the slot pool this task should run in,
|
1234
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1235
|
+
soft_fail : bool
|
1236
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1293
1237
|
name : str
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1310
|
-
backend='managed'
|
1311
|
-
)
|
1312
|
-
|
1313
|
-
Valid backend options
|
1314
|
-
---------------------
|
1315
|
-
- 'managed': Outerbounds selects a compute provider based on the model.
|
1316
|
-
- 🚧 'dataplane': Run in your account.
|
1317
|
-
|
1318
|
-
Valid model options
|
1319
|
-
----------------
|
1320
|
-
- 'meta/llama3-8b-instruct': 8B parameter model
|
1321
|
-
- 'meta/llama3-70b-instruct': 70B parameter model
|
1322
|
-
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1323
|
-
|
1324
|
-
Parameters
|
1325
|
-
----------
|
1326
|
-
models: list[NIM]
|
1327
|
-
List of NIM containers running models in sidecars.
|
1328
|
-
backend: str
|
1329
|
-
Compute provider to run the NIM container.
|
1238
|
+
Name of the sensor on Airflow
|
1239
|
+
description : str
|
1240
|
+
Description of sensor in the Airflow UI
|
1241
|
+
bucket_key : Union[str, List[str]]
|
1242
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1243
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1244
|
+
bucket_name : str
|
1245
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1246
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1247
|
+
wildcard_match : bool
|
1248
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1249
|
+
aws_conn_id : str
|
1250
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1251
|
+
verify : bool
|
1252
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1330
1253
|
"""
|
1331
1254
|
...
|
1332
1255
|
|
@@ -1369,62 +1292,41 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
1369
1292
|
"""
|
1370
1293
|
...
|
1371
1294
|
|
1372
|
-
|
1373
|
-
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]]:
|
1295
|
+
def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1374
1296
|
"""
|
1375
|
-
|
1297
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1376
1298
|
|
1377
|
-
|
1378
|
-
|
1299
|
+
User code call
|
1300
|
+
-----------
|
1301
|
+
@nim(
|
1302
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1303
|
+
backend='managed'
|
1304
|
+
)
|
1379
1305
|
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
and the value is the version to use.
|
1385
|
-
libraries : Dict[str, str], default {}
|
1386
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1387
|
-
python : str, optional, default None
|
1388
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1389
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1390
|
-
disabled : bool, default False
|
1391
|
-
If set to True, disables Conda.
|
1392
|
-
"""
|
1393
|
-
...
|
1394
|
-
|
1395
|
-
@typing.overload
|
1396
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1397
|
-
...
|
1398
|
-
|
1399
|
-
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):
|
1400
|
-
"""
|
1401
|
-
Specifies the Conda environment for all steps of the flow.
|
1306
|
+
Valid backend options
|
1307
|
+
---------------------
|
1308
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
1309
|
+
- 🚧 'dataplane': Run in your account.
|
1402
1310
|
|
1403
|
-
|
1404
|
-
|
1311
|
+
Valid model options
|
1312
|
+
----------------
|
1313
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
1314
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
1315
|
+
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1405
1316
|
|
1406
1317
|
Parameters
|
1407
1318
|
----------
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1413
|
-
python : str, optional, default None
|
1414
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1415
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1416
|
-
disabled : bool, default False
|
1417
|
-
If set to True, disables Conda.
|
1319
|
+
models: list[NIM]
|
1320
|
+
List of NIM containers running models in sidecars.
|
1321
|
+
backend: str
|
1322
|
+
Compute provider to run the NIM container.
|
1418
1323
|
"""
|
1419
1324
|
...
|
1420
1325
|
|
1421
|
-
def
|
1326
|
+
def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1422
1327
|
"""
|
1423
|
-
The `@
|
1424
|
-
|
1425
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1426
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1427
|
-
starts only after all sensors finish.
|
1328
|
+
The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
|
1329
|
+
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1428
1330
|
|
1429
1331
|
Parameters
|
1430
1332
|
----------
|
@@ -1445,18 +1347,116 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1445
1347
|
Name of the sensor on Airflow
|
1446
1348
|
description : str
|
1447
1349
|
Description of sensor in the Airflow UI
|
1448
|
-
|
1449
|
-
The
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1350
|
+
external_dag_id : str
|
1351
|
+
The dag_id that contains the task you want to wait for.
|
1352
|
+
external_task_ids : List[str]
|
1353
|
+
The list of task_ids that you want to wait for.
|
1354
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1355
|
+
allowed_states : List[str]
|
1356
|
+
Iterable of allowed states, (Default: ['success'])
|
1357
|
+
failed_states : List[str]
|
1358
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1359
|
+
execution_delta : datetime.timedelta
|
1360
|
+
time difference with the previous execution to look at,
|
1361
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1362
|
+
check_existence: bool
|
1363
|
+
Set to True to check if the external task exists or check if
|
1364
|
+
the DAG to wait for exists. (Default: True)
|
1365
|
+
"""
|
1366
|
+
...
|
1367
|
+
|
1368
|
+
@typing.overload
|
1369
|
+
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]]:
|
1370
|
+
"""
|
1371
|
+
Specifies the event(s) that this flow depends on.
|
1372
|
+
|
1373
|
+
```
|
1374
|
+
@trigger(event='foo')
|
1375
|
+
```
|
1376
|
+
or
|
1377
|
+
```
|
1378
|
+
@trigger(events=['foo', 'bar'])
|
1379
|
+
```
|
1380
|
+
|
1381
|
+
Additionally, you can specify the parameter mappings
|
1382
|
+
to map event payload to Metaflow parameters for the flow.
|
1383
|
+
```
|
1384
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1385
|
+
```
|
1386
|
+
or
|
1387
|
+
```
|
1388
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1389
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1390
|
+
```
|
1391
|
+
|
1392
|
+
'parameters' can also be a list of strings and tuples like so:
|
1393
|
+
```
|
1394
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1395
|
+
```
|
1396
|
+
This is equivalent to:
|
1397
|
+
```
|
1398
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1399
|
+
```
|
1400
|
+
|
1401
|
+
Parameters
|
1402
|
+
----------
|
1403
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1404
|
+
Event dependency for this flow.
|
1405
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1406
|
+
Events dependency for this flow.
|
1407
|
+
options : Dict[str, Any], default {}
|
1408
|
+
Backend-specific configuration for tuning eventing behavior.
|
1409
|
+
|
1410
|
+
|
1411
|
+
"""
|
1412
|
+
...
|
1413
|
+
|
1414
|
+
@typing.overload
|
1415
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1416
|
+
...
|
1417
|
+
|
1418
|
+
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] = {}):
|
1419
|
+
"""
|
1420
|
+
Specifies the event(s) that this flow depends on.
|
1421
|
+
|
1422
|
+
```
|
1423
|
+
@trigger(event='foo')
|
1424
|
+
```
|
1425
|
+
or
|
1426
|
+
```
|
1427
|
+
@trigger(events=['foo', 'bar'])
|
1428
|
+
```
|
1429
|
+
|
1430
|
+
Additionally, you can specify the parameter mappings
|
1431
|
+
to map event payload to Metaflow parameters for the flow.
|
1432
|
+
```
|
1433
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1434
|
+
```
|
1435
|
+
or
|
1436
|
+
```
|
1437
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1438
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1439
|
+
```
|
1440
|
+
|
1441
|
+
'parameters' can also be a list of strings and tuples like so:
|
1442
|
+
```
|
1443
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1444
|
+
```
|
1445
|
+
This is equivalent to:
|
1446
|
+
```
|
1447
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1448
|
+
```
|
1449
|
+
|
1450
|
+
Parameters
|
1451
|
+
----------
|
1452
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1453
|
+
Event dependency for this flow.
|
1454
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1455
|
+
Events dependency for this flow.
|
1456
|
+
options : Dict[str, Any], default {}
|
1457
|
+
Backend-specific configuration for tuning eventing behavior.
|
1458
|
+
|
1459
|
+
|
1460
1460
|
"""
|
1461
1461
|
...
|
1462
1462
|
|