ob-metaflow-stubs 5.5__py2.py3-none-any.whl → 5.7__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 +461 -461
- metaflow-stubs/cards.pyi +5 -5
- metaflow-stubs/cli.pyi +3 -3
- metaflow-stubs/client/__init__.pyi +3 -3
- metaflow-stubs/client/core.pyi +6 -6
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/clone_util.pyi +2 -2
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/metadata/metadata.pyi +3 -3
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +4 -2
- metaflow-stubs/metaflow_current.pyi +5 -5
- metaflow-stubs/mflog/mflog.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +4 -4
- metaflow-stubs/plugins/__init__.pyi +3 -3
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +5 -3
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +6 -6
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +7 -7
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_cli.pyi +4 -4
- metaflow-stubs/plugins/cards/card_client.pyi +4 -4
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +3 -3
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +4 -4
- metaflow-stubs/plugins/datatools/__init__.pyi +4 -4
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- 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 +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +4 -4
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/logs_cli.pyi +4 -4
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/tag_cli.pyi +4 -4
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/procpoll.pyi +2 -2
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +3 -3
- metaflow-stubs/runner/metaflow_runner.pyi +5 -5
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +3 -3
- metaflow-stubs/system/system_logger.pyi +3 -3
- metaflow-stubs/system/system_monitor.pyi +3 -3
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- {ob_metaflow_stubs-5.5.dist-info → ob_metaflow_stubs-5.7.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-5.7.dist-info/RECORD +138 -0
- ob_metaflow_stubs-5.5.dist-info/RECORD +0 -138
- {ob_metaflow_stubs-5.5.dist-info → ob_metaflow_stubs-5.7.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-5.5.dist-info → ob_metaflow_stubs-5.7.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-08-
|
3
|
+
# MF version: 2.12.18.2+ob(v1) #
|
4
|
+
# Generated on 2024-08-29T15:44:09.902207 #
|
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.metaflow_current
|
11
12
|
import metaflow.datastore.inputs
|
12
|
-
import io
|
13
|
-
import metaflow.events
|
14
13
|
import metaflow.plugins.datatools.s3.s3
|
15
|
-
import metaflow.metaflow_current
|
16
|
-
import metaflow.runner.metaflow_runner
|
17
14
|
import metaflow.flowspec
|
15
|
+
import io
|
16
|
+
import typing
|
17
|
+
import metaflow.runner.metaflow_runner
|
18
18
|
import datetime
|
19
|
+
import metaflow.client.core
|
20
|
+
import metaflow.events
|
19
21
|
import metaflow._vendor.click.types
|
20
22
|
import metaflow.parameters
|
21
|
-
import metaflow.client.core
|
22
|
-
import typing
|
23
23
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
24
24
|
StepFlag = typing.NewType("StepFlag", bool)
|
25
25
|
|
@@ -727,97 +727,65 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
727
727
|
"""
|
728
728
|
...
|
729
729
|
|
730
|
-
|
731
|
-
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]]]:
|
732
|
-
"""
|
733
|
-
Specifies the resources needed when executing this step.
|
734
|
-
|
735
|
-
Use `@resources` to specify the resource requirements
|
736
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
737
|
-
|
738
|
-
You can choose the compute layer on the command line by executing e.g.
|
739
|
-
```
|
740
|
-
python myflow.py run --with batch
|
741
|
-
```
|
742
|
-
or
|
743
|
-
```
|
744
|
-
python myflow.py run --with kubernetes
|
745
|
-
```
|
746
|
-
which executes the flow on the desired system using the
|
747
|
-
requirements specified in `@resources`.
|
748
|
-
|
749
|
-
Parameters
|
750
|
-
----------
|
751
|
-
cpu : int, default 1
|
752
|
-
Number of CPUs required for this step.
|
753
|
-
gpu : int, default 0
|
754
|
-
Number of GPUs required for this step.
|
755
|
-
disk : int, optional, default None
|
756
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
757
|
-
memory : int, default 4096
|
758
|
-
Memory size (in MB) required for this step.
|
759
|
-
shared_memory : int, optional, default None
|
760
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
761
|
-
This parameter maps to the `--shm-size` option in Docker.
|
762
|
-
"""
|
763
|
-
...
|
764
|
-
|
765
|
-
@typing.overload
|
766
|
-
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
767
|
-
...
|
768
|
-
|
769
|
-
@typing.overload
|
770
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
771
|
-
...
|
772
|
-
|
773
|
-
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
730
|
+
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]]]:
|
774
731
|
"""
|
775
|
-
Specifies
|
776
|
-
|
777
|
-
Use `@resources` to specify the resource requirements
|
778
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
779
|
-
|
780
|
-
You can choose the compute layer on the command line by executing e.g.
|
781
|
-
```
|
782
|
-
python myflow.py run --with batch
|
783
|
-
```
|
784
|
-
or
|
785
|
-
```
|
786
|
-
python myflow.py run --with kubernetes
|
787
|
-
```
|
788
|
-
which executes the flow on the desired system using the
|
789
|
-
requirements specified in `@resources`.
|
732
|
+
Specifies that this step should execute on Kubernetes.
|
790
733
|
|
791
734
|
Parameters
|
792
735
|
----------
|
793
736
|
cpu : int, default 1
|
794
|
-
Number of CPUs required for this step.
|
795
|
-
|
796
|
-
Number of GPUs required for this step.
|
797
|
-
disk : int, optional, default None
|
798
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
737
|
+
Number of CPUs required for this step. If `@resources` is
|
738
|
+
also present, the maximum value from all decorators is used.
|
799
739
|
memory : int, default 4096
|
800
|
-
Memory size (in MB) required for this step.
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
740
|
+
Memory size (in MB) required for this step. If
|
741
|
+
`@resources` is also present, the maximum value from all decorators is
|
742
|
+
used.
|
743
|
+
disk : int, default 10240
|
744
|
+
Disk size (in MB) required for this step. If
|
745
|
+
`@resources` is also present, the maximum value from all decorators is
|
746
|
+
used.
|
747
|
+
image : str, optional, default None
|
748
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
749
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
750
|
+
not, a default Docker image mapping to the current version of Python is used.
|
751
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
752
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
753
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
754
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
755
|
+
secrets : List[str], optional, default None
|
756
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
757
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
758
|
+
in Metaflow configuration.
|
759
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
760
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
761
|
+
gpu : int, optional, default None
|
762
|
+
Number of GPUs required for this step. A value of zero implies that
|
763
|
+
the scheduled node should not have GPUs.
|
764
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
765
|
+
The vendor of the GPUs to be used for this step.
|
766
|
+
tolerations : List[str], default []
|
767
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
768
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
769
|
+
use_tmpfs : bool, default False
|
770
|
+
This enables an explicit tmpfs mount for this step.
|
771
|
+
tmpfs_tempdir : bool, default True
|
772
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
773
|
+
tmpfs_size : int, optional, default: None
|
774
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
775
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
776
|
+
memory allocated for this step.
|
777
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
778
|
+
Path to tmpfs mount for this step.
|
779
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
780
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
781
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
782
|
+
shared_memory: int, optional
|
783
|
+
Shared memory size (in MiB) required for this step
|
784
|
+
port: int, optional
|
785
|
+
Port number to specify in the Kubernetes job object
|
786
|
+
compute_pool : str, optional, default None
|
787
|
+
Compute pool to be used for for this step.
|
788
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
821
789
|
"""
|
822
790
|
...
|
823
791
|
|
@@ -872,88 +840,6 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
872
840
|
"""
|
873
841
|
...
|
874
842
|
|
875
|
-
@typing.overload
|
876
|
-
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]]]:
|
877
|
-
"""
|
878
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
879
|
-
the execution of a step.
|
880
|
-
|
881
|
-
Parameters
|
882
|
-
----------
|
883
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
884
|
-
List of secret specs, defining how the secrets are to be retrieved
|
885
|
-
"""
|
886
|
-
...
|
887
|
-
|
888
|
-
@typing.overload
|
889
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
890
|
-
...
|
891
|
-
|
892
|
-
@typing.overload
|
893
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
894
|
-
...
|
895
|
-
|
896
|
-
def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
|
897
|
-
"""
|
898
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
899
|
-
the execution of a step.
|
900
|
-
|
901
|
-
Parameters
|
902
|
-
----------
|
903
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
904
|
-
List of secret specs, defining how the secrets are to be retrieved
|
905
|
-
"""
|
906
|
-
...
|
907
|
-
|
908
|
-
@typing.overload
|
909
|
-
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]]]:
|
910
|
-
"""
|
911
|
-
Specifies that the step will success under all circumstances.
|
912
|
-
|
913
|
-
The decorator will create an optional artifact, specified by `var`, which
|
914
|
-
contains the exception raised. You can use it to detect the presence
|
915
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
916
|
-
are missing.
|
917
|
-
|
918
|
-
Parameters
|
919
|
-
----------
|
920
|
-
var : str, optional, default None
|
921
|
-
Name of the artifact in which to store the caught exception.
|
922
|
-
If not specified, the exception is not stored.
|
923
|
-
print_exception : bool, default True
|
924
|
-
Determines whether or not the exception is printed to
|
925
|
-
stdout when caught.
|
926
|
-
"""
|
927
|
-
...
|
928
|
-
|
929
|
-
@typing.overload
|
930
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
931
|
-
...
|
932
|
-
|
933
|
-
@typing.overload
|
934
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
935
|
-
...
|
936
|
-
|
937
|
-
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):
|
938
|
-
"""
|
939
|
-
Specifies that the step will success under all circumstances.
|
940
|
-
|
941
|
-
The decorator will create an optional artifact, specified by `var`, which
|
942
|
-
contains the exception raised. You can use it to detect the presence
|
943
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
944
|
-
are missing.
|
945
|
-
|
946
|
-
Parameters
|
947
|
-
----------
|
948
|
-
var : str, optional, default None
|
949
|
-
Name of the artifact in which to store the caught exception.
|
950
|
-
If not specified, the exception is not stored.
|
951
|
-
print_exception : bool, default True
|
952
|
-
Determines whether or not the exception is printed to
|
953
|
-
stdout when caught.
|
954
|
-
"""
|
955
|
-
...
|
956
|
-
|
957
843
|
@typing.overload
|
958
844
|
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]]]:
|
959
845
|
"""
|
@@ -1069,148 +955,165 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1069
955
|
...
|
1070
956
|
|
1071
957
|
@typing.overload
|
1072
|
-
def
|
958
|
+
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]]]:
|
1073
959
|
"""
|
1074
|
-
Specifies the
|
1075
|
-
to a step needs to be retried.
|
960
|
+
Specifies the resources needed when executing this step.
|
1076
961
|
|
1077
|
-
|
1078
|
-
|
1079
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
962
|
+
Use `@resources` to specify the resource requirements
|
963
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1080
964
|
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
965
|
+
You can choose the compute layer on the command line by executing e.g.
|
966
|
+
```
|
967
|
+
python myflow.py run --with batch
|
968
|
+
```
|
969
|
+
or
|
970
|
+
```
|
971
|
+
python myflow.py run --with kubernetes
|
972
|
+
```
|
973
|
+
which executes the flow on the desired system using the
|
974
|
+
requirements specified in `@resources`.
|
1084
975
|
|
1085
976
|
Parameters
|
1086
977
|
----------
|
1087
|
-
|
1088
|
-
Number of
|
1089
|
-
|
1090
|
-
Number of
|
978
|
+
cpu : int, default 1
|
979
|
+
Number of CPUs required for this step.
|
980
|
+
gpu : int, default 0
|
981
|
+
Number of GPUs required for this step.
|
982
|
+
disk : int, optional, default None
|
983
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
984
|
+
memory : int, default 4096
|
985
|
+
Memory size (in MB) required for this step.
|
986
|
+
shared_memory : int, optional, default None
|
987
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
988
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1091
989
|
"""
|
1092
990
|
...
|
1093
991
|
|
1094
992
|
@typing.overload
|
1095
|
-
def
|
993
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1096
994
|
...
|
1097
995
|
|
1098
996
|
@typing.overload
|
1099
|
-
def
|
997
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1100
998
|
...
|
1101
999
|
|
1102
|
-
def
|
1000
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
1103
1001
|
"""
|
1104
|
-
Specifies the
|
1105
|
-
to a step needs to be retried.
|
1002
|
+
Specifies the resources needed when executing this step.
|
1106
1003
|
|
1107
|
-
|
1108
|
-
|
1109
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1004
|
+
Use `@resources` to specify the resource requirements
|
1005
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1110
1006
|
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1007
|
+
You can choose the compute layer on the command line by executing e.g.
|
1008
|
+
```
|
1009
|
+
python myflow.py run --with batch
|
1010
|
+
```
|
1011
|
+
or
|
1012
|
+
```
|
1013
|
+
python myflow.py run --with kubernetes
|
1014
|
+
```
|
1015
|
+
which executes the flow on the desired system using the
|
1016
|
+
requirements specified in `@resources`.
|
1114
1017
|
|
1115
1018
|
Parameters
|
1116
1019
|
----------
|
1117
|
-
|
1118
|
-
Number of
|
1119
|
-
|
1120
|
-
Number of
|
1020
|
+
cpu : int, default 1
|
1021
|
+
Number of CPUs required for this step.
|
1022
|
+
gpu : int, default 0
|
1023
|
+
Number of GPUs required for this step.
|
1024
|
+
disk : int, optional, default None
|
1025
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1026
|
+
memory : int, default 4096
|
1027
|
+
Memory size (in MB) required for this step.
|
1028
|
+
shared_memory : int, optional, default None
|
1029
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1030
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1121
1031
|
"""
|
1122
1032
|
...
|
1123
1033
|
|
1124
|
-
|
1034
|
+
@typing.overload
|
1035
|
+
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]]]:
|
1125
1036
|
"""
|
1126
|
-
Specifies
|
1037
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1038
|
+
the execution of a step.
|
1127
1039
|
|
1128
1040
|
Parameters
|
1129
1041
|
----------
|
1130
|
-
|
1131
|
-
|
1132
|
-
also present, the maximum value from all decorators is used.
|
1133
|
-
memory : int, default 4096
|
1134
|
-
Memory size (in MB) required for this step. If
|
1135
|
-
`@resources` is also present, the maximum value from all decorators is
|
1136
|
-
used.
|
1137
|
-
disk : int, default 10240
|
1138
|
-
Disk size (in MB) required for this step. If
|
1139
|
-
`@resources` is also present, the maximum value from all decorators is
|
1140
|
-
used.
|
1141
|
-
image : str, optional, default None
|
1142
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
1143
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1144
|
-
not, a default Docker image mapping to the current version of Python is used.
|
1145
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1146
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1147
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1148
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
1149
|
-
secrets : List[str], optional, default None
|
1150
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1151
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1152
|
-
in Metaflow configuration.
|
1153
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1154
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
1155
|
-
gpu : int, optional, default None
|
1156
|
-
Number of GPUs required for this step. A value of zero implies that
|
1157
|
-
the scheduled node should not have GPUs.
|
1158
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1159
|
-
The vendor of the GPUs to be used for this step.
|
1160
|
-
tolerations : List[str], default []
|
1161
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1162
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1163
|
-
use_tmpfs : bool, default False
|
1164
|
-
This enables an explicit tmpfs mount for this step.
|
1165
|
-
tmpfs_tempdir : bool, default True
|
1166
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1167
|
-
tmpfs_size : int, optional, default: None
|
1168
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1169
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1170
|
-
memory allocated for this step.
|
1171
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
1172
|
-
Path to tmpfs mount for this step.
|
1173
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
1174
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1175
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1176
|
-
shared_memory: int, optional
|
1177
|
-
Shared memory size (in MiB) required for this step
|
1178
|
-
port: int, optional
|
1179
|
-
Port number to specify in the Kubernetes job object
|
1180
|
-
compute_pool : str, optional, default None
|
1181
|
-
Compute pool to be used for for this step.
|
1182
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
1042
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1043
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1183
1044
|
"""
|
1184
1045
|
...
|
1185
1046
|
|
1186
1047
|
@typing.overload
|
1187
|
-
def
|
1048
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1049
|
+
...
|
1050
|
+
|
1051
|
+
@typing.overload
|
1052
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1053
|
+
...
|
1054
|
+
|
1055
|
+
def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
|
1188
1056
|
"""
|
1189
|
-
Specifies
|
1057
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1058
|
+
the execution of a step.
|
1190
1059
|
|
1191
1060
|
Parameters
|
1192
1061
|
----------
|
1193
|
-
|
1194
|
-
|
1062
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1063
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1195
1064
|
"""
|
1196
1065
|
...
|
1197
1066
|
|
1198
1067
|
@typing.overload
|
1199
|
-
def
|
1068
|
+
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]]]:
|
1069
|
+
"""
|
1070
|
+
Specifies the number of times the task corresponding
|
1071
|
+
to a step needs to be retried.
|
1072
|
+
|
1073
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1074
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1075
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1076
|
+
|
1077
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1078
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1079
|
+
ensuring that the flow execution can continue.
|
1080
|
+
|
1081
|
+
Parameters
|
1082
|
+
----------
|
1083
|
+
times : int, default 3
|
1084
|
+
Number of times to retry this task.
|
1085
|
+
minutes_between_retries : int, default 2
|
1086
|
+
Number of minutes between retries.
|
1087
|
+
"""
|
1200
1088
|
...
|
1201
1089
|
|
1202
1090
|
@typing.overload
|
1203
|
-
def
|
1091
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1204
1092
|
...
|
1205
1093
|
|
1206
|
-
|
1094
|
+
@typing.overload
|
1095
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1096
|
+
...
|
1097
|
+
|
1098
|
+
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):
|
1207
1099
|
"""
|
1208
|
-
Specifies
|
1100
|
+
Specifies the number of times the task corresponding
|
1101
|
+
to a step needs to be retried.
|
1102
|
+
|
1103
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1104
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1105
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1106
|
+
|
1107
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1108
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1109
|
+
ensuring that the flow execution can continue.
|
1209
1110
|
|
1210
1111
|
Parameters
|
1211
1112
|
----------
|
1212
|
-
|
1213
|
-
|
1113
|
+
times : int, default 3
|
1114
|
+
Number of times to retry this task.
|
1115
|
+
minutes_between_retries : int, default 2
|
1116
|
+
Number of minutes between retries.
|
1214
1117
|
"""
|
1215
1118
|
...
|
1216
1119
|
|
@@ -1233,6 +1136,55 @@ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
1233
1136
|
"""
|
1234
1137
|
...
|
1235
1138
|
|
1139
|
+
@typing.overload
|
1140
|
+
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]]]:
|
1141
|
+
"""
|
1142
|
+
Specifies that the step will success under all circumstances.
|
1143
|
+
|
1144
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1145
|
+
contains the exception raised. You can use it to detect the presence
|
1146
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1147
|
+
are missing.
|
1148
|
+
|
1149
|
+
Parameters
|
1150
|
+
----------
|
1151
|
+
var : str, optional, default None
|
1152
|
+
Name of the artifact in which to store the caught exception.
|
1153
|
+
If not specified, the exception is not stored.
|
1154
|
+
print_exception : bool, default True
|
1155
|
+
Determines whether or not the exception is printed to
|
1156
|
+
stdout when caught.
|
1157
|
+
"""
|
1158
|
+
...
|
1159
|
+
|
1160
|
+
@typing.overload
|
1161
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1162
|
+
...
|
1163
|
+
|
1164
|
+
@typing.overload
|
1165
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1166
|
+
...
|
1167
|
+
|
1168
|
+
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):
|
1169
|
+
"""
|
1170
|
+
Specifies that the step will success under all circumstances.
|
1171
|
+
|
1172
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1173
|
+
contains the exception raised. You can use it to detect the presence
|
1174
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1175
|
+
are missing.
|
1176
|
+
|
1177
|
+
Parameters
|
1178
|
+
----------
|
1179
|
+
var : str, optional, default None
|
1180
|
+
Name of the artifact in which to store the caught exception.
|
1181
|
+
If not specified, the exception is not stored.
|
1182
|
+
print_exception : bool, default True
|
1183
|
+
Determines whether or not the exception is printed to
|
1184
|
+
stdout when caught.
|
1185
|
+
"""
|
1186
|
+
...
|
1187
|
+
|
1236
1188
|
@typing.overload
|
1237
1189
|
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]]]:
|
1238
1190
|
"""
|
@@ -1283,132 +1235,117 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
1283
1235
|
...
|
1284
1236
|
|
1285
1237
|
@typing.overload
|
1286
|
-
def
|
1238
|
+
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]]]:
|
1287
1239
|
"""
|
1288
|
-
Specifies
|
1289
|
-
production scheduler.
|
1240
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1290
1241
|
|
1291
1242
|
Parameters
|
1292
1243
|
----------
|
1293
|
-
|
1294
|
-
|
1295
|
-
daily : bool, default True
|
1296
|
-
Run the workflow daily.
|
1297
|
-
weekly : bool, default False
|
1298
|
-
Run the workflow weekly.
|
1299
|
-
cron : str, optional, default None
|
1300
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1301
|
-
specified by this expression.
|
1302
|
-
timezone : str, optional, default None
|
1303
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1304
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1244
|
+
vars : Dict[str, str], default {}
|
1245
|
+
Dictionary of environment variables to set.
|
1305
1246
|
"""
|
1306
1247
|
...
|
1307
1248
|
|
1308
1249
|
@typing.overload
|
1309
|
-
def
|
1250
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1310
1251
|
...
|
1311
1252
|
|
1312
|
-
|
1253
|
+
@typing.overload
|
1254
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1255
|
+
...
|
1256
|
+
|
1257
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1313
1258
|
"""
|
1314
|
-
Specifies
|
1315
|
-
production scheduler.
|
1259
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1316
1260
|
|
1317
1261
|
Parameters
|
1318
1262
|
----------
|
1319
|
-
|
1320
|
-
|
1321
|
-
daily : bool, default True
|
1322
|
-
Run the workflow daily.
|
1323
|
-
weekly : bool, default False
|
1324
|
-
Run the workflow weekly.
|
1325
|
-
cron : str, optional, default None
|
1326
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1327
|
-
specified by this expression.
|
1328
|
-
timezone : str, optional, default None
|
1329
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1330
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1263
|
+
vars : Dict[str, str], default {}
|
1264
|
+
Dictionary of environment variables to set.
|
1331
1265
|
"""
|
1332
1266
|
...
|
1333
1267
|
|
1334
1268
|
@typing.overload
|
1335
|
-
def
|
1269
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1336
1270
|
"""
|
1337
|
-
|
1271
|
+
Internal decorator to support Fast bakery
|
1272
|
+
"""
|
1273
|
+
...
|
1274
|
+
|
1275
|
+
@typing.overload
|
1276
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1277
|
+
...
|
1278
|
+
|
1279
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1280
|
+
"""
|
1281
|
+
Internal decorator to support Fast bakery
|
1282
|
+
"""
|
1283
|
+
...
|
1284
|
+
|
1285
|
+
@typing.overload
|
1286
|
+
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]]:
|
1287
|
+
"""
|
1288
|
+
Specifies the Conda environment for all steps of the flow.
|
1289
|
+
|
1290
|
+
Use `@conda_base` to set common libraries required by all
|
1291
|
+
steps and use `@conda` to specify step-specific additions.
|
1338
1292
|
|
1339
|
-
Use `@pypi_base` to set common packages required by all
|
1340
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1341
1293
|
Parameters
|
1342
1294
|
----------
|
1343
|
-
packages : Dict[str, str], default
|
1295
|
+
packages : Dict[str, str], default {}
|
1344
1296
|
Packages to use for this flow. The key is the name of the package
|
1345
1297
|
and the value is the version to use.
|
1346
|
-
|
1298
|
+
libraries : Dict[str, str], default {}
|
1299
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1300
|
+
python : str, optional, default None
|
1347
1301
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1348
1302
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1303
|
+
disabled : bool, default False
|
1304
|
+
If set to True, disables Conda.
|
1349
1305
|
"""
|
1350
1306
|
...
|
1351
1307
|
|
1352
1308
|
@typing.overload
|
1353
|
-
def
|
1309
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1354
1310
|
...
|
1355
1311
|
|
1356
|
-
def
|
1312
|
+
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):
|
1357
1313
|
"""
|
1358
|
-
Specifies the
|
1314
|
+
Specifies the Conda environment for all steps of the flow.
|
1315
|
+
|
1316
|
+
Use `@conda_base` to set common libraries required by all
|
1317
|
+
steps and use `@conda` to specify step-specific additions.
|
1359
1318
|
|
1360
|
-
Use `@pypi_base` to set common packages required by all
|
1361
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1362
1319
|
Parameters
|
1363
1320
|
----------
|
1364
|
-
packages : Dict[str, str], default
|
1321
|
+
packages : Dict[str, str], default {}
|
1365
1322
|
Packages to use for this flow. The key is the name of the package
|
1366
1323
|
and the value is the version to use.
|
1367
|
-
|
1324
|
+
libraries : Dict[str, str], default {}
|
1325
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1326
|
+
python : str, optional, default None
|
1368
1327
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1369
1328
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1329
|
+
disabled : bool, default False
|
1330
|
+
If set to True, disables Conda.
|
1370
1331
|
"""
|
1371
1332
|
...
|
1372
1333
|
|
1373
|
-
def
|
1334
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1374
1335
|
"""
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
starts only after all sensors finish.
|
1336
|
+
Specifies what flows belong to the same project.
|
1337
|
+
|
1338
|
+
A project-specific namespace is created for all flows that
|
1339
|
+
use the same `@project(name)`.
|
1380
1340
|
|
1381
1341
|
Parameters
|
1382
1342
|
----------
|
1383
|
-
timeout : int
|
1384
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1385
|
-
poke_interval : int
|
1386
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1387
|
-
mode : str
|
1388
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1389
|
-
exponential_backoff : bool
|
1390
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1391
|
-
pool : str
|
1392
|
-
the slot pool this task should run in,
|
1393
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1394
|
-
soft_fail : bool
|
1395
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1396
1343
|
name : str
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1403
|
-
bucket_name : str
|
1404
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1405
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1406
|
-
wildcard_match : bool
|
1407
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1408
|
-
aws_conn_id : str
|
1409
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1410
|
-
verify : bool
|
1411
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1344
|
+
Project name. Make sure that the name is unique amongst all
|
1345
|
+
projects that use the same production scheduler. The name may
|
1346
|
+
contain only lowercase alphanumeric characters and underscores.
|
1347
|
+
|
1348
|
+
|
1412
1349
|
"""
|
1413
1350
|
...
|
1414
1351
|
|
@@ -1444,164 +1381,132 @@ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[Fl
|
|
1444
1381
|
...
|
1445
1382
|
|
1446
1383
|
@typing.overload
|
1447
|
-
def
|
1384
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1448
1385
|
"""
|
1449
|
-
Specifies the
|
1450
|
-
|
1451
|
-
Use `@conda_base` to set common libraries required by all
|
1452
|
-
steps and use `@conda` to specify step-specific additions.
|
1386
|
+
Specifies the PyPI packages for all steps of the flow.
|
1453
1387
|
|
1388
|
+
Use `@pypi_base` to set common packages required by all
|
1389
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1454
1390
|
Parameters
|
1455
1391
|
----------
|
1456
|
-
packages : Dict[str, str], default {}
|
1392
|
+
packages : Dict[str, str], default: {}
|
1457
1393
|
Packages to use for this flow. The key is the name of the package
|
1458
1394
|
and the value is the version to use.
|
1459
|
-
|
1460
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1461
|
-
python : str, optional, default None
|
1395
|
+
python : str, optional, default: None
|
1462
1396
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1463
1397
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1464
|
-
disabled : bool, default False
|
1465
|
-
If set to True, disables Conda.
|
1466
1398
|
"""
|
1467
1399
|
...
|
1468
1400
|
|
1469
1401
|
@typing.overload
|
1470
|
-
def
|
1402
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1471
1403
|
...
|
1472
1404
|
|
1473
|
-
def
|
1405
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1474
1406
|
"""
|
1475
|
-
Specifies the
|
1476
|
-
|
1477
|
-
Use `@conda_base` to set common libraries required by all
|
1478
|
-
steps and use `@conda` to specify step-specific additions.
|
1407
|
+
Specifies the PyPI packages for all steps of the flow.
|
1479
1408
|
|
1409
|
+
Use `@pypi_base` to set common packages required by all
|
1410
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1480
1411
|
Parameters
|
1481
1412
|
----------
|
1482
|
-
packages : Dict[str, str], default {}
|
1413
|
+
packages : Dict[str, str], default: {}
|
1483
1414
|
Packages to use for this flow. The key is the name of the package
|
1484
1415
|
and the value is the version to use.
|
1485
|
-
|
1486
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1487
|
-
python : str, optional, default None
|
1416
|
+
python : str, optional, default: None
|
1488
1417
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1489
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1490
|
-
disabled : bool, default False
|
1491
|
-
If set to True, disables Conda.
|
1418
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1492
1419
|
"""
|
1493
1420
|
...
|
1494
1421
|
|
1495
|
-
|
1422
|
+
@typing.overload
|
1423
|
+
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]]:
|
1496
1424
|
"""
|
1497
|
-
Specifies
|
1498
|
-
|
1499
|
-
A project-specific namespace is created for all flows that
|
1500
|
-
use the same `@project(name)`.
|
1425
|
+
Specifies the times when the flow should be run when running on a
|
1426
|
+
production scheduler.
|
1501
1427
|
|
1502
1428
|
Parameters
|
1503
1429
|
----------
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1430
|
+
hourly : bool, default False
|
1431
|
+
Run the workflow hourly.
|
1432
|
+
daily : bool, default True
|
1433
|
+
Run the workflow daily.
|
1434
|
+
weekly : bool, default False
|
1435
|
+
Run the workflow weekly.
|
1436
|
+
cron : str, optional, default None
|
1437
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1438
|
+
specified by this expression.
|
1439
|
+
timezone : str, optional, default None
|
1440
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1441
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1510
1442
|
"""
|
1511
1443
|
...
|
1512
1444
|
|
1513
1445
|
@typing.overload
|
1514
|
-
def
|
1446
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1447
|
+
...
|
1448
|
+
|
1449
|
+
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):
|
1515
1450
|
"""
|
1516
|
-
Specifies the
|
1517
|
-
|
1518
|
-
```
|
1519
|
-
@trigger(event='foo')
|
1520
|
-
```
|
1521
|
-
or
|
1522
|
-
```
|
1523
|
-
@trigger(events=['foo', 'bar'])
|
1524
|
-
```
|
1525
|
-
|
1526
|
-
Additionally, you can specify the parameter mappings
|
1527
|
-
to map event payload to Metaflow parameters for the flow.
|
1528
|
-
```
|
1529
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1530
|
-
```
|
1531
|
-
or
|
1532
|
-
```
|
1533
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1534
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1535
|
-
```
|
1536
|
-
|
1537
|
-
'parameters' can also be a list of strings and tuples like so:
|
1538
|
-
```
|
1539
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1540
|
-
```
|
1541
|
-
This is equivalent to:
|
1542
|
-
```
|
1543
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1544
|
-
```
|
1451
|
+
Specifies the times when the flow should be run when running on a
|
1452
|
+
production scheduler.
|
1545
1453
|
|
1546
1454
|
Parameters
|
1547
1455
|
----------
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1456
|
+
hourly : bool, default False
|
1457
|
+
Run the workflow hourly.
|
1458
|
+
daily : bool, default True
|
1459
|
+
Run the workflow daily.
|
1460
|
+
weekly : bool, default False
|
1461
|
+
Run the workflow weekly.
|
1462
|
+
cron : str, optional, default None
|
1463
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1464
|
+
specified by this expression.
|
1465
|
+
timezone : str, optional, default None
|
1466
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1467
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1556
1468
|
"""
|
1557
1469
|
...
|
1558
1470
|
|
1559
|
-
|
1560
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1561
|
-
...
|
1562
|
-
|
1563
|
-
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] = {}):
|
1471
|
+
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]]:
|
1564
1472
|
"""
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
or
|
1571
|
-
```
|
1572
|
-
@trigger(events=['foo', 'bar'])
|
1573
|
-
```
|
1574
|
-
|
1575
|
-
Additionally, you can specify the parameter mappings
|
1576
|
-
to map event payload to Metaflow parameters for the flow.
|
1577
|
-
```
|
1578
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1579
|
-
```
|
1580
|
-
or
|
1581
|
-
```
|
1582
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1583
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1584
|
-
```
|
1585
|
-
|
1586
|
-
'parameters' can also be a list of strings and tuples like so:
|
1587
|
-
```
|
1588
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1589
|
-
```
|
1590
|
-
This is equivalent to:
|
1591
|
-
```
|
1592
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1593
|
-
```
|
1473
|
+
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)
|
1474
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1475
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1476
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1477
|
+
starts only after all sensors finish.
|
1594
1478
|
|
1595
1479
|
Parameters
|
1596
1480
|
----------
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1481
|
+
timeout : int
|
1482
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1483
|
+
poke_interval : int
|
1484
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1485
|
+
mode : str
|
1486
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1487
|
+
exponential_backoff : bool
|
1488
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1489
|
+
pool : str
|
1490
|
+
the slot pool this task should run in,
|
1491
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1492
|
+
soft_fail : bool
|
1493
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1494
|
+
name : str
|
1495
|
+
Name of the sensor on Airflow
|
1496
|
+
description : str
|
1497
|
+
Description of sensor in the Airflow UI
|
1498
|
+
bucket_key : Union[str, List[str]]
|
1499
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1500
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1501
|
+
bucket_name : str
|
1502
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1503
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1504
|
+
wildcard_match : bool
|
1505
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1506
|
+
aws_conn_id : str
|
1507
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1508
|
+
verify : bool
|
1509
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1605
1510
|
"""
|
1606
1511
|
...
|
1607
1512
|
|
@@ -1750,6 +1655,101 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1750
1655
|
"""
|
1751
1656
|
...
|
1752
1657
|
|
1658
|
+
@typing.overload
|
1659
|
+
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]]:
|
1660
|
+
"""
|
1661
|
+
Specifies the event(s) that this flow depends on.
|
1662
|
+
|
1663
|
+
```
|
1664
|
+
@trigger(event='foo')
|
1665
|
+
```
|
1666
|
+
or
|
1667
|
+
```
|
1668
|
+
@trigger(events=['foo', 'bar'])
|
1669
|
+
```
|
1670
|
+
|
1671
|
+
Additionally, you can specify the parameter mappings
|
1672
|
+
to map event payload to Metaflow parameters for the flow.
|
1673
|
+
```
|
1674
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1675
|
+
```
|
1676
|
+
or
|
1677
|
+
```
|
1678
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1679
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1680
|
+
```
|
1681
|
+
|
1682
|
+
'parameters' can also be a list of strings and tuples like so:
|
1683
|
+
```
|
1684
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1685
|
+
```
|
1686
|
+
This is equivalent to:
|
1687
|
+
```
|
1688
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1689
|
+
```
|
1690
|
+
|
1691
|
+
Parameters
|
1692
|
+
----------
|
1693
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1694
|
+
Event dependency for this flow.
|
1695
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1696
|
+
Events dependency for this flow.
|
1697
|
+
options : Dict[str, Any], default {}
|
1698
|
+
Backend-specific configuration for tuning eventing behavior.
|
1699
|
+
|
1700
|
+
|
1701
|
+
"""
|
1702
|
+
...
|
1703
|
+
|
1704
|
+
@typing.overload
|
1705
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1706
|
+
...
|
1707
|
+
|
1708
|
+
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] = {}):
|
1709
|
+
"""
|
1710
|
+
Specifies the event(s) that this flow depends on.
|
1711
|
+
|
1712
|
+
```
|
1713
|
+
@trigger(event='foo')
|
1714
|
+
```
|
1715
|
+
or
|
1716
|
+
```
|
1717
|
+
@trigger(events=['foo', 'bar'])
|
1718
|
+
```
|
1719
|
+
|
1720
|
+
Additionally, you can specify the parameter mappings
|
1721
|
+
to map event payload to Metaflow parameters for the flow.
|
1722
|
+
```
|
1723
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1724
|
+
```
|
1725
|
+
or
|
1726
|
+
```
|
1727
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1728
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1729
|
+
```
|
1730
|
+
|
1731
|
+
'parameters' can also be a list of strings and tuples like so:
|
1732
|
+
```
|
1733
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1734
|
+
```
|
1735
|
+
This is equivalent to:
|
1736
|
+
```
|
1737
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1738
|
+
```
|
1739
|
+
|
1740
|
+
Parameters
|
1741
|
+
----------
|
1742
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1743
|
+
Event dependency for this flow.
|
1744
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1745
|
+
Events dependency for this flow.
|
1746
|
+
options : Dict[str, Any], default {}
|
1747
|
+
Backend-specific configuration for tuning eventing behavior.
|
1748
|
+
|
1749
|
+
|
1750
|
+
"""
|
1751
|
+
...
|
1752
|
+
|
1753
1753
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1754
1754
|
"""
|
1755
1755
|
Switch namespace to the one provided.
|