ob-metaflow-stubs 6.0.3.102rc5__py2.py3-none-any.whl → 6.0.3.102rc6__py2.py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- metaflow-stubs/__init__.pyi +555 -555
- metaflow-stubs/cards.pyi +3 -3
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +6 -6
- metaflow-stubs/client/filecache.pyi +1 -1
- metaflow-stubs/clone_util.pyi +1 -1
- metaflow-stubs/events.pyi +1 -1
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +3 -3
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +2 -2
- metaflow-stubs/info_file.pyi +1 -1
- metaflow-stubs/metadata/metadata.pyi +2 -2
- metaflow-stubs/metadata/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +51 -51
- 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 +2 -2
- 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 +1 -1
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
- 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 +5 -5
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +6 -6
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
- 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 +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +1 -1
- 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 +1 -1
- 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 +3 -3
- 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 +1 -1
- metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
- metaflow-stubs/plugins/cards/component_serializer.pyi +3 -3
- metaflow-stubs/plugins/cards/exception.pyi +1 -1
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- 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 +1 -1
- 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/kube_utils.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/logs_cli.pyi +2 -2
- 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 +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- 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 +1 -1
- metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
- 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 +3 -3
- 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-6.0.3.102rc5.dist-info → ob_metaflow_stubs-6.0.3.102rc6.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.102rc6.dist-info/RECORD +140 -0
- ob_metaflow_stubs-6.0.3.102rc5.dist-info/RECORD +0 -140
- {ob_metaflow_stubs-6.0.3.102rc5.dist-info → ob_metaflow_stubs-6.0.3.102rc6.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.102rc5.dist-info → ob_metaflow_stubs-6.0.3.102rc6.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
3
|
# MF version: 2.12.22.1+obcheckpoint(0.0.10);ob(v1) #
|
4
|
-
# Generated on 2024-09-20T19:
|
4
|
+
# Generated on 2024-09-20T19:23:06.789979 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import
|
11
|
+
import datetime
|
12
12
|
import metaflow.parameters
|
13
|
+
import metaflow.events
|
13
14
|
import metaflow._vendor.click.types
|
14
|
-
import
|
15
|
+
import typing
|
15
16
|
import metaflow.client.core
|
16
|
-
import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
|
17
17
|
import metaflow.datastore.inputs
|
18
|
-
import metaflow.events
|
19
|
-
import datetime
|
20
18
|
import metaflow.flowspec
|
21
|
-
import
|
19
|
+
import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
|
20
|
+
import metaflow.metaflow_current
|
21
|
+
import metaflow.runner.metaflow_runner
|
22
22
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
23
23
|
StepFlag = typing.NewType("StepFlag", bool)
|
24
24
|
|
@@ -434,6 +434,63 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
434
434
|
"""
|
435
435
|
...
|
436
436
|
|
437
|
+
@typing.overload
|
438
|
+
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]]]:
|
439
|
+
"""
|
440
|
+
Specifies a timeout for your step.
|
441
|
+
|
442
|
+
This decorator is useful if this step may hang indefinitely.
|
443
|
+
|
444
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
445
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
446
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
447
|
+
|
448
|
+
Note that all the values specified in parameters are added together so if you specify
|
449
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
450
|
+
|
451
|
+
Parameters
|
452
|
+
----------
|
453
|
+
seconds : int, default 0
|
454
|
+
Number of seconds to wait prior to timing out.
|
455
|
+
minutes : int, default 0
|
456
|
+
Number of minutes to wait prior to timing out.
|
457
|
+
hours : int, default 0
|
458
|
+
Number of hours to wait prior to timing out.
|
459
|
+
"""
|
460
|
+
...
|
461
|
+
|
462
|
+
@typing.overload
|
463
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
464
|
+
...
|
465
|
+
|
466
|
+
@typing.overload
|
467
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
468
|
+
...
|
469
|
+
|
470
|
+
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):
|
471
|
+
"""
|
472
|
+
Specifies a timeout for your step.
|
473
|
+
|
474
|
+
This decorator is useful if this step may hang indefinitely.
|
475
|
+
|
476
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
477
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
478
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
479
|
+
|
480
|
+
Note that all the values specified in parameters are added together so if you specify
|
481
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
482
|
+
|
483
|
+
Parameters
|
484
|
+
----------
|
485
|
+
seconds : int, default 0
|
486
|
+
Number of seconds to wait prior to timing out.
|
487
|
+
minutes : int, default 0
|
488
|
+
Number of minutes to wait prior to timing out.
|
489
|
+
hours : int, default 0
|
490
|
+
Number of hours to wait prior to timing out.
|
491
|
+
"""
|
492
|
+
...
|
493
|
+
|
437
494
|
@typing.overload
|
438
495
|
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]]]:
|
439
496
|
"""
|
@@ -524,72 +581,6 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
524
581
|
"""
|
525
582
|
...
|
526
583
|
|
527
|
-
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] = [], 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]]]:
|
528
|
-
"""
|
529
|
-
Specifies that this step should execute on Kubernetes.
|
530
|
-
|
531
|
-
Parameters
|
532
|
-
----------
|
533
|
-
cpu : int, default 1
|
534
|
-
Number of CPUs required for this step. If `@resources` is
|
535
|
-
also present, the maximum value from all decorators is used.
|
536
|
-
memory : int, default 4096
|
537
|
-
Memory size (in MB) required for this step. If
|
538
|
-
`@resources` is also present, the maximum value from all decorators is
|
539
|
-
used.
|
540
|
-
disk : int, default 10240
|
541
|
-
Disk size (in MB) required for this step. If
|
542
|
-
`@resources` is also present, the maximum value from all decorators is
|
543
|
-
used.
|
544
|
-
image : str, optional, default None
|
545
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
546
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
547
|
-
not, a default Docker image mapping to the current version of Python is used.
|
548
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
549
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
550
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
551
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
552
|
-
secrets : List[str], optional, default None
|
553
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
554
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
555
|
-
in Metaflow configuration.
|
556
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
557
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
558
|
-
Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
|
559
|
-
or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
|
560
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
561
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
562
|
-
gpu : int, optional, default None
|
563
|
-
Number of GPUs required for this step. A value of zero implies that
|
564
|
-
the scheduled node should not have GPUs.
|
565
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
566
|
-
The vendor of the GPUs to be used for this step.
|
567
|
-
tolerations : List[str], default []
|
568
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
569
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
570
|
-
use_tmpfs : bool, default False
|
571
|
-
This enables an explicit tmpfs mount for this step.
|
572
|
-
tmpfs_tempdir : bool, default True
|
573
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
574
|
-
tmpfs_size : int, optional, default: None
|
575
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
576
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
577
|
-
memory allocated for this step.
|
578
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
579
|
-
Path to tmpfs mount for this step.
|
580
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
581
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
582
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
583
|
-
shared_memory: int, optional
|
584
|
-
Shared memory size (in MiB) required for this step
|
585
|
-
port: int, optional
|
586
|
-
Port number to specify in the Kubernetes job object
|
587
|
-
compute_pool : str, optional, default None
|
588
|
-
Compute pool to be used for for this step.
|
589
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
590
|
-
"""
|
591
|
-
...
|
592
|
-
|
593
584
|
@typing.overload
|
594
585
|
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]]]:
|
595
586
|
"""
|
@@ -639,6 +630,23 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
639
630
|
"""
|
640
631
|
...
|
641
632
|
|
633
|
+
@typing.overload
|
634
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
635
|
+
"""
|
636
|
+
Internal decorator to support Fast bakery
|
637
|
+
"""
|
638
|
+
...
|
639
|
+
|
640
|
+
@typing.overload
|
641
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
642
|
+
...
|
643
|
+
|
644
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
645
|
+
"""
|
646
|
+
Internal decorator to support Fast bakery
|
647
|
+
"""
|
648
|
+
...
|
649
|
+
|
642
650
|
@typing.overload
|
643
651
|
def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: 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]]]:
|
644
652
|
"""
|
@@ -700,6 +708,37 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
700
708
|
"""
|
701
709
|
...
|
702
710
|
|
711
|
+
@typing.overload
|
712
|
+
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]]]:
|
713
|
+
"""
|
714
|
+
Specifies environment variables to be set prior to the execution of a step.
|
715
|
+
|
716
|
+
Parameters
|
717
|
+
----------
|
718
|
+
vars : Dict[str, str], default {}
|
719
|
+
Dictionary of environment variables to set.
|
720
|
+
"""
|
721
|
+
...
|
722
|
+
|
723
|
+
@typing.overload
|
724
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
725
|
+
...
|
726
|
+
|
727
|
+
@typing.overload
|
728
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
729
|
+
...
|
730
|
+
|
731
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
732
|
+
"""
|
733
|
+
Specifies environment variables to be set prior to the execution of a step.
|
734
|
+
|
735
|
+
Parameters
|
736
|
+
----------
|
737
|
+
vars : Dict[str, str], default {}
|
738
|
+
Dictionary of environment variables to set.
|
739
|
+
"""
|
740
|
+
...
|
741
|
+
|
703
742
|
@typing.overload
|
704
743
|
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]]]:
|
705
744
|
"""
|
@@ -749,97 +788,76 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
749
788
|
"""
|
750
789
|
...
|
751
790
|
|
791
|
+
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] = [], 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]]]:
|
792
|
+
"""
|
793
|
+
Specifies that this step should execute on Kubernetes.
|
794
|
+
|
795
|
+
Parameters
|
796
|
+
----------
|
797
|
+
cpu : int, default 1
|
798
|
+
Number of CPUs required for this step. If `@resources` is
|
799
|
+
also present, the maximum value from all decorators is used.
|
800
|
+
memory : int, default 4096
|
801
|
+
Memory size (in MB) required for this step. If
|
802
|
+
`@resources` is also present, the maximum value from all decorators is
|
803
|
+
used.
|
804
|
+
disk : int, default 10240
|
805
|
+
Disk size (in MB) required for this step. If
|
806
|
+
`@resources` is also present, the maximum value from all decorators is
|
807
|
+
used.
|
808
|
+
image : str, optional, default None
|
809
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
810
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
811
|
+
not, a default Docker image mapping to the current version of Python is used.
|
812
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
813
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
814
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
815
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
816
|
+
secrets : List[str], optional, default None
|
817
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
818
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
819
|
+
in Metaflow configuration.
|
820
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
821
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
822
|
+
Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
|
823
|
+
or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
|
824
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
825
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
826
|
+
gpu : int, optional, default None
|
827
|
+
Number of GPUs required for this step. A value of zero implies that
|
828
|
+
the scheduled node should not have GPUs.
|
829
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
830
|
+
The vendor of the GPUs to be used for this step.
|
831
|
+
tolerations : List[str], default []
|
832
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
833
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
834
|
+
use_tmpfs : bool, default False
|
835
|
+
This enables an explicit tmpfs mount for this step.
|
836
|
+
tmpfs_tempdir : bool, default True
|
837
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
838
|
+
tmpfs_size : int, optional, default: None
|
839
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
840
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
841
|
+
memory allocated for this step.
|
842
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
843
|
+
Path to tmpfs mount for this step.
|
844
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
845
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
846
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
847
|
+
shared_memory: int, optional
|
848
|
+
Shared memory size (in MiB) required for this step
|
849
|
+
port: int, optional
|
850
|
+
Port number to specify in the Kubernetes job object
|
851
|
+
compute_pool : str, optional, default None
|
852
|
+
Compute pool to be used for for this step.
|
853
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
854
|
+
"""
|
855
|
+
...
|
856
|
+
|
752
857
|
@typing.overload
|
753
|
-
def
|
858
|
+
def checkpoint(*, load_policy: str = "fresh", temp_dir_root: 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]]]:
|
754
859
|
"""
|
755
|
-
|
756
|
-
|
757
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
758
|
-
|
759
|
-
Parameters
|
760
|
-
----------
|
761
|
-
type : str, default 'default'
|
762
|
-
Card type.
|
763
|
-
id : str, optional, default None
|
764
|
-
If multiple cards are present, use this id to identify this card.
|
765
|
-
options : Dict[str, Any], default {}
|
766
|
-
Options passed to the card. The contents depend on the card type.
|
767
|
-
timeout : int, default 45
|
768
|
-
Interrupt reporting if it takes more than this many seconds.
|
769
|
-
|
770
|
-
|
771
|
-
"""
|
772
|
-
...
|
773
|
-
|
774
|
-
@typing.overload
|
775
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
776
|
-
...
|
777
|
-
|
778
|
-
@typing.overload
|
779
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
780
|
-
...
|
781
|
-
|
782
|
-
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):
|
783
|
-
"""
|
784
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
785
|
-
|
786
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
787
|
-
|
788
|
-
Parameters
|
789
|
-
----------
|
790
|
-
type : str, default 'default'
|
791
|
-
Card type.
|
792
|
-
id : str, optional, default None
|
793
|
-
If multiple cards are present, use this id to identify this card.
|
794
|
-
options : Dict[str, Any], default {}
|
795
|
-
Options passed to the card. The contents depend on the card type.
|
796
|
-
timeout : int, default 45
|
797
|
-
Interrupt reporting if it takes more than this many seconds.
|
798
|
-
|
799
|
-
|
800
|
-
"""
|
801
|
-
...
|
802
|
-
|
803
|
-
@typing.overload
|
804
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
805
|
-
"""
|
806
|
-
Internal decorator to support Fast bakery
|
807
|
-
"""
|
808
|
-
...
|
809
|
-
|
810
|
-
@typing.overload
|
811
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
812
|
-
...
|
813
|
-
|
814
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
815
|
-
"""
|
816
|
-
Internal decorator to support Fast bakery
|
817
|
-
"""
|
818
|
-
...
|
819
|
-
|
820
|
-
@typing.overload
|
821
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
822
|
-
"""
|
823
|
-
Decorator prototype for all step decorators. This function gets specialized
|
824
|
-
and imported for all decorators types by _import_plugin_decorators().
|
825
|
-
"""
|
826
|
-
...
|
827
|
-
|
828
|
-
@typing.overload
|
829
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
830
|
-
...
|
831
|
-
|
832
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
833
|
-
"""
|
834
|
-
Decorator prototype for all step decorators. This function gets specialized
|
835
|
-
and imported for all decorators types by _import_plugin_decorators().
|
836
|
-
"""
|
837
|
-
...
|
838
|
-
|
839
|
-
@typing.overload
|
840
|
-
def checkpoint(*, load_policy: str = "fresh", temp_dir_root: 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]]]:
|
841
|
-
"""
|
842
|
-
Enables checkpointing for a step.
|
860
|
+
Enables checkpointing for a step.
|
843
861
|
|
844
862
|
|
845
863
|
Parameters
|
@@ -897,6 +915,78 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
|
|
897
915
|
"""
|
898
916
|
...
|
899
917
|
|
918
|
+
@typing.overload
|
919
|
+
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]]]:
|
920
|
+
"""
|
921
|
+
Specifies the number of times the task corresponding
|
922
|
+
to a step needs to be retried.
|
923
|
+
|
924
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
925
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
926
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
927
|
+
|
928
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
929
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
930
|
+
ensuring that the flow execution can continue.
|
931
|
+
|
932
|
+
Parameters
|
933
|
+
----------
|
934
|
+
times : int, default 3
|
935
|
+
Number of times to retry this task.
|
936
|
+
minutes_between_retries : int, default 2
|
937
|
+
Number of minutes between retries.
|
938
|
+
"""
|
939
|
+
...
|
940
|
+
|
941
|
+
@typing.overload
|
942
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
943
|
+
...
|
944
|
+
|
945
|
+
@typing.overload
|
946
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
947
|
+
...
|
948
|
+
|
949
|
+
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):
|
950
|
+
"""
|
951
|
+
Specifies the number of times the task corresponding
|
952
|
+
to a step needs to be retried.
|
953
|
+
|
954
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
955
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
956
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
957
|
+
|
958
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
959
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
960
|
+
ensuring that the flow execution can continue.
|
961
|
+
|
962
|
+
Parameters
|
963
|
+
----------
|
964
|
+
times : int, default 3
|
965
|
+
Number of times to retry this task.
|
966
|
+
minutes_between_retries : int, default 2
|
967
|
+
Number of minutes between retries.
|
968
|
+
"""
|
969
|
+
...
|
970
|
+
|
971
|
+
@typing.overload
|
972
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
973
|
+
"""
|
974
|
+
Decorator prototype for all step decorators. This function gets specialized
|
975
|
+
and imported for all decorators types by _import_plugin_decorators().
|
976
|
+
"""
|
977
|
+
...
|
978
|
+
|
979
|
+
@typing.overload
|
980
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
981
|
+
...
|
982
|
+
|
983
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
984
|
+
"""
|
985
|
+
Decorator prototype for all step decorators. This function gets specialized
|
986
|
+
and imported for all decorators types by _import_plugin_decorators().
|
987
|
+
"""
|
988
|
+
...
|
989
|
+
|
900
990
|
@typing.overload
|
901
991
|
def resources(*, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
902
992
|
"""
|
@@ -975,313 +1065,111 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
975
1065
|
...
|
976
1066
|
|
977
1067
|
@typing.overload
|
978
|
-
def
|
1068
|
+
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]]]:
|
979
1069
|
"""
|
980
|
-
|
1070
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1071
|
+
|
1072
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
981
1073
|
|
982
1074
|
Parameters
|
983
1075
|
----------
|
984
|
-
|
985
|
-
|
1076
|
+
type : str, default 'default'
|
1077
|
+
Card type.
|
1078
|
+
id : str, optional, default None
|
1079
|
+
If multiple cards are present, use this id to identify this card.
|
1080
|
+
options : Dict[str, Any], default {}
|
1081
|
+
Options passed to the card. The contents depend on the card type.
|
1082
|
+
timeout : int, default 45
|
1083
|
+
Interrupt reporting if it takes more than this many seconds.
|
1084
|
+
|
1085
|
+
|
986
1086
|
"""
|
987
1087
|
...
|
988
1088
|
|
989
1089
|
@typing.overload
|
990
|
-
def
|
1090
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
991
1091
|
...
|
992
1092
|
|
993
1093
|
@typing.overload
|
994
|
-
def
|
1094
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
995
1095
|
...
|
996
1096
|
|
997
|
-
def
|
1097
|
+
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):
|
998
1098
|
"""
|
999
|
-
|
1099
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1100
|
+
|
1101
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1000
1102
|
|
1001
1103
|
Parameters
|
1002
1104
|
----------
|
1003
|
-
|
1004
|
-
|
1105
|
+
type : str, default 'default'
|
1106
|
+
Card type.
|
1107
|
+
id : str, optional, default None
|
1108
|
+
If multiple cards are present, use this id to identify this card.
|
1109
|
+
options : Dict[str, Any], default {}
|
1110
|
+
Options passed to the card. The contents depend on the card type.
|
1111
|
+
timeout : int, default 45
|
1112
|
+
Interrupt reporting if it takes more than this many seconds.
|
1113
|
+
|
1114
|
+
|
1005
1115
|
"""
|
1006
1116
|
...
|
1007
1117
|
|
1008
1118
|
@typing.overload
|
1009
|
-
def
|
1119
|
+
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]]:
|
1010
1120
|
"""
|
1011
|
-
Specifies
|
1121
|
+
Specifies the flow(s) that this flow depends on.
|
1012
1122
|
|
1013
|
-
|
1123
|
+
```
|
1124
|
+
@trigger_on_finish(flow='FooFlow')
|
1125
|
+
```
|
1126
|
+
or
|
1127
|
+
```
|
1128
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1129
|
+
```
|
1130
|
+
This decorator respects the @project decorator and triggers the flow
|
1131
|
+
when upstream runs within the same namespace complete successfully
|
1014
1132
|
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1133
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1134
|
+
by specifying the fully qualified project_flow_name.
|
1135
|
+
```
|
1136
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1137
|
+
```
|
1138
|
+
or
|
1139
|
+
```
|
1140
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1141
|
+
```
|
1018
1142
|
|
1019
|
-
|
1020
|
-
|
1143
|
+
You can also specify just the project or project branch (other values will be
|
1144
|
+
inferred from the current project or project branch):
|
1145
|
+
```
|
1146
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1147
|
+
```
|
1148
|
+
|
1149
|
+
Note that `branch` is typically one of:
|
1150
|
+
- `prod`
|
1151
|
+
- `user.bob`
|
1152
|
+
- `test.my_experiment`
|
1153
|
+
- `prod.staging`
|
1021
1154
|
|
1022
1155
|
Parameters
|
1023
1156
|
----------
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1157
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1158
|
+
Upstream flow dependency for this flow.
|
1159
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1160
|
+
Upstream flow dependencies for this flow.
|
1161
|
+
options : Dict[str, Any], default {}
|
1162
|
+
Backend-specific configuration for tuning eventing behavior.
|
1163
|
+
|
1164
|
+
|
1030
1165
|
"""
|
1031
1166
|
...
|
1032
1167
|
|
1033
1168
|
@typing.overload
|
1034
|
-
def
|
1035
|
-
...
|
1036
|
-
|
1037
|
-
@typing.overload
|
1038
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1169
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1039
1170
|
...
|
1040
1171
|
|
1041
|
-
def
|
1042
|
-
"""
|
1043
|
-
Specifies a timeout for your step.
|
1044
|
-
|
1045
|
-
This decorator is useful if this step may hang indefinitely.
|
1046
|
-
|
1047
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1048
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1049
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1050
|
-
|
1051
|
-
Note that all the values specified in parameters are added together so if you specify
|
1052
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1053
|
-
|
1054
|
-
Parameters
|
1055
|
-
----------
|
1056
|
-
seconds : int, default 0
|
1057
|
-
Number of seconds to wait prior to timing out.
|
1058
|
-
minutes : int, default 0
|
1059
|
-
Number of minutes to wait prior to timing out.
|
1060
|
-
hours : int, default 0
|
1061
|
-
Number of hours to wait prior to timing out.
|
1062
|
-
"""
|
1063
|
-
...
|
1064
|
-
|
1065
|
-
@typing.overload
|
1066
|
-
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]]]:
|
1067
|
-
"""
|
1068
|
-
Specifies the number of times the task corresponding
|
1069
|
-
to a step needs to be retried.
|
1070
|
-
|
1071
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1072
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1073
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1074
|
-
|
1075
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1076
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1077
|
-
ensuring that the flow execution can continue.
|
1078
|
-
|
1079
|
-
Parameters
|
1080
|
-
----------
|
1081
|
-
times : int, default 3
|
1082
|
-
Number of times to retry this task.
|
1083
|
-
minutes_between_retries : int, default 2
|
1084
|
-
Number of minutes between retries.
|
1085
|
-
"""
|
1086
|
-
...
|
1087
|
-
|
1088
|
-
@typing.overload
|
1089
|
-
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1090
|
-
...
|
1091
|
-
|
1092
|
-
@typing.overload
|
1093
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1094
|
-
...
|
1095
|
-
|
1096
|
-
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):
|
1097
|
-
"""
|
1098
|
-
Specifies the number of times the task corresponding
|
1099
|
-
to a step needs to be retried.
|
1100
|
-
|
1101
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1102
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1103
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1104
|
-
|
1105
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1106
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1107
|
-
ensuring that the flow execution can continue.
|
1108
|
-
|
1109
|
-
Parameters
|
1110
|
-
----------
|
1111
|
-
times : int, default 3
|
1112
|
-
Number of times to retry this task.
|
1113
|
-
minutes_between_retries : int, default 2
|
1114
|
-
Number of minutes between retries.
|
1115
|
-
"""
|
1116
|
-
...
|
1117
|
-
|
1118
|
-
@typing.overload
|
1119
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1120
|
-
"""
|
1121
|
-
Specifies the PyPI packages for all steps of the flow.
|
1122
|
-
|
1123
|
-
Use `@pypi_base` to set common packages required by all
|
1124
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1125
|
-
Parameters
|
1126
|
-
----------
|
1127
|
-
packages : Dict[str, str], default: {}
|
1128
|
-
Packages to use for this flow. The key is the name of the package
|
1129
|
-
and the value is the version to use.
|
1130
|
-
python : str, optional, default: None
|
1131
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1132
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1133
|
-
"""
|
1134
|
-
...
|
1135
|
-
|
1136
|
-
@typing.overload
|
1137
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1138
|
-
...
|
1139
|
-
|
1140
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1141
|
-
"""
|
1142
|
-
Specifies the PyPI packages for all steps of the flow.
|
1143
|
-
|
1144
|
-
Use `@pypi_base` to set common packages required by all
|
1145
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1146
|
-
Parameters
|
1147
|
-
----------
|
1148
|
-
packages : Dict[str, str], default: {}
|
1149
|
-
Packages to use for this flow. The key is the name of the package
|
1150
|
-
and the value is the version to use.
|
1151
|
-
python : str, optional, default: None
|
1152
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1153
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1154
|
-
"""
|
1155
|
-
...
|
1156
|
-
|
1157
|
-
def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1158
|
-
"""
|
1159
|
-
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1160
|
-
|
1161
|
-
User code call
|
1162
|
-
-----------
|
1163
|
-
@nim(
|
1164
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1165
|
-
backend='managed'
|
1166
|
-
)
|
1167
|
-
|
1168
|
-
Valid backend options
|
1169
|
-
---------------------
|
1170
|
-
- 'managed': Outerbounds selects a compute provider based on the model.
|
1171
|
-
- 🚧 'dataplane': Run in your account.
|
1172
|
-
|
1173
|
-
Valid model options
|
1174
|
-
----------------
|
1175
|
-
- 'meta/llama3-8b-instruct': 8B parameter model
|
1176
|
-
- 'meta/llama3-70b-instruct': 70B parameter model
|
1177
|
-
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1178
|
-
|
1179
|
-
Parameters
|
1180
|
-
----------
|
1181
|
-
models: list[NIM]
|
1182
|
-
List of NIM containers running models in sidecars.
|
1183
|
-
backend: str
|
1184
|
-
Compute provider to run the NIM container.
|
1185
|
-
"""
|
1186
|
-
...
|
1187
|
-
|
1188
|
-
@typing.overload
|
1189
|
-
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]]:
|
1190
|
-
"""
|
1191
|
-
Specifies the event(s) that this flow depends on.
|
1192
|
-
|
1193
|
-
```
|
1194
|
-
@trigger(event='foo')
|
1195
|
-
```
|
1196
|
-
or
|
1197
|
-
```
|
1198
|
-
@trigger(events=['foo', 'bar'])
|
1199
|
-
```
|
1200
|
-
|
1201
|
-
Additionally, you can specify the parameter mappings
|
1202
|
-
to map event payload to Metaflow parameters for the flow.
|
1203
|
-
```
|
1204
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1205
|
-
```
|
1206
|
-
or
|
1207
|
-
```
|
1208
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1209
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1210
|
-
```
|
1211
|
-
|
1212
|
-
'parameters' can also be a list of strings and tuples like so:
|
1213
|
-
```
|
1214
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1215
|
-
```
|
1216
|
-
This is equivalent to:
|
1217
|
-
```
|
1218
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1219
|
-
```
|
1220
|
-
|
1221
|
-
Parameters
|
1222
|
-
----------
|
1223
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1224
|
-
Event dependency for this flow.
|
1225
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1226
|
-
Events dependency for this flow.
|
1227
|
-
options : Dict[str, Any], default {}
|
1228
|
-
Backend-specific configuration for tuning eventing behavior.
|
1229
|
-
|
1230
|
-
|
1231
|
-
"""
|
1232
|
-
...
|
1233
|
-
|
1234
|
-
@typing.overload
|
1235
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1236
|
-
...
|
1237
|
-
|
1238
|
-
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] = {}):
|
1239
|
-
"""
|
1240
|
-
Specifies the event(s) that this flow depends on.
|
1241
|
-
|
1242
|
-
```
|
1243
|
-
@trigger(event='foo')
|
1244
|
-
```
|
1245
|
-
or
|
1246
|
-
```
|
1247
|
-
@trigger(events=['foo', 'bar'])
|
1248
|
-
```
|
1249
|
-
|
1250
|
-
Additionally, you can specify the parameter mappings
|
1251
|
-
to map event payload to Metaflow parameters for the flow.
|
1252
|
-
```
|
1253
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1254
|
-
```
|
1255
|
-
or
|
1256
|
-
```
|
1257
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1258
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1259
|
-
```
|
1260
|
-
|
1261
|
-
'parameters' can also be a list of strings and tuples like so:
|
1262
|
-
```
|
1263
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1264
|
-
```
|
1265
|
-
This is equivalent to:
|
1266
|
-
```
|
1267
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1268
|
-
```
|
1269
|
-
|
1270
|
-
Parameters
|
1271
|
-
----------
|
1272
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1273
|
-
Event dependency for this flow.
|
1274
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1275
|
-
Events dependency for this flow.
|
1276
|
-
options : Dict[str, Any], default {}
|
1277
|
-
Backend-specific configuration for tuning eventing behavior.
|
1278
|
-
|
1279
|
-
|
1280
|
-
"""
|
1281
|
-
...
|
1282
|
-
|
1283
|
-
@typing.overload
|
1284
|
-
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]]:
|
1172
|
+
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] = {}):
|
1285
1173
|
"""
|
1286
1174
|
Specifies the flow(s) that this flow depends on.
|
1287
1175
|
|
@@ -1330,116 +1218,83 @@ def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] =
|
|
1330
1218
|
"""
|
1331
1219
|
...
|
1332
1220
|
|
1333
|
-
|
1334
|
-
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1335
|
-
...
|
1336
|
-
|
1337
|
-
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] = {}):
|
1221
|
+
def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1338
1222
|
"""
|
1339
|
-
|
1340
|
-
|
1341
|
-
```
|
1342
|
-
@trigger_on_finish(flow='FooFlow')
|
1343
|
-
```
|
1344
|
-
or
|
1345
|
-
```
|
1346
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1347
|
-
```
|
1348
|
-
This decorator respects the @project decorator and triggers the flow
|
1349
|
-
when upstream runs within the same namespace complete successfully
|
1223
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1350
1224
|
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
```
|
1358
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1359
|
-
```
|
1225
|
+
User code call
|
1226
|
+
-----------
|
1227
|
+
@nim(
|
1228
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1229
|
+
backend='managed'
|
1230
|
+
)
|
1360
1231
|
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
```
|
1232
|
+
Valid backend options
|
1233
|
+
---------------------
|
1234
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
1235
|
+
- 🚧 'dataplane': Run in your account.
|
1366
1236
|
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1237
|
+
Valid model options
|
1238
|
+
----------------
|
1239
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
1240
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
1241
|
+
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1372
1242
|
|
1373
1243
|
Parameters
|
1374
1244
|
----------
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
options : Dict[str, Any], default {}
|
1380
|
-
Backend-specific configuration for tuning eventing behavior.
|
1381
|
-
|
1382
|
-
|
1245
|
+
models: list[NIM]
|
1246
|
+
List of NIM containers running models in sidecars.
|
1247
|
+
backend: str
|
1248
|
+
Compute provider to run the NIM container.
|
1383
1249
|
"""
|
1384
1250
|
...
|
1385
1251
|
|
1386
|
-
|
1252
|
+
@typing.overload
|
1253
|
+
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]]:
|
1387
1254
|
"""
|
1388
|
-
Specifies
|
1389
|
-
|
1390
|
-
A project-specific namespace is created for all flows that
|
1391
|
-
use the same `@project(name)`.
|
1255
|
+
Specifies the times when the flow should be run when running on a
|
1256
|
+
production scheduler.
|
1392
1257
|
|
1393
1258
|
Parameters
|
1394
1259
|
----------
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1260
|
+
hourly : bool, default False
|
1261
|
+
Run the workflow hourly.
|
1262
|
+
daily : bool, default True
|
1263
|
+
Run the workflow daily.
|
1264
|
+
weekly : bool, default False
|
1265
|
+
Run the workflow weekly.
|
1266
|
+
cron : str, optional, default None
|
1267
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1268
|
+
specified by this expression.
|
1269
|
+
timezone : str, optional, default None
|
1270
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1271
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1401
1272
|
"""
|
1402
1273
|
...
|
1403
1274
|
|
1404
|
-
|
1275
|
+
@typing.overload
|
1276
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1277
|
+
...
|
1278
|
+
|
1279
|
+
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1405
1280
|
"""
|
1406
|
-
|
1407
|
-
|
1408
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1409
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1410
|
-
starts only after all sensors finish.
|
1281
|
+
Specifies the times when the flow should be run when running on a
|
1282
|
+
production scheduler.
|
1411
1283
|
|
1412
1284
|
Parameters
|
1413
1285
|
----------
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1427
|
-
name : str
|
1428
|
-
Name of the sensor on Airflow
|
1429
|
-
description : str
|
1430
|
-
Description of sensor in the Airflow UI
|
1431
|
-
bucket_key : Union[str, List[str]]
|
1432
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1433
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1434
|
-
bucket_name : str
|
1435
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1436
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1437
|
-
wildcard_match : bool
|
1438
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1439
|
-
aws_conn_id : str
|
1440
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1441
|
-
verify : bool
|
1442
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1286
|
+
hourly : bool, default False
|
1287
|
+
Run the workflow hourly.
|
1288
|
+
daily : bool, default True
|
1289
|
+
Run the workflow daily.
|
1290
|
+
weekly : bool, default False
|
1291
|
+
Run the workflow weekly.
|
1292
|
+
cron : str, optional, default None
|
1293
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1294
|
+
specified by this expression.
|
1295
|
+
timezone : str, optional, default None
|
1296
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1297
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1443
1298
|
"""
|
1444
1299
|
...
|
1445
1300
|
|
@@ -1534,52 +1389,197 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
1534
1389
|
"""
|
1535
1390
|
...
|
1536
1391
|
|
1392
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1393
|
+
"""
|
1394
|
+
Specifies what flows belong to the same project.
|
1395
|
+
|
1396
|
+
A project-specific namespace is created for all flows that
|
1397
|
+
use the same `@project(name)`.
|
1398
|
+
|
1399
|
+
Parameters
|
1400
|
+
----------
|
1401
|
+
name : str
|
1402
|
+
Project name. Make sure that the name is unique amongst all
|
1403
|
+
projects that use the same production scheduler. The name may
|
1404
|
+
contain only lowercase alphanumeric characters and underscores.
|
1405
|
+
|
1406
|
+
|
1407
|
+
"""
|
1408
|
+
...
|
1409
|
+
|
1410
|
+
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]]:
|
1411
|
+
"""
|
1412
|
+
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)
|
1413
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1414
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1415
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1416
|
+
starts only after all sensors finish.
|
1417
|
+
|
1418
|
+
Parameters
|
1419
|
+
----------
|
1420
|
+
timeout : int
|
1421
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1422
|
+
poke_interval : int
|
1423
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1424
|
+
mode : str
|
1425
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1426
|
+
exponential_backoff : bool
|
1427
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1428
|
+
pool : str
|
1429
|
+
the slot pool this task should run in,
|
1430
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1431
|
+
soft_fail : bool
|
1432
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1433
|
+
name : str
|
1434
|
+
Name of the sensor on Airflow
|
1435
|
+
description : str
|
1436
|
+
Description of sensor in the Airflow UI
|
1437
|
+
bucket_key : Union[str, List[str]]
|
1438
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1439
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1440
|
+
bucket_name : str
|
1441
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1442
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1443
|
+
wildcard_match : bool
|
1444
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1445
|
+
aws_conn_id : str
|
1446
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1447
|
+
verify : bool
|
1448
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1449
|
+
"""
|
1450
|
+
...
|
1451
|
+
|
1537
1452
|
@typing.overload
|
1538
|
-
def
|
1453
|
+
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]]:
|
1539
1454
|
"""
|
1540
|
-
Specifies the
|
1541
|
-
|
1455
|
+
Specifies the event(s) that this flow depends on.
|
1456
|
+
|
1457
|
+
```
|
1458
|
+
@trigger(event='foo')
|
1459
|
+
```
|
1460
|
+
or
|
1461
|
+
```
|
1462
|
+
@trigger(events=['foo', 'bar'])
|
1463
|
+
```
|
1464
|
+
|
1465
|
+
Additionally, you can specify the parameter mappings
|
1466
|
+
to map event payload to Metaflow parameters for the flow.
|
1467
|
+
```
|
1468
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1469
|
+
```
|
1470
|
+
or
|
1471
|
+
```
|
1472
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1473
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1474
|
+
```
|
1475
|
+
|
1476
|
+
'parameters' can also be a list of strings and tuples like so:
|
1477
|
+
```
|
1478
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1479
|
+
```
|
1480
|
+
This is equivalent to:
|
1481
|
+
```
|
1482
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1483
|
+
```
|
1542
1484
|
|
1543
1485
|
Parameters
|
1544
1486
|
----------
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
specified by this expression.
|
1554
|
-
timezone : str, optional, default None
|
1555
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1556
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1487
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1488
|
+
Event dependency for this flow.
|
1489
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1490
|
+
Events dependency for this flow.
|
1491
|
+
options : Dict[str, Any], default {}
|
1492
|
+
Backend-specific configuration for tuning eventing behavior.
|
1493
|
+
|
1494
|
+
|
1557
1495
|
"""
|
1558
1496
|
...
|
1559
1497
|
|
1560
1498
|
@typing.overload
|
1561
|
-
def
|
1499
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1562
1500
|
...
|
1563
1501
|
|
1564
|
-
def
|
1502
|
+
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] = {}):
|
1565
1503
|
"""
|
1566
|
-
Specifies the
|
1567
|
-
|
1504
|
+
Specifies the event(s) that this flow depends on.
|
1505
|
+
|
1506
|
+
```
|
1507
|
+
@trigger(event='foo')
|
1508
|
+
```
|
1509
|
+
or
|
1510
|
+
```
|
1511
|
+
@trigger(events=['foo', 'bar'])
|
1512
|
+
```
|
1513
|
+
|
1514
|
+
Additionally, you can specify the parameter mappings
|
1515
|
+
to map event payload to Metaflow parameters for the flow.
|
1516
|
+
```
|
1517
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1518
|
+
```
|
1519
|
+
or
|
1520
|
+
```
|
1521
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1522
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1523
|
+
```
|
1524
|
+
|
1525
|
+
'parameters' can also be a list of strings and tuples like so:
|
1526
|
+
```
|
1527
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1528
|
+
```
|
1529
|
+
This is equivalent to:
|
1530
|
+
```
|
1531
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1532
|
+
```
|
1568
1533
|
|
1569
1534
|
Parameters
|
1570
1535
|
----------
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1536
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1537
|
+
Event dependency for this flow.
|
1538
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1539
|
+
Events dependency for this flow.
|
1540
|
+
options : Dict[str, Any], default {}
|
1541
|
+
Backend-specific configuration for tuning eventing behavior.
|
1542
|
+
|
1543
|
+
|
1544
|
+
"""
|
1545
|
+
...
|
1546
|
+
|
1547
|
+
@typing.overload
|
1548
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1549
|
+
"""
|
1550
|
+
Specifies the PyPI packages for all steps of the flow.
|
1551
|
+
|
1552
|
+
Use `@pypi_base` to set common packages required by all
|
1553
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1554
|
+
Parameters
|
1555
|
+
----------
|
1556
|
+
packages : Dict[str, str], default: {}
|
1557
|
+
Packages to use for this flow. The key is the name of the package
|
1558
|
+
and the value is the version to use.
|
1559
|
+
python : str, optional, default: None
|
1560
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1561
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1562
|
+
"""
|
1563
|
+
...
|
1564
|
+
|
1565
|
+
@typing.overload
|
1566
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1567
|
+
...
|
1568
|
+
|
1569
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1570
|
+
"""
|
1571
|
+
Specifies the PyPI packages for all steps of the flow.
|
1572
|
+
|
1573
|
+
Use `@pypi_base` to set common packages required by all
|
1574
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1575
|
+
Parameters
|
1576
|
+
----------
|
1577
|
+
packages : Dict[str, str], default: {}
|
1578
|
+
Packages to use for this flow. The key is the name of the package
|
1579
|
+
and the value is the version to use.
|
1580
|
+
python : str, optional, default: None
|
1581
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1582
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1583
1583
|
"""
|
1584
1584
|
...
|
1585
1585
|
|