ob-metaflow-stubs 2.11.4.9__py2.py3-none-any.whl → 2.11.8.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metaflow-stubs/__init__.pyi +597 -573
- metaflow-stubs/cards.pyi +5 -5
- metaflow-stubs/cli.pyi +2 -2
- 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 +31 -0
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +5 -5
- metaflow-stubs/metadata/metadata.pyi +2 -2
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +4 -2
- metaflow-stubs/metaflow_current.pyi +18 -18
- metaflow-stubs/mflog/mflog.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +3 -3
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_cli.pyi +3 -3
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +4 -4
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +4 -4
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- 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 +4 -4
- metaflow-stubs/plugins/aws/batch/batch_cli.pyi +4 -4
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +3 -3
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
- 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/dynamo_db_client.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 +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
- metaflow-stubs/plugins/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_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 +3 -3
- 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 +3 -3
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.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 +2 -2
- 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 +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/s3/s3.pyi +6 -6
- 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 +3 -3
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +4 -4
- 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 +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +3 -3
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
- 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/pylint_wrapper.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- {ob_metaflow_stubs-2.11.4.9.dist-info → ob_metaflow_stubs-2.11.8.1.dist-info}/METADATA +2 -2
- ob_metaflow_stubs-2.11.8.1.dist-info/RECORD +133 -0
- {ob_metaflow_stubs-2.11.4.9.dist-info → ob_metaflow_stubs-2.11.8.1.dist-info}/WHEEL +1 -1
- ob_metaflow_stubs-2.11.4.9.dist-info/RECORD +0 -132
- {ob_metaflow_stubs-2.11.4.9.dist-info → ob_metaflow_stubs-2.11.8.1.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.11.
|
4
|
-
# Generated on 2024-03-
|
3
|
+
# MF version: 2.11.8.1 #
|
4
|
+
# Generated on 2024-03-29T12:39:58.338796 #
|
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.
|
11
|
+
import metaflow.metaflow_current
|
12
|
+
import typing
|
13
|
+
import io
|
12
14
|
import metaflow.events
|
13
|
-
import metaflow._vendor.click.types
|
14
|
-
import metaflow.client.core
|
15
|
-
import metaflow.parameters
|
16
15
|
import metaflow.plugins.datatools.s3.s3
|
17
|
-
import
|
16
|
+
import metaflow.datastore.inputs
|
17
|
+
import metaflow.client.core
|
18
|
+
import metaflow._vendor.click.types
|
18
19
|
import datetime
|
19
|
-
import
|
20
|
-
import metaflow.metaflow_current
|
20
|
+
import metaflow.parameters
|
21
21
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
22
22
|
StepFlag = typing.NewType("StepFlag", bool)
|
23
23
|
|
@@ -725,39 +725,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
725
725
|
"""
|
726
726
|
...
|
727
727
|
|
728
|
-
@typing.overload
|
729
|
-
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]]]:
|
730
|
-
"""
|
731
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
732
|
-
the execution of a step.
|
733
|
-
|
734
|
-
Parameters
|
735
|
-
----------
|
736
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
737
|
-
List of secret specs, defining how the secrets are to be retrieved
|
738
|
-
"""
|
739
|
-
...
|
740
|
-
|
741
|
-
@typing.overload
|
742
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
743
|
-
...
|
744
|
-
|
745
|
-
@typing.overload
|
746
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
747
|
-
...
|
748
|
-
|
749
|
-
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]]] = []):
|
750
|
-
"""
|
751
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
752
|
-
the execution of a step.
|
753
|
-
|
754
|
-
Parameters
|
755
|
-
----------
|
756
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
757
|
-
List of secret specs, defining how the secrets are to be retrieved
|
758
|
-
"""
|
759
|
-
...
|
760
|
-
|
761
728
|
@typing.overload
|
762
729
|
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]]]:
|
763
730
|
"""
|
@@ -789,6 +756,65 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
|
|
789
756
|
"""
|
790
757
|
...
|
791
758
|
|
759
|
+
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, port: typing.Optional[int] = None, 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]]]:
|
760
|
+
"""
|
761
|
+
Specifies that this step should execute on Kubernetes.
|
762
|
+
|
763
|
+
Parameters
|
764
|
+
----------
|
765
|
+
cpu : int, default 1
|
766
|
+
Number of CPUs required for this step. If `@resources` is
|
767
|
+
also present, the maximum value from all decorators is used.
|
768
|
+
memory : int, default 4096
|
769
|
+
Memory size (in MB) required for this step. If
|
770
|
+
`@resources` is also present, the maximum value from all decorators is
|
771
|
+
used.
|
772
|
+
disk : int, default 10240
|
773
|
+
Disk size (in MB) required for this step. If
|
774
|
+
`@resources` is also present, the maximum value from all decorators is
|
775
|
+
used.
|
776
|
+
image : str, optional, default None
|
777
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
778
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
779
|
+
not, a default Docker image mapping to the current version of Python is used.
|
780
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
781
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
782
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
783
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
784
|
+
secrets : List[str], optional, default None
|
785
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
786
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
787
|
+
in Metaflow configuration.
|
788
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
789
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
790
|
+
gpu : int, optional, default None
|
791
|
+
Number of GPUs required for this step. A value of zero implies that
|
792
|
+
the scheduled node should not have GPUs.
|
793
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
794
|
+
The vendor of the GPUs to be used for this step.
|
795
|
+
tolerations : List[str], default []
|
796
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
797
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
798
|
+
use_tmpfs : bool, default False
|
799
|
+
This enables an explicit tmpfs mount for this step.
|
800
|
+
tmpfs_tempdir : bool, default True
|
801
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
802
|
+
tmpfs_size : int, optional, default: None
|
803
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
804
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
805
|
+
memory allocated for this step.
|
806
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
807
|
+
Path to tmpfs mount for this step.
|
808
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
809
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
810
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
811
|
+
port: int, optional
|
812
|
+
Number of the port to specify in the Kubernetes job object
|
813
|
+
shared_memory: int, optional
|
814
|
+
Shared memory size (in MiB) required for this steps
|
815
|
+
"""
|
816
|
+
...
|
817
|
+
|
792
818
|
@typing.overload
|
793
819
|
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]]]:
|
794
820
|
"""
|
@@ -846,110 +872,6 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
846
872
|
"""
|
847
873
|
...
|
848
874
|
|
849
|
-
@typing.overload
|
850
|
-
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]]]:
|
851
|
-
"""
|
852
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
853
|
-
|
854
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
855
|
-
|
856
|
-
Parameters
|
857
|
-
----------
|
858
|
-
type : str, default 'default'
|
859
|
-
Card type.
|
860
|
-
id : str, optional, default None
|
861
|
-
If multiple cards are present, use this id to identify this card.
|
862
|
-
options : Dict[str, Any], default {}
|
863
|
-
Options passed to the card. The contents depend on the card type.
|
864
|
-
timeout : int, default 45
|
865
|
-
Interrupt reporting if it takes more than this many seconds.
|
866
|
-
|
867
|
-
|
868
|
-
"""
|
869
|
-
...
|
870
|
-
|
871
|
-
@typing.overload
|
872
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
873
|
-
...
|
874
|
-
|
875
|
-
@typing.overload
|
876
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
877
|
-
...
|
878
|
-
|
879
|
-
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):
|
880
|
-
"""
|
881
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
882
|
-
|
883
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
884
|
-
|
885
|
-
Parameters
|
886
|
-
----------
|
887
|
-
type : str, default 'default'
|
888
|
-
Card type.
|
889
|
-
id : str, optional, default None
|
890
|
-
If multiple cards are present, use this id to identify this card.
|
891
|
-
options : Dict[str, Any], default {}
|
892
|
-
Options passed to the card. The contents depend on the card type.
|
893
|
-
timeout : int, default 45
|
894
|
-
Interrupt reporting if it takes more than this many seconds.
|
895
|
-
|
896
|
-
|
897
|
-
"""
|
898
|
-
...
|
899
|
-
|
900
|
-
@typing.overload
|
901
|
-
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]]]:
|
902
|
-
"""
|
903
|
-
Specifies the number of times the task corresponding
|
904
|
-
to a step needs to be retried.
|
905
|
-
|
906
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
907
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
908
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
909
|
-
|
910
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
911
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
912
|
-
ensuring that the flow execution can continue.
|
913
|
-
|
914
|
-
Parameters
|
915
|
-
----------
|
916
|
-
times : int, default 3
|
917
|
-
Number of times to retry this task.
|
918
|
-
minutes_between_retries : int, default 2
|
919
|
-
Number of minutes between retries.
|
920
|
-
"""
|
921
|
-
...
|
922
|
-
|
923
|
-
@typing.overload
|
924
|
-
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
925
|
-
...
|
926
|
-
|
927
|
-
@typing.overload
|
928
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
929
|
-
...
|
930
|
-
|
931
|
-
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):
|
932
|
-
"""
|
933
|
-
Specifies the number of times the task corresponding
|
934
|
-
to a step needs to be retried.
|
935
|
-
|
936
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
937
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
938
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
939
|
-
|
940
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
941
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
942
|
-
ensuring that the flow execution can continue.
|
943
|
-
|
944
|
-
Parameters
|
945
|
-
----------
|
946
|
-
times : int, default 3
|
947
|
-
Number of times to retry this task.
|
948
|
-
minutes_between_retries : int, default 2
|
949
|
-
Number of minutes between retries.
|
950
|
-
"""
|
951
|
-
...
|
952
|
-
|
953
875
|
@typing.overload
|
954
876
|
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
955
877
|
"""
|
@@ -1008,208 +930,51 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1008
930
|
...
|
1009
931
|
|
1010
932
|
@typing.overload
|
1011
|
-
def
|
933
|
+
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]]]:
|
1012
934
|
"""
|
1013
|
-
Specifies the
|
935
|
+
Specifies the resources needed when executing this step.
|
1014
936
|
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
937
|
+
Use `@resources` to specify the resource requirements
|
938
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
939
|
+
|
940
|
+
You can choose the compute layer on the command line by executing e.g.
|
941
|
+
```
|
942
|
+
python myflow.py run --with batch
|
943
|
+
```
|
944
|
+
or
|
945
|
+
```
|
946
|
+
python myflow.py run --with kubernetes
|
947
|
+
```
|
948
|
+
which executes the flow on the desired system using the
|
949
|
+
requirements specified in `@resources`.
|
1019
950
|
|
1020
951
|
Parameters
|
1021
952
|
----------
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
953
|
+
cpu : int, default 1
|
954
|
+
Number of CPUs required for this step.
|
955
|
+
gpu : int, default 0
|
956
|
+
Number of GPUs required for this step.
|
957
|
+
disk : int, optional, default None
|
958
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
959
|
+
memory : int, default 4096
|
960
|
+
Memory size (in MB) required for this step.
|
961
|
+
shared_memory : int, optional, default None
|
962
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
963
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1028
964
|
"""
|
1029
965
|
...
|
1030
966
|
|
1031
967
|
@typing.overload
|
1032
|
-
def
|
968
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1033
969
|
...
|
1034
970
|
|
1035
971
|
@typing.overload
|
1036
|
-
def
|
972
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1037
973
|
...
|
1038
974
|
|
1039
|
-
def
|
975
|
+
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):
|
1040
976
|
"""
|
1041
|
-
Specifies the
|
1042
|
-
|
1043
|
-
Information in this decorator will augment any
|
1044
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1045
|
-
you can use `@pypi_base` to set packages required by all
|
1046
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1047
|
-
|
1048
|
-
Parameters
|
1049
|
-
----------
|
1050
|
-
packages : Dict[str, str], default: {}
|
1051
|
-
Packages to use for this step. The key is the name of the package
|
1052
|
-
and the value is the version to use.
|
1053
|
-
python : str, optional, default: None
|
1054
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1055
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1056
|
-
"""
|
1057
|
-
...
|
1058
|
-
|
1059
|
-
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, port: typing.Optional[int] = None, 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]]]:
|
1060
|
-
"""
|
1061
|
-
Specifies that this step should execute on Kubernetes.
|
1062
|
-
|
1063
|
-
Parameters
|
1064
|
-
----------
|
1065
|
-
cpu : int, default 1
|
1066
|
-
Number of CPUs required for this step. If `@resources` is
|
1067
|
-
also present, the maximum value from all decorators is used.
|
1068
|
-
memory : int, default 4096
|
1069
|
-
Memory size (in MB) required for this step. If
|
1070
|
-
`@resources` is also present, the maximum value from all decorators is
|
1071
|
-
used.
|
1072
|
-
disk : int, default 10240
|
1073
|
-
Disk size (in MB) required for this step. If
|
1074
|
-
`@resources` is also present, the maximum value from all decorators is
|
1075
|
-
used.
|
1076
|
-
image : str, optional, default None
|
1077
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
1078
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1079
|
-
not, a default Docker image mapping to the current version of Python is used.
|
1080
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1081
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1082
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1083
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
1084
|
-
secrets : List[str], optional, default None
|
1085
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1086
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1087
|
-
in Metaflow configuration.
|
1088
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1089
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
1090
|
-
gpu : int, optional, default None
|
1091
|
-
Number of GPUs required for this step. A value of zero implies that
|
1092
|
-
the scheduled node should not have GPUs.
|
1093
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1094
|
-
The vendor of the GPUs to be used for this step.
|
1095
|
-
tolerations : List[str], default []
|
1096
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1097
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1098
|
-
use_tmpfs : bool, default False
|
1099
|
-
This enables an explicit tmpfs mount for this step.
|
1100
|
-
tmpfs_tempdir : bool, default True
|
1101
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1102
|
-
tmpfs_size : int, optional, default: None
|
1103
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1104
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1105
|
-
memory allocated for this step.
|
1106
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
1107
|
-
Path to tmpfs mount for this step.
|
1108
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
1109
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1110
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1111
|
-
port: int, optional
|
1112
|
-
Number of the port to specify in the Kubernetes job object
|
1113
|
-
shared_memory: int, optional
|
1114
|
-
Shared memory size (in MiB) required for this steps
|
1115
|
-
"""
|
1116
|
-
...
|
1117
|
-
|
1118
|
-
@typing.overload
|
1119
|
-
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]]]:
|
1120
|
-
"""
|
1121
|
-
Specifies that the step will success under all circumstances.
|
1122
|
-
|
1123
|
-
The decorator will create an optional artifact, specified by `var`, which
|
1124
|
-
contains the exception raised. You can use it to detect the presence
|
1125
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1126
|
-
are missing.
|
1127
|
-
|
1128
|
-
Parameters
|
1129
|
-
----------
|
1130
|
-
var : str, optional, default None
|
1131
|
-
Name of the artifact in which to store the caught exception.
|
1132
|
-
If not specified, the exception is not stored.
|
1133
|
-
print_exception : bool, default True
|
1134
|
-
Determines whether or not the exception is printed to
|
1135
|
-
stdout when caught.
|
1136
|
-
"""
|
1137
|
-
...
|
1138
|
-
|
1139
|
-
@typing.overload
|
1140
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1141
|
-
...
|
1142
|
-
|
1143
|
-
@typing.overload
|
1144
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1145
|
-
...
|
1146
|
-
|
1147
|
-
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):
|
1148
|
-
"""
|
1149
|
-
Specifies that the step will success under all circumstances.
|
1150
|
-
|
1151
|
-
The decorator will create an optional artifact, specified by `var`, which
|
1152
|
-
contains the exception raised. You can use it to detect the presence
|
1153
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1154
|
-
are missing.
|
1155
|
-
|
1156
|
-
Parameters
|
1157
|
-
----------
|
1158
|
-
var : str, optional, default None
|
1159
|
-
Name of the artifact in which to store the caught exception.
|
1160
|
-
If not specified, the exception is not stored.
|
1161
|
-
print_exception : bool, default True
|
1162
|
-
Determines whether or not the exception is printed to
|
1163
|
-
stdout when caught.
|
1164
|
-
"""
|
1165
|
-
...
|
1166
|
-
|
1167
|
-
@typing.overload
|
1168
|
-
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]]]:
|
1169
|
-
"""
|
1170
|
-
Specifies the resources needed when executing this step.
|
1171
|
-
|
1172
|
-
Use `@resources` to specify the resource requirements
|
1173
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1174
|
-
|
1175
|
-
You can choose the compute layer on the command line by executing e.g.
|
1176
|
-
```
|
1177
|
-
python myflow.py run --with batch
|
1178
|
-
```
|
1179
|
-
or
|
1180
|
-
```
|
1181
|
-
python myflow.py run --with kubernetes
|
1182
|
-
```
|
1183
|
-
which executes the flow on the desired system using the
|
1184
|
-
requirements specified in `@resources`.
|
1185
|
-
|
1186
|
-
Parameters
|
1187
|
-
----------
|
1188
|
-
cpu : int, default 1
|
1189
|
-
Number of CPUs required for this step.
|
1190
|
-
gpu : int, default 0
|
1191
|
-
Number of GPUs required for this step.
|
1192
|
-
disk : int, optional, default None
|
1193
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1194
|
-
memory : int, default 4096
|
1195
|
-
Memory size (in MB) required for this step.
|
1196
|
-
shared_memory : int, optional, default None
|
1197
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1198
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1199
|
-
"""
|
1200
|
-
...
|
1201
|
-
|
1202
|
-
@typing.overload
|
1203
|
-
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1204
|
-
...
|
1205
|
-
|
1206
|
-
@typing.overload
|
1207
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1208
|
-
...
|
1209
|
-
|
1210
|
-
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):
|
1211
|
-
"""
|
1212
|
-
Specifies the resources needed when executing this step.
|
977
|
+
Specifies the resources needed when executing this step.
|
1213
978
|
|
1214
979
|
Use `@resources` to specify the resource requirements
|
1215
980
|
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
@@ -1242,7 +1007,7 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
1242
1007
|
...
|
1243
1008
|
|
1244
1009
|
@typing.overload
|
1245
|
-
def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, efa: 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]]]:
|
1010
|
+
def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[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]]]:
|
1246
1011
|
"""
|
1247
1012
|
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
1248
1013
|
|
@@ -1283,7 +1048,8 @@ def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optio
|
|
1283
1048
|
necessary. A swappiness value of 100 causes pages to be swapped very
|
1284
1049
|
aggressively. Accepted values are whole numbers between 0 and 100.
|
1285
1050
|
use_tmpfs : bool, default False
|
1286
|
-
This enables an explicit tmpfs mount for this step.
|
1051
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
1052
|
+
not available on Fargate compute environments
|
1287
1053
|
tmpfs_tempdir : bool, default True
|
1288
1054
|
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1289
1055
|
tmpfs_size : int, optional, default None
|
@@ -1294,8 +1060,19 @@ def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optio
|
|
1294
1060
|
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1295
1061
|
inferentia : int, default 0
|
1296
1062
|
Number of Inferentia chips required for this step.
|
1063
|
+
trainium : int, default None
|
1064
|
+
Alias for inferentia. Use only one of the two.
|
1297
1065
|
efa : int, default 0
|
1298
1066
|
Number of elastic fabric adapter network devices to attach to container
|
1067
|
+
ephemeral_storage: int, default None
|
1068
|
+
The total amount, in GiB, of ephemeral storage to set for the task (21-200)
|
1069
|
+
This is only relevant for Fargate compute environments
|
1070
|
+
log_driver: str, optional, default None
|
1071
|
+
The log driver to use for the Amazon ECS container.
|
1072
|
+
log_options: List[str], optional, default None
|
1073
|
+
List of strings containing options for the chosen log driver. The configurable values
|
1074
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1075
|
+
Example usage: ["awslogs-group:aws/batch/job"]
|
1299
1076
|
"""
|
1300
1077
|
...
|
1301
1078
|
|
@@ -1307,7 +1084,7 @@ def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Calla
|
|
1307
1084
|
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1308
1085
|
...
|
1309
1086
|
|
1310
|
-
def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, efa: int = 0):
|
1087
|
+
def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None):
|
1311
1088
|
"""
|
1312
1089
|
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
1313
1090
|
|
@@ -1348,7 +1125,8 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1348
1125
|
necessary. A swappiness value of 100 causes pages to be swapped very
|
1349
1126
|
aggressively. Accepted values are whole numbers between 0 and 100.
|
1350
1127
|
use_tmpfs : bool, default False
|
1351
|
-
This enables an explicit tmpfs mount for this step.
|
1128
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
1129
|
+
not available on Fargate compute environments
|
1352
1130
|
tmpfs_tempdir : bool, default True
|
1353
1131
|
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1354
1132
|
tmpfs_size : int, optional, default None
|
@@ -1359,293 +1137,296 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1359
1137
|
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1360
1138
|
inferentia : int, default 0
|
1361
1139
|
Number of Inferentia chips required for this step.
|
1140
|
+
trainium : int, default None
|
1141
|
+
Alias for inferentia. Use only one of the two.
|
1362
1142
|
efa : int, default 0
|
1363
1143
|
Number of elastic fabric adapter network devices to attach to container
|
1144
|
+
ephemeral_storage: int, default None
|
1145
|
+
The total amount, in GiB, of ephemeral storage to set for the task (21-200)
|
1146
|
+
This is only relevant for Fargate compute environments
|
1147
|
+
log_driver: str, optional, default None
|
1148
|
+
The log driver to use for the Amazon ECS container.
|
1149
|
+
log_options: List[str], optional, default None
|
1150
|
+
List of strings containing options for the chosen log driver. The configurable values
|
1151
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1152
|
+
Example usage: ["awslogs-group:aws/batch/job"]
|
1364
1153
|
"""
|
1365
1154
|
...
|
1366
1155
|
|
1367
|
-
|
1156
|
+
@typing.overload
|
1157
|
+
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]]]:
|
1368
1158
|
"""
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1159
|
+
Specifies the number of times the task corresponding
|
1160
|
+
to a step needs to be retried.
|
1161
|
+
|
1162
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1163
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1164
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1165
|
+
|
1166
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1167
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1168
|
+
ensuring that the flow execution can continue.
|
1374
1169
|
|
1375
1170
|
Parameters
|
1376
1171
|
----------
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
mode : str
|
1382
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1383
|
-
exponential_backoff : bool
|
1384
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1385
|
-
pool : str
|
1386
|
-
the slot pool this task should run in,
|
1387
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1388
|
-
soft_fail : bool
|
1389
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1390
|
-
name : str
|
1391
|
-
Name of the sensor on Airflow
|
1392
|
-
description : str
|
1393
|
-
Description of sensor in the Airflow UI
|
1394
|
-
bucket_key : Union[str, List[str]]
|
1395
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1396
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1397
|
-
bucket_name : str
|
1398
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1399
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1400
|
-
wildcard_match : bool
|
1401
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1402
|
-
aws_conn_id : str
|
1403
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1404
|
-
verify : bool
|
1405
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1172
|
+
times : int, default 3
|
1173
|
+
Number of times to retry this task.
|
1174
|
+
minutes_between_retries : int, default 2
|
1175
|
+
Number of minutes between retries.
|
1406
1176
|
"""
|
1407
1177
|
...
|
1408
1178
|
|
1409
|
-
|
1179
|
+
@typing.overload
|
1180
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1181
|
+
...
|
1182
|
+
|
1183
|
+
@typing.overload
|
1184
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1185
|
+
...
|
1186
|
+
|
1187
|
+
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):
|
1410
1188
|
"""
|
1411
|
-
|
1412
|
-
|
1189
|
+
Specifies the number of times the task corresponding
|
1190
|
+
to a step needs to be retried.
|
1191
|
+
|
1192
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1193
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1194
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1195
|
+
|
1196
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1197
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1198
|
+
ensuring that the flow execution can continue.
|
1413
1199
|
|
1414
1200
|
Parameters
|
1415
1201
|
----------
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
mode : str
|
1421
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1422
|
-
exponential_backoff : bool
|
1423
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1424
|
-
pool : str
|
1425
|
-
the slot pool this task should run in,
|
1426
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1427
|
-
soft_fail : bool
|
1428
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1429
|
-
name : str
|
1430
|
-
Name of the sensor on Airflow
|
1431
|
-
description : str
|
1432
|
-
Description of sensor in the Airflow UI
|
1433
|
-
external_dag_id : str
|
1434
|
-
The dag_id that contains the task you want to wait for.
|
1435
|
-
external_task_ids : List[str]
|
1436
|
-
The list of task_ids that you want to wait for.
|
1437
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1438
|
-
allowed_states : List[str]
|
1439
|
-
Iterable of allowed states, (Default: ['success'])
|
1440
|
-
failed_states : List[str]
|
1441
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1442
|
-
execution_delta : datetime.timedelta
|
1443
|
-
time difference with the previous execution to look at,
|
1444
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1445
|
-
check_existence: bool
|
1446
|
-
Set to True to check if the external task exists or check if
|
1447
|
-
the DAG to wait for exists. (Default: True)
|
1202
|
+
times : int, default 3
|
1203
|
+
Number of times to retry this task.
|
1204
|
+
minutes_between_retries : int, default 2
|
1205
|
+
Number of minutes between retries.
|
1448
1206
|
"""
|
1449
1207
|
...
|
1450
1208
|
|
1451
|
-
|
1209
|
+
@typing.overload
|
1210
|
+
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]]]:
|
1452
1211
|
"""
|
1453
|
-
Specifies
|
1212
|
+
Specifies the PyPI packages for the step.
|
1454
1213
|
|
1455
|
-
|
1456
|
-
|
1214
|
+
Information in this decorator will augment any
|
1215
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1216
|
+
you can use `@pypi_base` to set packages required by all
|
1217
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1457
1218
|
|
1458
1219
|
Parameters
|
1459
1220
|
----------
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1221
|
+
packages : Dict[str, str], default: {}
|
1222
|
+
Packages to use for this step. The key is the name of the package
|
1223
|
+
and the value is the version to use.
|
1224
|
+
python : str, optional, default: None
|
1225
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1226
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1466
1227
|
"""
|
1467
1228
|
...
|
1468
1229
|
|
1469
1230
|
@typing.overload
|
1470
|
-
def
|
1231
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1232
|
+
...
|
1233
|
+
|
1234
|
+
@typing.overload
|
1235
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1236
|
+
...
|
1237
|
+
|
1238
|
+
def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1471
1239
|
"""
|
1472
|
-
Specifies the
|
1240
|
+
Specifies the PyPI packages for the step.
|
1473
1241
|
|
1474
|
-
|
1475
|
-
|
1242
|
+
Information in this decorator will augment any
|
1243
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1244
|
+
you can use `@pypi_base` to set packages required by all
|
1245
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1476
1246
|
|
1477
1247
|
Parameters
|
1478
1248
|
----------
|
1479
|
-
packages : Dict[str, str], default {}
|
1480
|
-
Packages to use for this
|
1249
|
+
packages : Dict[str, str], default: {}
|
1250
|
+
Packages to use for this step. The key is the name of the package
|
1481
1251
|
and the value is the version to use.
|
1482
|
-
|
1483
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1484
|
-
python : str, optional, default None
|
1252
|
+
python : str, optional, default: None
|
1485
1253
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1486
1254
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1487
|
-
disabled : bool, default False
|
1488
|
-
If set to True, disables Conda.
|
1489
1255
|
"""
|
1490
1256
|
...
|
1491
1257
|
|
1492
1258
|
@typing.overload
|
1493
|
-
def
|
1259
|
+
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]]]:
|
1260
|
+
"""
|
1261
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1262
|
+
|
1263
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1264
|
+
|
1265
|
+
Parameters
|
1266
|
+
----------
|
1267
|
+
type : str, default 'default'
|
1268
|
+
Card type.
|
1269
|
+
id : str, optional, default None
|
1270
|
+
If multiple cards are present, use this id to identify this card.
|
1271
|
+
options : Dict[str, Any], default {}
|
1272
|
+
Options passed to the card. The contents depend on the card type.
|
1273
|
+
timeout : int, default 45
|
1274
|
+
Interrupt reporting if it takes more than this many seconds.
|
1275
|
+
|
1276
|
+
|
1277
|
+
"""
|
1494
1278
|
...
|
1495
1279
|
|
1496
|
-
|
1280
|
+
@typing.overload
|
1281
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1282
|
+
...
|
1283
|
+
|
1284
|
+
@typing.overload
|
1285
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1286
|
+
...
|
1287
|
+
|
1288
|
+
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):
|
1497
1289
|
"""
|
1498
|
-
|
1290
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1499
1291
|
|
1500
|
-
|
1501
|
-
steps and use `@conda` to specify step-specific additions.
|
1292
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1502
1293
|
|
1503
1294
|
Parameters
|
1504
1295
|
----------
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1296
|
+
type : str, default 'default'
|
1297
|
+
Card type.
|
1298
|
+
id : str, optional, default None
|
1299
|
+
If multiple cards are present, use this id to identify this card.
|
1300
|
+
options : Dict[str, Any], default {}
|
1301
|
+
Options passed to the card. The contents depend on the card type.
|
1302
|
+
timeout : int, default 45
|
1303
|
+
Interrupt reporting if it takes more than this many seconds.
|
1304
|
+
|
1305
|
+
|
1515
1306
|
"""
|
1516
1307
|
...
|
1517
1308
|
|
1518
1309
|
@typing.overload
|
1519
|
-
def
|
1310
|
+
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]]]:
|
1520
1311
|
"""
|
1521
|
-
Specifies
|
1312
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1313
|
+
the execution of a step.
|
1522
1314
|
|
1523
|
-
Use `@pypi_base` to set common packages required by all
|
1524
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1525
1315
|
Parameters
|
1526
1316
|
----------
|
1527
|
-
|
1528
|
-
|
1529
|
-
and the value is the version to use.
|
1530
|
-
python : str, optional, default: None
|
1531
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1532
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1317
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1318
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1533
1319
|
"""
|
1534
1320
|
...
|
1535
1321
|
|
1536
1322
|
@typing.overload
|
1537
|
-
def
|
1323
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1538
1324
|
...
|
1539
1325
|
|
1540
|
-
|
1326
|
+
@typing.overload
|
1327
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1328
|
+
...
|
1329
|
+
|
1330
|
+
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]]] = []):
|
1541
1331
|
"""
|
1542
|
-
Specifies
|
1332
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1333
|
+
the execution of a step.
|
1543
1334
|
|
1544
|
-
Use `@pypi_base` to set common packages required by all
|
1545
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1546
1335
|
Parameters
|
1547
1336
|
----------
|
1548
|
-
|
1549
|
-
|
1550
|
-
and the value is the version to use.
|
1551
|
-
python : str, optional, default: None
|
1552
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1553
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1337
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1338
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1554
1339
|
"""
|
1555
1340
|
...
|
1556
1341
|
|
1557
1342
|
@typing.overload
|
1558
|
-
def
|
1343
|
+
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]]]:
|
1559
1344
|
"""
|
1560
|
-
Specifies
|
1561
|
-
|
1345
|
+
Specifies that the step will success under all circumstances.
|
1346
|
+
|
1347
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1348
|
+
contains the exception raised. You can use it to detect the presence
|
1349
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1350
|
+
are missing.
|
1562
1351
|
|
1563
1352
|
Parameters
|
1564
1353
|
----------
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
cron : str, optional, default None
|
1572
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1573
|
-
specified by this expression.
|
1574
|
-
timezone : str, optional, default None
|
1575
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1576
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1354
|
+
var : str, optional, default None
|
1355
|
+
Name of the artifact in which to store the caught exception.
|
1356
|
+
If not specified, the exception is not stored.
|
1357
|
+
print_exception : bool, default True
|
1358
|
+
Determines whether or not the exception is printed to
|
1359
|
+
stdout when caught.
|
1577
1360
|
"""
|
1578
1361
|
...
|
1579
1362
|
|
1580
1363
|
@typing.overload
|
1581
|
-
def
|
1364
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1582
1365
|
...
|
1583
1366
|
|
1584
|
-
|
1367
|
+
@typing.overload
|
1368
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1369
|
+
...
|
1370
|
+
|
1371
|
+
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):
|
1585
1372
|
"""
|
1586
|
-
Specifies
|
1587
|
-
|
1373
|
+
Specifies that the step will success under all circumstances.
|
1374
|
+
|
1375
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1376
|
+
contains the exception raised. You can use it to detect the presence
|
1377
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1378
|
+
are missing.
|
1588
1379
|
|
1589
1380
|
Parameters
|
1590
1381
|
----------
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
cron : str, optional, default None
|
1598
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1599
|
-
specified by this expression.
|
1600
|
-
timezone : str, optional, default None
|
1601
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1602
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1382
|
+
var : str, optional, default None
|
1383
|
+
Name of the artifact in which to store the caught exception.
|
1384
|
+
If not specified, the exception is not stored.
|
1385
|
+
print_exception : bool, default True
|
1386
|
+
Determines whether or not the exception is printed to
|
1387
|
+
stdout when caught.
|
1603
1388
|
"""
|
1604
1389
|
...
|
1605
1390
|
|
1606
1391
|
@typing.overload
|
1607
|
-
def
|
1392
|
+
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]]:
|
1608
1393
|
"""
|
1609
|
-
Specifies the
|
1394
|
+
Specifies the event(s) that this flow depends on.
|
1610
1395
|
|
1611
1396
|
```
|
1612
|
-
@
|
1397
|
+
@trigger(event='foo')
|
1613
1398
|
```
|
1614
1399
|
or
|
1615
1400
|
```
|
1616
|
-
@
|
1401
|
+
@trigger(events=['foo', 'bar'])
|
1617
1402
|
```
|
1618
|
-
This decorator respects the @project decorator and triggers the flow
|
1619
|
-
when upstream runs within the same namespace complete successfully
|
1620
1403
|
|
1621
|
-
Additionally, you can specify
|
1622
|
-
|
1404
|
+
Additionally, you can specify the parameter mappings
|
1405
|
+
to map event payload to Metaflow parameters for the flow.
|
1623
1406
|
```
|
1624
|
-
@
|
1407
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1625
1408
|
```
|
1626
1409
|
or
|
1627
1410
|
```
|
1628
|
-
@
|
1411
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1412
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1629
1413
|
```
|
1630
1414
|
|
1631
|
-
|
1632
|
-
inferred from the current project or project branch):
|
1415
|
+
'parameters' can also be a list of strings and tuples like so:
|
1633
1416
|
```
|
1634
|
-
@
|
1417
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1418
|
+
```
|
1419
|
+
This is equivalent to:
|
1420
|
+
```
|
1421
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1635
1422
|
```
|
1636
|
-
|
1637
|
-
Note that `branch` is typically one of:
|
1638
|
-
- `prod`
|
1639
|
-
- `user.bob`
|
1640
|
-
- `test.my_experiment`
|
1641
|
-
- `prod.staging`
|
1642
1423
|
|
1643
1424
|
Parameters
|
1644
1425
|
----------
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1426
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1427
|
+
Event dependency for this flow.
|
1428
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1429
|
+
Events dependency for this flow.
|
1649
1430
|
options : Dict[str, Any], default {}
|
1650
1431
|
Backend-specific configuration for tuning eventing behavior.
|
1651
1432
|
|
@@ -1654,10 +1435,74 @@ def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[str, str], None] =
|
|
1654
1435
|
...
|
1655
1436
|
|
1656
1437
|
@typing.overload
|
1657
|
-
def
|
1438
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1658
1439
|
...
|
1659
1440
|
|
1660
|
-
def
|
1441
|
+
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] = {}):
|
1442
|
+
"""
|
1443
|
+
Specifies the event(s) that this flow depends on.
|
1444
|
+
|
1445
|
+
```
|
1446
|
+
@trigger(event='foo')
|
1447
|
+
```
|
1448
|
+
or
|
1449
|
+
```
|
1450
|
+
@trigger(events=['foo', 'bar'])
|
1451
|
+
```
|
1452
|
+
|
1453
|
+
Additionally, you can specify the parameter mappings
|
1454
|
+
to map event payload to Metaflow parameters for the flow.
|
1455
|
+
```
|
1456
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1457
|
+
```
|
1458
|
+
or
|
1459
|
+
```
|
1460
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1461
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1462
|
+
```
|
1463
|
+
|
1464
|
+
'parameters' can also be a list of strings and tuples like so:
|
1465
|
+
```
|
1466
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1467
|
+
```
|
1468
|
+
This is equivalent to:
|
1469
|
+
```
|
1470
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1471
|
+
```
|
1472
|
+
|
1473
|
+
Parameters
|
1474
|
+
----------
|
1475
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1476
|
+
Event dependency for this flow.
|
1477
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1478
|
+
Events dependency for this flow.
|
1479
|
+
options : Dict[str, Any], default {}
|
1480
|
+
Backend-specific configuration for tuning eventing behavior.
|
1481
|
+
|
1482
|
+
|
1483
|
+
"""
|
1484
|
+
...
|
1485
|
+
|
1486
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1487
|
+
"""
|
1488
|
+
Specifies what flows belong to the same project.
|
1489
|
+
|
1490
|
+
A project-specific namespace is created for all flows that
|
1491
|
+
use the same `@project(name)`.
|
1492
|
+
|
1493
|
+
Parameters
|
1494
|
+
----------
|
1495
|
+
name : str
|
1496
|
+
Project name. Make sure that the name is unique amongst all
|
1497
|
+
projects that use the same production scheduler. The name may
|
1498
|
+
contain only lowercase alphanumeric characters and underscores.
|
1499
|
+
|
1500
|
+
|
1501
|
+
"""
|
1502
|
+
...
|
1503
|
+
|
1504
|
+
@typing.overload
|
1505
|
+
def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[str, str], None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1661
1506
|
"""
|
1662
1507
|
Specifies the flow(s) that this flow depends on.
|
1663
1508
|
|
@@ -1707,44 +1552,51 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1707
1552
|
...
|
1708
1553
|
|
1709
1554
|
@typing.overload
|
1710
|
-
def
|
1555
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1556
|
+
...
|
1557
|
+
|
1558
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[str, typing.Dict[str, str], None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1711
1559
|
"""
|
1712
|
-
Specifies the
|
1560
|
+
Specifies the flow(s) that this flow depends on.
|
1713
1561
|
|
1714
1562
|
```
|
1715
|
-
@
|
1563
|
+
@trigger_on_finish(flow='FooFlow')
|
1716
1564
|
```
|
1717
1565
|
or
|
1718
1566
|
```
|
1719
|
-
@
|
1567
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1720
1568
|
```
|
1569
|
+
This decorator respects the @project decorator and triggers the flow
|
1570
|
+
when upstream runs within the same namespace complete successfully
|
1721
1571
|
|
1722
|
-
Additionally, you can specify
|
1723
|
-
|
1572
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1573
|
+
by specifying the fully qualified project_flow_name.
|
1724
1574
|
```
|
1725
|
-
@
|
1575
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1726
1576
|
```
|
1727
1577
|
or
|
1728
1578
|
```
|
1729
|
-
@
|
1730
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1579
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1731
1580
|
```
|
1732
1581
|
|
1733
|
-
|
1734
|
-
|
1735
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1736
|
-
```
|
1737
|
-
This is equivalent to:
|
1582
|
+
You can also specify just the project or project branch (other values will be
|
1583
|
+
inferred from the current project or project branch):
|
1738
1584
|
```
|
1739
|
-
@
|
1585
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1740
1586
|
```
|
1741
1587
|
|
1588
|
+
Note that `branch` is typically one of:
|
1589
|
+
- `prod`
|
1590
|
+
- `user.bob`
|
1591
|
+
- `test.my_experiment`
|
1592
|
+
- `prod.staging`
|
1593
|
+
|
1742
1594
|
Parameters
|
1743
1595
|
----------
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1596
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1597
|
+
Upstream flow dependency for this flow.
|
1598
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1599
|
+
Upstream flow dependencies for this flow.
|
1748
1600
|
options : Dict[str, Any], default {}
|
1749
1601
|
Backend-specific configuration for tuning eventing behavior.
|
1750
1602
|
|
@@ -1753,51 +1605,223 @@ def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = No
|
|
1753
1605
|
...
|
1754
1606
|
|
1755
1607
|
@typing.overload
|
1756
|
-
def
|
1608
|
+
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]]:
|
1609
|
+
"""
|
1610
|
+
Specifies the times when the flow should be run when running on a
|
1611
|
+
production scheduler.
|
1612
|
+
|
1613
|
+
Parameters
|
1614
|
+
----------
|
1615
|
+
hourly : bool, default False
|
1616
|
+
Run the workflow hourly.
|
1617
|
+
daily : bool, default True
|
1618
|
+
Run the workflow daily.
|
1619
|
+
weekly : bool, default False
|
1620
|
+
Run the workflow weekly.
|
1621
|
+
cron : str, optional, default None
|
1622
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1623
|
+
specified by this expression.
|
1624
|
+
timezone : str, optional, default None
|
1625
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1626
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1627
|
+
"""
|
1757
1628
|
...
|
1758
1629
|
|
1759
|
-
|
1630
|
+
@typing.overload
|
1631
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1632
|
+
...
|
1633
|
+
|
1634
|
+
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):
|
1760
1635
|
"""
|
1761
|
-
Specifies the
|
1636
|
+
Specifies the times when the flow should be run when running on a
|
1637
|
+
production scheduler.
|
1762
1638
|
|
1763
|
-
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1639
|
+
Parameters
|
1640
|
+
----------
|
1641
|
+
hourly : bool, default False
|
1642
|
+
Run the workflow hourly.
|
1643
|
+
daily : bool, default True
|
1644
|
+
Run the workflow daily.
|
1645
|
+
weekly : bool, default False
|
1646
|
+
Run the workflow weekly.
|
1647
|
+
cron : str, optional, default None
|
1648
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1649
|
+
specified by this expression.
|
1650
|
+
timezone : str, optional, default None
|
1651
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1652
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1653
|
+
"""
|
1654
|
+
...
|
1655
|
+
|
1656
|
+
@typing.overload
|
1657
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1658
|
+
"""
|
1659
|
+
Specifies the PyPI packages for all steps of the flow.
|
1770
1660
|
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1661
|
+
Use `@pypi_base` to set common packages required by all
|
1662
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1663
|
+
Parameters
|
1664
|
+
----------
|
1665
|
+
packages : Dict[str, str], default: {}
|
1666
|
+
Packages to use for this flow. The key is the name of the package
|
1667
|
+
and the value is the version to use.
|
1668
|
+
python : str, optional, default: None
|
1669
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1670
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1671
|
+
"""
|
1672
|
+
...
|
1673
|
+
|
1674
|
+
@typing.overload
|
1675
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1676
|
+
...
|
1677
|
+
|
1678
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1679
|
+
"""
|
1680
|
+
Specifies the PyPI packages for all steps of the flow.
|
1781
1681
|
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1682
|
+
Use `@pypi_base` to set common packages required by all
|
1683
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1684
|
+
Parameters
|
1685
|
+
----------
|
1686
|
+
packages : Dict[str, str], default: {}
|
1687
|
+
Packages to use for this flow. The key is the name of the package
|
1688
|
+
and the value is the version to use.
|
1689
|
+
python : str, optional, default: None
|
1690
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1691
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1692
|
+
"""
|
1693
|
+
...
|
1694
|
+
|
1695
|
+
def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1696
|
+
"""
|
1697
|
+
The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
|
1698
|
+
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1790
1699
|
|
1791
1700
|
Parameters
|
1792
1701
|
----------
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1702
|
+
timeout : int
|
1703
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1704
|
+
poke_interval : int
|
1705
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1706
|
+
mode : str
|
1707
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1708
|
+
exponential_backoff : bool
|
1709
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1710
|
+
pool : str
|
1711
|
+
the slot pool this task should run in,
|
1712
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1713
|
+
soft_fail : bool
|
1714
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1715
|
+
name : str
|
1716
|
+
Name of the sensor on Airflow
|
1717
|
+
description : str
|
1718
|
+
Description of sensor in the Airflow UI
|
1719
|
+
external_dag_id : str
|
1720
|
+
The dag_id that contains the task you want to wait for.
|
1721
|
+
external_task_ids : List[str]
|
1722
|
+
The list of task_ids that you want to wait for.
|
1723
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1724
|
+
allowed_states : List[str]
|
1725
|
+
Iterable of allowed states, (Default: ['success'])
|
1726
|
+
failed_states : List[str]
|
1727
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1728
|
+
execution_delta : datetime.timedelta
|
1729
|
+
time difference with the previous execution to look at,
|
1730
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1731
|
+
check_existence: bool
|
1732
|
+
Set to True to check if the external task exists or check if
|
1733
|
+
the DAG to wait for exists. (Default: True)
|
1734
|
+
"""
|
1735
|
+
...
|
1736
|
+
|
1737
|
+
@typing.overload
|
1738
|
+
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]]:
|
1739
|
+
"""
|
1740
|
+
Specifies the Conda environment for all steps of the flow.
|
1741
|
+
|
1742
|
+
Use `@conda_base` to set common libraries required by all
|
1743
|
+
steps and use `@conda` to specify step-specific additions.
|
1744
|
+
|
1745
|
+
Parameters
|
1746
|
+
----------
|
1747
|
+
packages : Dict[str, str], default {}
|
1748
|
+
Packages to use for this flow. The key is the name of the package
|
1749
|
+
and the value is the version to use.
|
1750
|
+
libraries : Dict[str, str], default {}
|
1751
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1752
|
+
python : str, optional, default None
|
1753
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1754
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1755
|
+
disabled : bool, default False
|
1756
|
+
If set to True, disables Conda.
|
1757
|
+
"""
|
1758
|
+
...
|
1759
|
+
|
1760
|
+
@typing.overload
|
1761
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1762
|
+
...
|
1763
|
+
|
1764
|
+
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):
|
1765
|
+
"""
|
1766
|
+
Specifies the Conda environment for all steps of the flow.
|
1767
|
+
|
1768
|
+
Use `@conda_base` to set common libraries required by all
|
1769
|
+
steps and use `@conda` to specify step-specific additions.
|
1799
1770
|
|
1771
|
+
Parameters
|
1772
|
+
----------
|
1773
|
+
packages : Dict[str, str], default {}
|
1774
|
+
Packages to use for this flow. The key is the name of the package
|
1775
|
+
and the value is the version to use.
|
1776
|
+
libraries : Dict[str, str], default {}
|
1777
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1778
|
+
python : str, optional, default None
|
1779
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1780
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1781
|
+
disabled : bool, default False
|
1782
|
+
If set to True, disables Conda.
|
1783
|
+
"""
|
1784
|
+
...
|
1785
|
+
|
1786
|
+
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]]:
|
1787
|
+
"""
|
1788
|
+
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)
|
1789
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1790
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1791
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1792
|
+
starts only after all sensors finish.
|
1800
1793
|
|
1794
|
+
Parameters
|
1795
|
+
----------
|
1796
|
+
timeout : int
|
1797
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1798
|
+
poke_interval : int
|
1799
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1800
|
+
mode : str
|
1801
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1802
|
+
exponential_backoff : bool
|
1803
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1804
|
+
pool : str
|
1805
|
+
the slot pool this task should run in,
|
1806
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1807
|
+
soft_fail : bool
|
1808
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1809
|
+
name : str
|
1810
|
+
Name of the sensor on Airflow
|
1811
|
+
description : str
|
1812
|
+
Description of sensor in the Airflow UI
|
1813
|
+
bucket_key : Union[str, List[str]]
|
1814
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1815
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1816
|
+
bucket_name : str
|
1817
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1818
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1819
|
+
wildcard_match : bool
|
1820
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1821
|
+
aws_conn_id : str
|
1822
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1823
|
+
verify : bool
|
1824
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1801
1825
|
"""
|
1802
1826
|
...
|
1803
1827
|
|