metaflow-stubs 2.11.14__py2.py3-none-any.whl → 2.11.15__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 +493 -493
- metaflow-stubs/cards.pyi +4 -4
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +4 -4
- metaflow-stubs/client/core.pyi +6 -6
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/clone_util.pyi +2 -2
- 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 +3 -3
- metaflow-stubs/metadata/metadata.pyi +2 -2
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +4 -4
- 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 +3 -3
- 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 +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
- 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_cli.pyi +6 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- 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 +4 -4
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/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_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_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 +3 -3
- 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 +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/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 +4 -4
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +4 -4
- 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 +3 -3
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- 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/logs_cli.pyi +45 -0
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +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 +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- 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 +3 -3
- 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
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.11.14.dist-info → metaflow_stubs-2.11.15.dist-info}/METADATA +2 -2
- metaflow_stubs-2.11.15.dist-info/RECORD +133 -0
- metaflow_stubs-2.11.14.dist-info/RECORD +0 -132
- {metaflow_stubs-2.11.14.dist-info → metaflow_stubs-2.11.15.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.11.14.dist-info → metaflow_stubs-2.11.15.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.11.
|
4
|
-
# Generated on 2024-05-
|
3
|
+
# MF version: 2.11.15 #
|
4
|
+
# Generated on 2024-05-08T22:46:02.315605 #
|
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.
|
12
|
-
import metaflow.datastore.inputs
|
13
|
-
import metaflow.plugins.datatools.s3.s3
|
11
|
+
import metaflow.events
|
14
12
|
import datetime
|
15
13
|
import metaflow.parameters
|
16
|
-
import metaflow.client.core
|
17
14
|
import io
|
15
|
+
import metaflow.client.core
|
16
|
+
import metaflow.datastore.inputs
|
17
|
+
import metaflow.plugins.datatools.s3.s3
|
18
|
+
import metaflow.metaflow_current
|
18
19
|
import metaflow._vendor.click.types
|
19
|
-
import metaflow.events
|
20
20
|
import typing
|
21
21
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
22
22
|
StepFlag = typing.NewType("StepFlag", bool)
|
@@ -725,119 +725,80 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
725
725
|
"""
|
726
726
|
...
|
727
727
|
|
728
|
-
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) -> 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]]]:
|
729
|
-
"""
|
730
|
-
Specifies that this step should execute on Kubernetes.
|
731
|
-
|
732
|
-
Parameters
|
733
|
-
----------
|
734
|
-
cpu : int, default 1
|
735
|
-
Number of CPUs required for this step. If `@resources` is
|
736
|
-
also present, the maximum value from all decorators is used.
|
737
|
-
memory : int, default 4096
|
738
|
-
Memory size (in MB) required for this step. If
|
739
|
-
`@resources` is also present, the maximum value from all decorators is
|
740
|
-
used.
|
741
|
-
disk : int, default 10240
|
742
|
-
Disk size (in MB) required for this step. If
|
743
|
-
`@resources` is also present, the maximum value from all decorators is
|
744
|
-
used.
|
745
|
-
image : str, optional, default None
|
746
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
747
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
748
|
-
not, a default Docker image mapping to the current version of Python is used.
|
749
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
750
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
751
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
752
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
753
|
-
secrets : List[str], optional, default None
|
754
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
755
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
756
|
-
in Metaflow configuration.
|
757
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
758
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
759
|
-
gpu : int, optional, default None
|
760
|
-
Number of GPUs required for this step. A value of zero implies that
|
761
|
-
the scheduled node should not have GPUs.
|
762
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
763
|
-
The vendor of the GPUs to be used for this step.
|
764
|
-
tolerations : List[str], default []
|
765
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
766
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
767
|
-
use_tmpfs : bool, default False
|
768
|
-
This enables an explicit tmpfs mount for this step.
|
769
|
-
tmpfs_tempdir : bool, default True
|
770
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
771
|
-
tmpfs_size : int, optional, default: None
|
772
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
773
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
774
|
-
memory allocated for this step.
|
775
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
776
|
-
Path to tmpfs mount for this step.
|
777
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
778
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
779
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
780
|
-
shared_memory: int, optional
|
781
|
-
Shared memory size (in MiB) required for this step
|
782
|
-
port: int, optional
|
783
|
-
Port number to specify in the Kubernetes job object
|
784
|
-
"""
|
785
|
-
...
|
786
|
-
|
787
728
|
@typing.overload
|
788
|
-
def
|
729
|
+
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]]]:
|
789
730
|
"""
|
790
|
-
Specifies
|
791
|
-
|
792
|
-
This decorator is useful if this step may hang indefinitely.
|
731
|
+
Specifies the resources needed when executing this step.
|
793
732
|
|
794
|
-
|
795
|
-
|
796
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
733
|
+
Use `@resources` to specify the resource requirements
|
734
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
797
735
|
|
798
|
-
|
799
|
-
|
736
|
+
You can choose the compute layer on the command line by executing e.g.
|
737
|
+
```
|
738
|
+
python myflow.py run --with batch
|
739
|
+
```
|
740
|
+
or
|
741
|
+
```
|
742
|
+
python myflow.py run --with kubernetes
|
743
|
+
```
|
744
|
+
which executes the flow on the desired system using the
|
745
|
+
requirements specified in `@resources`.
|
800
746
|
|
801
747
|
Parameters
|
802
748
|
----------
|
803
|
-
|
804
|
-
Number of
|
805
|
-
|
806
|
-
Number of
|
807
|
-
|
808
|
-
|
749
|
+
cpu : int, default 1
|
750
|
+
Number of CPUs required for this step.
|
751
|
+
gpu : int, default 0
|
752
|
+
Number of GPUs required for this step.
|
753
|
+
disk : int, optional, default None
|
754
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
755
|
+
memory : int, default 4096
|
756
|
+
Memory size (in MB) required for this step.
|
757
|
+
shared_memory : int, optional, default None
|
758
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
759
|
+
This parameter maps to the `--shm-size` option in Docker.
|
809
760
|
"""
|
810
761
|
...
|
811
762
|
|
812
763
|
@typing.overload
|
813
|
-
def
|
764
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
814
765
|
...
|
815
766
|
|
816
767
|
@typing.overload
|
817
|
-
def
|
768
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
818
769
|
...
|
819
770
|
|
820
|
-
def
|
771
|
+
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):
|
821
772
|
"""
|
822
|
-
Specifies
|
823
|
-
|
824
|
-
This decorator is useful if this step may hang indefinitely.
|
773
|
+
Specifies the resources needed when executing this step.
|
825
774
|
|
826
|
-
|
827
|
-
|
828
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
775
|
+
Use `@resources` to specify the resource requirements
|
776
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
829
777
|
|
830
|
-
|
831
|
-
|
778
|
+
You can choose the compute layer on the command line by executing e.g.
|
779
|
+
```
|
780
|
+
python myflow.py run --with batch
|
781
|
+
```
|
782
|
+
or
|
783
|
+
```
|
784
|
+
python myflow.py run --with kubernetes
|
785
|
+
```
|
786
|
+
which executes the flow on the desired system using the
|
787
|
+
requirements specified in `@resources`.
|
832
788
|
|
833
789
|
Parameters
|
834
790
|
----------
|
835
|
-
|
836
|
-
Number of
|
837
|
-
|
838
|
-
Number of
|
839
|
-
|
840
|
-
|
791
|
+
cpu : int, default 1
|
792
|
+
Number of CPUs required for this step.
|
793
|
+
gpu : int, default 0
|
794
|
+
Number of GPUs required for this step.
|
795
|
+
disk : int, optional, default None
|
796
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
797
|
+
memory : int, default 4096
|
798
|
+
Memory size (in MB) required for this step.
|
799
|
+
shared_memory : int, optional, default None
|
800
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
801
|
+
This parameter maps to the `--shm-size` option in Docker.
|
841
802
|
"""
|
842
803
|
...
|
843
804
|
|
@@ -988,319 +949,389 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
988
949
|
"""
|
989
950
|
...
|
990
951
|
|
952
|
+
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) -> 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]]]:
|
953
|
+
"""
|
954
|
+
Specifies that this step should execute on Kubernetes.
|
955
|
+
|
956
|
+
Parameters
|
957
|
+
----------
|
958
|
+
cpu : int, default 1
|
959
|
+
Number of CPUs required for this step. If `@resources` is
|
960
|
+
also present, the maximum value from all decorators is used.
|
961
|
+
memory : int, default 4096
|
962
|
+
Memory size (in MB) required for this step. If
|
963
|
+
`@resources` is also present, the maximum value from all decorators is
|
964
|
+
used.
|
965
|
+
disk : int, default 10240
|
966
|
+
Disk size (in MB) required for this step. If
|
967
|
+
`@resources` is also present, the maximum value from all decorators is
|
968
|
+
used.
|
969
|
+
image : str, optional, default None
|
970
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
971
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
972
|
+
not, a default Docker image mapping to the current version of Python is used.
|
973
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
974
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
975
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
976
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
977
|
+
secrets : List[str], optional, default None
|
978
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
979
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
980
|
+
in Metaflow configuration.
|
981
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
982
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
983
|
+
gpu : int, optional, default None
|
984
|
+
Number of GPUs required for this step. A value of zero implies that
|
985
|
+
the scheduled node should not have GPUs.
|
986
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
987
|
+
The vendor of the GPUs to be used for this step.
|
988
|
+
tolerations : List[str], default []
|
989
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
990
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
991
|
+
use_tmpfs : bool, default False
|
992
|
+
This enables an explicit tmpfs mount for this step.
|
993
|
+
tmpfs_tempdir : bool, default True
|
994
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
995
|
+
tmpfs_size : int, optional, default: None
|
996
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
997
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
998
|
+
memory allocated for this step.
|
999
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
1000
|
+
Path to tmpfs mount for this step.
|
1001
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
1002
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1003
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1004
|
+
shared_memory: int, optional
|
1005
|
+
Shared memory size (in MiB) required for this step
|
1006
|
+
port: int, optional
|
1007
|
+
Port number to specify in the Kubernetes job object
|
1008
|
+
"""
|
1009
|
+
...
|
1010
|
+
|
991
1011
|
@typing.overload
|
992
|
-
def
|
1012
|
+
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]]]:
|
993
1013
|
"""
|
994
|
-
|
995
|
-
|
1014
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1015
|
+
|
1016
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
996
1017
|
|
997
1018
|
Parameters
|
998
1019
|
----------
|
999
|
-
|
1000
|
-
|
1020
|
+
type : str, default 'default'
|
1021
|
+
Card type.
|
1022
|
+
id : str, optional, default None
|
1023
|
+
If multiple cards are present, use this id to identify this card.
|
1024
|
+
options : Dict[str, Any], default {}
|
1025
|
+
Options passed to the card. The contents depend on the card type.
|
1026
|
+
timeout : int, default 45
|
1027
|
+
Interrupt reporting if it takes more than this many seconds.
|
1028
|
+
|
1029
|
+
|
1001
1030
|
"""
|
1002
1031
|
...
|
1003
1032
|
|
1004
1033
|
@typing.overload
|
1005
|
-
def
|
1034
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1006
1035
|
...
|
1007
1036
|
|
1008
1037
|
@typing.overload
|
1009
|
-
def
|
1038
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1010
1039
|
...
|
1011
1040
|
|
1012
|
-
def
|
1041
|
+
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):
|
1013
1042
|
"""
|
1014
|
-
|
1015
|
-
|
1043
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1044
|
+
|
1045
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1016
1046
|
|
1017
1047
|
Parameters
|
1018
1048
|
----------
|
1019
|
-
|
1020
|
-
|
1049
|
+
type : str, default 'default'
|
1050
|
+
Card type.
|
1051
|
+
id : str, optional, default None
|
1052
|
+
If multiple cards are present, use this id to identify this card.
|
1053
|
+
options : Dict[str, Any], default {}
|
1054
|
+
Options passed to the card. The contents depend on the card type.
|
1055
|
+
timeout : int, default 45
|
1056
|
+
Interrupt reporting if it takes more than this many seconds.
|
1057
|
+
|
1058
|
+
|
1021
1059
|
"""
|
1022
1060
|
...
|
1023
1061
|
|
1024
1062
|
@typing.overload
|
1025
|
-
def
|
1063
|
+
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]]]:
|
1026
1064
|
"""
|
1027
|
-
Specifies the
|
1028
|
-
|
1029
|
-
Use `@resources` to specify the resource requirements
|
1030
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1065
|
+
Specifies the PyPI packages for the step.
|
1031
1066
|
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
or
|
1037
|
-
```
|
1038
|
-
python myflow.py run --with kubernetes
|
1039
|
-
```
|
1040
|
-
which executes the flow on the desired system using the
|
1041
|
-
requirements specified in `@resources`.
|
1067
|
+
Information in this decorator will augment any
|
1068
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1069
|
+
you can use `@pypi_base` to set packages required by all
|
1070
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1042
1071
|
|
1043
1072
|
Parameters
|
1044
1073
|
----------
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
memory : int, default 4096
|
1052
|
-
Memory size (in MB) required for this step.
|
1053
|
-
shared_memory : int, optional, default None
|
1054
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1055
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1074
|
+
packages : Dict[str, str], default: {}
|
1075
|
+
Packages to use for this step. The key is the name of the package
|
1076
|
+
and the value is the version to use.
|
1077
|
+
python : str, optional, default: None
|
1078
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1079
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1056
1080
|
"""
|
1057
1081
|
...
|
1058
1082
|
|
1059
1083
|
@typing.overload
|
1060
|
-
def
|
1084
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1061
1085
|
...
|
1062
1086
|
|
1063
1087
|
@typing.overload
|
1064
|
-
def
|
1088
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1065
1089
|
...
|
1066
1090
|
|
1067
|
-
def
|
1091
|
+
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):
|
1068
1092
|
"""
|
1069
|
-
Specifies the
|
1070
|
-
|
1071
|
-
Use `@resources` to specify the resource requirements
|
1072
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1093
|
+
Specifies the PyPI packages for the step.
|
1073
1094
|
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
or
|
1079
|
-
```
|
1080
|
-
python myflow.py run --with kubernetes
|
1081
|
-
```
|
1082
|
-
which executes the flow on the desired system using the
|
1083
|
-
requirements specified in `@resources`.
|
1095
|
+
Information in this decorator will augment any
|
1096
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1097
|
+
you can use `@pypi_base` to set packages required by all
|
1098
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1084
1099
|
|
1085
1100
|
Parameters
|
1086
1101
|
----------
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
memory : int, default 4096
|
1094
|
-
Memory size (in MB) required for this step.
|
1095
|
-
shared_memory : int, optional, default None
|
1096
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1097
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1102
|
+
packages : Dict[str, str], default: {}
|
1103
|
+
Packages to use for this step. The key is the name of the package
|
1104
|
+
and the value is the version to use.
|
1105
|
+
python : str, optional, default: None
|
1106
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1107
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1098
1108
|
"""
|
1099
1109
|
...
|
1100
1110
|
|
1101
1111
|
@typing.overload
|
1102
|
-
def
|
1112
|
+
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]]]:
|
1103
1113
|
"""
|
1104
|
-
Specifies
|
1114
|
+
Specifies a timeout for your step.
|
1105
1115
|
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1116
|
+
This decorator is useful if this step may hang indefinitely.
|
1117
|
+
|
1118
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1119
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1120
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1121
|
+
|
1122
|
+
Note that all the values specified in parameters are added together so if you specify
|
1123
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1110
1124
|
|
1111
1125
|
Parameters
|
1112
1126
|
----------
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1120
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1121
|
-
disabled : bool, default False
|
1122
|
-
If set to True, disables @conda.
|
1127
|
+
seconds : int, default 0
|
1128
|
+
Number of seconds to wait prior to timing out.
|
1129
|
+
minutes : int, default 0
|
1130
|
+
Number of minutes to wait prior to timing out.
|
1131
|
+
hours : int, default 0
|
1132
|
+
Number of hours to wait prior to timing out.
|
1123
1133
|
"""
|
1124
1134
|
...
|
1125
1135
|
|
1126
1136
|
@typing.overload
|
1127
|
-
def
|
1137
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1128
1138
|
...
|
1129
1139
|
|
1130
1140
|
@typing.overload
|
1131
|
-
def
|
1141
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1132
1142
|
...
|
1133
1143
|
|
1134
|
-
def
|
1144
|
+
def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
1135
1145
|
"""
|
1136
|
-
Specifies
|
1146
|
+
Specifies a timeout for your step.
|
1137
1147
|
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1148
|
+
This decorator is useful if this step may hang indefinitely.
|
1149
|
+
|
1150
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1151
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1152
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1153
|
+
|
1154
|
+
Note that all the values specified in parameters are added together so if you specify
|
1155
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1142
1156
|
|
1143
1157
|
Parameters
|
1144
1158
|
----------
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1152
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1153
|
-
disabled : bool, default False
|
1154
|
-
If set to True, disables @conda.
|
1159
|
+
seconds : int, default 0
|
1160
|
+
Number of seconds to wait prior to timing out.
|
1161
|
+
minutes : int, default 0
|
1162
|
+
Number of minutes to wait prior to timing out.
|
1163
|
+
hours : int, default 0
|
1164
|
+
Number of hours to wait prior to timing out.
|
1155
1165
|
"""
|
1156
1166
|
...
|
1157
1167
|
|
1158
1168
|
@typing.overload
|
1159
|
-
def
|
1169
|
+
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]]]:
|
1160
1170
|
"""
|
1161
|
-
|
1171
|
+
Specifies that the step will success under all circumstances.
|
1162
1172
|
|
1163
|
-
|
1173
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1174
|
+
contains the exception raised. You can use it to detect the presence
|
1175
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1176
|
+
are missing.
|
1164
1177
|
|
1165
1178
|
Parameters
|
1166
1179
|
----------
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
timeout : int, default 45
|
1174
|
-
Interrupt reporting if it takes more than this many seconds.
|
1175
|
-
|
1176
|
-
|
1180
|
+
var : str, optional, default None
|
1181
|
+
Name of the artifact in which to store the caught exception.
|
1182
|
+
If not specified, the exception is not stored.
|
1183
|
+
print_exception : bool, default True
|
1184
|
+
Determines whether or not the exception is printed to
|
1185
|
+
stdout when caught.
|
1177
1186
|
"""
|
1178
1187
|
...
|
1179
1188
|
|
1180
1189
|
@typing.overload
|
1181
|
-
def
|
1190
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1182
1191
|
...
|
1183
1192
|
|
1184
1193
|
@typing.overload
|
1185
|
-
def
|
1194
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1186
1195
|
...
|
1187
1196
|
|
1188
|
-
def
|
1197
|
+
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):
|
1189
1198
|
"""
|
1190
|
-
|
1199
|
+
Specifies that the step will success under all circumstances.
|
1191
1200
|
|
1192
|
-
|
1201
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1202
|
+
contains the exception raised. You can use it to detect the presence
|
1203
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1204
|
+
are missing.
|
1193
1205
|
|
1194
1206
|
Parameters
|
1195
1207
|
----------
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1208
|
+
var : str, optional, default None
|
1209
|
+
Name of the artifact in which to store the caught exception.
|
1210
|
+
If not specified, the exception is not stored.
|
1211
|
+
print_exception : bool, default True
|
1212
|
+
Determines whether or not the exception is printed to
|
1213
|
+
stdout when caught.
|
1214
|
+
"""
|
1215
|
+
...
|
1216
|
+
|
1217
|
+
@typing.overload
|
1218
|
+
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]]]:
|
1219
|
+
"""
|
1220
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1221
|
+
the execution of a step.
|
1204
1222
|
|
1223
|
+
Parameters
|
1224
|
+
----------
|
1225
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1226
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1227
|
+
"""
|
1228
|
+
...
|
1229
|
+
|
1230
|
+
@typing.overload
|
1231
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1232
|
+
...
|
1233
|
+
|
1234
|
+
@typing.overload
|
1235
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1236
|
+
...
|
1237
|
+
|
1238
|
+
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]]] = []):
|
1239
|
+
"""
|
1240
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1241
|
+
the execution of a step.
|
1205
1242
|
|
1243
|
+
Parameters
|
1244
|
+
----------
|
1245
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1246
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1206
1247
|
"""
|
1207
1248
|
...
|
1208
1249
|
|
1209
1250
|
@typing.overload
|
1210
|
-
def
|
1251
|
+
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]]]:
|
1211
1252
|
"""
|
1212
|
-
Specifies the
|
1253
|
+
Specifies the Conda environment for the step.
|
1213
1254
|
|
1214
1255
|
Information in this decorator will augment any
|
1215
|
-
attributes set in the `@
|
1216
|
-
you can use `@
|
1217
|
-
steps and use `@
|
1256
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1257
|
+
you can use `@conda_base` to set packages required by all
|
1258
|
+
steps and use `@conda` to specify step-specific overrides.
|
1218
1259
|
|
1219
1260
|
Parameters
|
1220
1261
|
----------
|
1221
|
-
packages : Dict[str, str], default
|
1262
|
+
packages : Dict[str, str], default {}
|
1222
1263
|
Packages to use for this step. The key is the name of the package
|
1223
1264
|
and the value is the version to use.
|
1224
|
-
|
1265
|
+
libraries : Dict[str, str], default {}
|
1266
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1267
|
+
python : str, optional, default None
|
1225
1268
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1226
1269
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1270
|
+
disabled : bool, default False
|
1271
|
+
If set to True, disables @conda.
|
1227
1272
|
"""
|
1228
1273
|
...
|
1229
1274
|
|
1230
1275
|
@typing.overload
|
1231
|
-
def
|
1276
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1232
1277
|
...
|
1233
1278
|
|
1234
1279
|
@typing.overload
|
1235
|
-
def
|
1280
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1236
1281
|
...
|
1237
1282
|
|
1238
|
-
def
|
1283
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1239
1284
|
"""
|
1240
|
-
Specifies the
|
1285
|
+
Specifies the Conda environment for the step.
|
1241
1286
|
|
1242
1287
|
Information in this decorator will augment any
|
1243
|
-
attributes set in the `@
|
1244
|
-
you can use `@
|
1245
|
-
steps and use `@
|
1288
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1289
|
+
you can use `@conda_base` to set packages required by all
|
1290
|
+
steps and use `@conda` to specify step-specific overrides.
|
1246
1291
|
|
1247
1292
|
Parameters
|
1248
1293
|
----------
|
1249
|
-
packages : Dict[str, str], default
|
1294
|
+
packages : Dict[str, str], default {}
|
1250
1295
|
Packages to use for this step. The key is the name of the package
|
1251
1296
|
and the value is the version to use.
|
1252
|
-
|
1297
|
+
libraries : Dict[str, str], default {}
|
1298
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1299
|
+
python : str, optional, default None
|
1253
1300
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1254
1301
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1302
|
+
disabled : bool, default False
|
1303
|
+
If set to True, disables @conda.
|
1255
1304
|
"""
|
1256
1305
|
...
|
1257
1306
|
|
1258
1307
|
@typing.overload
|
1259
|
-
def
|
1308
|
+
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]]]:
|
1260
1309
|
"""
|
1261
|
-
Specifies
|
1262
|
-
|
1263
|
-
The decorator will create an optional artifact, specified by `var`, which
|
1264
|
-
contains the exception raised. You can use it to detect the presence
|
1265
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1266
|
-
are missing.
|
1310
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1267
1311
|
|
1268
1312
|
Parameters
|
1269
1313
|
----------
|
1270
|
-
|
1271
|
-
|
1272
|
-
If not specified, the exception is not stored.
|
1273
|
-
print_exception : bool, default True
|
1274
|
-
Determines whether or not the exception is printed to
|
1275
|
-
stdout when caught.
|
1314
|
+
vars : Dict[str, str], default {}
|
1315
|
+
Dictionary of environment variables to set.
|
1276
1316
|
"""
|
1277
1317
|
...
|
1278
1318
|
|
1279
1319
|
@typing.overload
|
1280
|
-
def
|
1320
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1281
1321
|
...
|
1282
1322
|
|
1283
1323
|
@typing.overload
|
1284
|
-
def
|
1324
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1285
1325
|
...
|
1286
1326
|
|
1287
|
-
def
|
1327
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1288
1328
|
"""
|
1289
|
-
Specifies
|
1290
|
-
|
1291
|
-
The decorator will create an optional artifact, specified by `var`, which
|
1292
|
-
contains the exception raised. You can use it to detect the presence
|
1293
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1294
|
-
are missing.
|
1329
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1295
1330
|
|
1296
1331
|
Parameters
|
1297
1332
|
----------
|
1298
|
-
|
1299
|
-
|
1300
|
-
If not specified, the exception is not stored.
|
1301
|
-
print_exception : bool, default True
|
1302
|
-
Determines whether or not the exception is printed to
|
1303
|
-
stdout when caught.
|
1333
|
+
vars : Dict[str, str], default {}
|
1334
|
+
Dictionary of environment variables to set.
|
1304
1335
|
"""
|
1305
1336
|
...
|
1306
1337
|
|
@@ -1358,77 +1389,105 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1358
1389
|
...
|
1359
1390
|
|
1360
1391
|
@typing.overload
|
1361
|
-
def
|
1392
|
+
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]]:
|
1362
1393
|
"""
|
1363
|
-
Specifies
|
1394
|
+
Specifies the Conda environment for all steps of the flow.
|
1395
|
+
|
1396
|
+
Use `@conda_base` to set common libraries required by all
|
1397
|
+
steps and use `@conda` to specify step-specific additions.
|
1364
1398
|
|
1365
1399
|
Parameters
|
1366
1400
|
----------
|
1367
|
-
|
1368
|
-
|
1401
|
+
packages : Dict[str, str], default {}
|
1402
|
+
Packages to use for this flow. The key is the name of the package
|
1403
|
+
and the value is the version to use.
|
1404
|
+
libraries : Dict[str, str], default {}
|
1405
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1406
|
+
python : str, optional, default None
|
1407
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1408
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1409
|
+
disabled : bool, default False
|
1410
|
+
If set to True, disables Conda.
|
1369
1411
|
"""
|
1370
1412
|
...
|
1371
1413
|
|
1372
1414
|
@typing.overload
|
1373
|
-
def
|
1374
|
-
...
|
1375
|
-
|
1376
|
-
@typing.overload
|
1377
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1415
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1378
1416
|
...
|
1379
1417
|
|
1380
|
-
def
|
1418
|
+
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):
|
1381
1419
|
"""
|
1382
|
-
Specifies
|
1420
|
+
Specifies the Conda environment for all steps of the flow.
|
1383
1421
|
|
1384
|
-
|
1385
|
-
|
1386
|
-
vars : Dict[str, str], default {}
|
1387
|
-
Dictionary of environment variables to set.
|
1388
|
-
"""
|
1389
|
-
...
|
1390
|
-
|
1391
|
-
@typing.overload
|
1392
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1393
|
-
"""
|
1394
|
-
Specifies the PyPI packages for all steps of the flow.
|
1422
|
+
Use `@conda_base` to set common libraries required by all
|
1423
|
+
steps and use `@conda` to specify step-specific additions.
|
1395
1424
|
|
1396
|
-
Use `@pypi_base` to set common packages required by all
|
1397
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1398
1425
|
Parameters
|
1399
1426
|
----------
|
1400
|
-
packages : Dict[str, str], default
|
1427
|
+
packages : Dict[str, str], default {}
|
1401
1428
|
Packages to use for this flow. The key is the name of the package
|
1402
1429
|
and the value is the version to use.
|
1403
|
-
|
1430
|
+
libraries : Dict[str, str], default {}
|
1431
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1432
|
+
python : str, optional, default None
|
1404
1433
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1405
1434
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1435
|
+
disabled : bool, default False
|
1436
|
+
If set to True, disables Conda.
|
1406
1437
|
"""
|
1407
1438
|
...
|
1408
1439
|
|
1409
1440
|
@typing.overload
|
1410
|
-
def
|
1411
|
-
...
|
1412
|
-
|
1413
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1441
|
+
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]]:
|
1414
1442
|
"""
|
1415
|
-
Specifies the
|
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
|
+
```
|
1416
1472
|
|
1417
|
-
Use `@pypi_base` to set common packages required by all
|
1418
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1419
1473
|
Parameters
|
1420
1474
|
----------
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
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
|
+
|
1427
1483
|
"""
|
1428
1484
|
...
|
1429
1485
|
|
1430
1486
|
@typing.overload
|
1431
|
-
def trigger(
|
1487
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1488
|
+
...
|
1489
|
+
|
1490
|
+
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] = {}):
|
1432
1491
|
"""
|
1433
1492
|
Specifies the event(s) that this flow depends on.
|
1434
1493
|
|
@@ -1473,52 +1532,126 @@ def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = No
|
|
1473
1532
|
"""
|
1474
1533
|
...
|
1475
1534
|
|
1476
|
-
@typing.overload
|
1477
|
-
def
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1535
|
+
@typing.overload
|
1536
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1537
|
+
"""
|
1538
|
+
Specifies the PyPI packages for all steps of the flow.
|
1539
|
+
|
1540
|
+
Use `@pypi_base` to set common packages required by all
|
1541
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1542
|
+
Parameters
|
1543
|
+
----------
|
1544
|
+
packages : Dict[str, str], default: {}
|
1545
|
+
Packages to use for this flow. The key is the name of the package
|
1546
|
+
and the value is the version to use.
|
1547
|
+
python : str, optional, default: None
|
1548
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1549
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1550
|
+
"""
|
1551
|
+
...
|
1552
|
+
|
1553
|
+
@typing.overload
|
1554
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1555
|
+
...
|
1556
|
+
|
1557
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1558
|
+
"""
|
1559
|
+
Specifies the PyPI packages for all steps of the flow.
|
1560
|
+
|
1561
|
+
Use `@pypi_base` to set common packages required by all
|
1562
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1563
|
+
Parameters
|
1564
|
+
----------
|
1565
|
+
packages : Dict[str, str], default: {}
|
1566
|
+
Packages to use for this flow. The key is the name of the package
|
1567
|
+
and the value is the version to use.
|
1568
|
+
python : str, optional, default: None
|
1569
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1570
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1571
|
+
"""
|
1572
|
+
...
|
1573
|
+
|
1574
|
+
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]]:
|
1575
|
+
"""
|
1576
|
+
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)
|
1577
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1578
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1579
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1580
|
+
starts only after all sensors finish.
|
1581
|
+
|
1582
|
+
Parameters
|
1583
|
+
----------
|
1584
|
+
timeout : int
|
1585
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1586
|
+
poke_interval : int
|
1587
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1588
|
+
mode : str
|
1589
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1590
|
+
exponential_backoff : bool
|
1591
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1592
|
+
pool : str
|
1593
|
+
the slot pool this task should run in,
|
1594
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1595
|
+
soft_fail : bool
|
1596
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1597
|
+
name : str
|
1598
|
+
Name of the sensor on Airflow
|
1599
|
+
description : str
|
1600
|
+
Description of sensor in the Airflow UI
|
1601
|
+
bucket_key : Union[str, List[str]]
|
1602
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1603
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1604
|
+
bucket_name : str
|
1605
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1606
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1607
|
+
wildcard_match : bool
|
1608
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1609
|
+
aws_conn_id : str
|
1610
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1611
|
+
verify : bool
|
1612
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1613
|
+
"""
|
1614
|
+
...
|
1615
|
+
|
1616
|
+
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]]:
|
1481
1617
|
"""
|
1482
|
-
|
1483
|
-
|
1484
|
-
```
|
1485
|
-
@trigger(event='foo')
|
1486
|
-
```
|
1487
|
-
or
|
1488
|
-
```
|
1489
|
-
@trigger(events=['foo', 'bar'])
|
1490
|
-
```
|
1491
|
-
|
1492
|
-
Additionally, you can specify the parameter mappings
|
1493
|
-
to map event payload to Metaflow parameters for the flow.
|
1494
|
-
```
|
1495
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1496
|
-
```
|
1497
|
-
or
|
1498
|
-
```
|
1499
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1500
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1501
|
-
```
|
1502
|
-
|
1503
|
-
'parameters' can also be a list of strings and tuples like so:
|
1504
|
-
```
|
1505
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1506
|
-
```
|
1507
|
-
This is equivalent to:
|
1508
|
-
```
|
1509
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1510
|
-
```
|
1618
|
+
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.
|
1619
|
+
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.
|
1511
1620
|
|
1512
1621
|
Parameters
|
1513
1622
|
----------
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1623
|
+
timeout : int
|
1624
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1625
|
+
poke_interval : int
|
1626
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1627
|
+
mode : str
|
1628
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1629
|
+
exponential_backoff : bool
|
1630
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1631
|
+
pool : str
|
1632
|
+
the slot pool this task should run in,
|
1633
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1634
|
+
soft_fail : bool
|
1635
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1636
|
+
name : str
|
1637
|
+
Name of the sensor on Airflow
|
1638
|
+
description : str
|
1639
|
+
Description of sensor in the Airflow UI
|
1640
|
+
external_dag_id : str
|
1641
|
+
The dag_id that contains the task you want to wait for.
|
1642
|
+
external_task_ids : List[str]
|
1643
|
+
The list of task_ids that you want to wait for.
|
1644
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1645
|
+
allowed_states : List[str]
|
1646
|
+
Iterable of allowed states, (Default: ['success'])
|
1647
|
+
failed_states : List[str]
|
1648
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1649
|
+
execution_delta : datetime.timedelta
|
1650
|
+
time difference with the previous execution to look at,
|
1651
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1652
|
+
check_existence: bool
|
1653
|
+
Set to True to check if the external task exists or check if
|
1654
|
+
the DAG to wait for exists. (Default: True)
|
1522
1655
|
"""
|
1523
1656
|
...
|
1524
1657
|
|
@@ -1571,45 +1704,21 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1571
1704
|
"""
|
1572
1705
|
...
|
1573
1706
|
|
1574
|
-
def
|
1707
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1575
1708
|
"""
|
1576
|
-
|
1577
|
-
|
1709
|
+
Specifies what flows belong to the same project.
|
1710
|
+
|
1711
|
+
A project-specific namespace is created for all flows that
|
1712
|
+
use the same `@project(name)`.
|
1578
1713
|
|
1579
1714
|
Parameters
|
1580
1715
|
----------
|
1581
|
-
timeout : int
|
1582
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1583
|
-
poke_interval : int
|
1584
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1585
|
-
mode : str
|
1586
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1587
|
-
exponential_backoff : bool
|
1588
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1589
|
-
pool : str
|
1590
|
-
the slot pool this task should run in,
|
1591
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1592
|
-
soft_fail : bool
|
1593
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1594
1716
|
name : str
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
external_task_ids : List[str]
|
1601
|
-
The list of task_ids that you want to wait for.
|
1602
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1603
|
-
allowed_states : List[str]
|
1604
|
-
Iterable of allowed states, (Default: ['success'])
|
1605
|
-
failed_states : List[str]
|
1606
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1607
|
-
execution_delta : datetime.timedelta
|
1608
|
-
time difference with the previous execution to look at,
|
1609
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1610
|
-
check_existence: bool
|
1611
|
-
Set to True to check if the external task exists or check if
|
1612
|
-
the DAG to wait for exists. (Default: True)
|
1717
|
+
Project name. Make sure that the name is unique amongst all
|
1718
|
+
projects that use the same production scheduler. The name may
|
1719
|
+
contain only lowercase alphanumeric characters and underscores.
|
1720
|
+
|
1721
|
+
|
1613
1722
|
"""
|
1614
1723
|
...
|
1615
1724
|
|
@@ -1716,115 +1825,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1716
1825
|
"""
|
1717
1826
|
...
|
1718
1827
|
|
1719
|
-
@typing.overload
|
1720
|
-
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]]:
|
1721
|
-
"""
|
1722
|
-
Specifies the Conda environment for all steps of the flow.
|
1723
|
-
|
1724
|
-
Use `@conda_base` to set common libraries required by all
|
1725
|
-
steps and use `@conda` to specify step-specific additions.
|
1726
|
-
|
1727
|
-
Parameters
|
1728
|
-
----------
|
1729
|
-
packages : Dict[str, str], default {}
|
1730
|
-
Packages to use for this flow. The key is the name of the package
|
1731
|
-
and the value is the version to use.
|
1732
|
-
libraries : Dict[str, str], default {}
|
1733
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1734
|
-
python : str, optional, default None
|
1735
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1736
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1737
|
-
disabled : bool, default False
|
1738
|
-
If set to True, disables Conda.
|
1739
|
-
"""
|
1740
|
-
...
|
1741
|
-
|
1742
|
-
@typing.overload
|
1743
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1744
|
-
...
|
1745
|
-
|
1746
|
-
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):
|
1747
|
-
"""
|
1748
|
-
Specifies the Conda environment for all steps of the flow.
|
1749
|
-
|
1750
|
-
Use `@conda_base` to set common libraries required by all
|
1751
|
-
steps and use `@conda` to specify step-specific additions.
|
1752
|
-
|
1753
|
-
Parameters
|
1754
|
-
----------
|
1755
|
-
packages : Dict[str, str], default {}
|
1756
|
-
Packages to use for this flow. The key is the name of the package
|
1757
|
-
and the value is the version to use.
|
1758
|
-
libraries : Dict[str, str], default {}
|
1759
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1760
|
-
python : str, optional, default None
|
1761
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1762
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1763
|
-
disabled : bool, default False
|
1764
|
-
If set to True, disables Conda.
|
1765
|
-
"""
|
1766
|
-
...
|
1767
|
-
|
1768
|
-
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]]:
|
1769
|
-
"""
|
1770
|
-
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)
|
1771
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1772
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1773
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1774
|
-
starts only after all sensors finish.
|
1775
|
-
|
1776
|
-
Parameters
|
1777
|
-
----------
|
1778
|
-
timeout : int
|
1779
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1780
|
-
poke_interval : int
|
1781
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1782
|
-
mode : str
|
1783
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1784
|
-
exponential_backoff : bool
|
1785
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1786
|
-
pool : str
|
1787
|
-
the slot pool this task should run in,
|
1788
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1789
|
-
soft_fail : bool
|
1790
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1791
|
-
name : str
|
1792
|
-
Name of the sensor on Airflow
|
1793
|
-
description : str
|
1794
|
-
Description of sensor in the Airflow UI
|
1795
|
-
bucket_key : Union[str, List[str]]
|
1796
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1797
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1798
|
-
bucket_name : str
|
1799
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1800
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1801
|
-
wildcard_match : bool
|
1802
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1803
|
-
aws_conn_id : str
|
1804
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1805
|
-
verify : bool
|
1806
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1807
|
-
"""
|
1808
|
-
...
|
1809
|
-
|
1810
|
-
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1811
|
-
"""
|
1812
|
-
Specifies what flows belong to the same project.
|
1813
|
-
|
1814
|
-
A project-specific namespace is created for all flows that
|
1815
|
-
use the same `@project(name)`.
|
1816
|
-
|
1817
|
-
Parameters
|
1818
|
-
----------
|
1819
|
-
name : str
|
1820
|
-
Project name. Make sure that the name is unique amongst all
|
1821
|
-
projects that use the same production scheduler. The name may
|
1822
|
-
contain only lowercase alphanumeric characters and underscores.
|
1823
|
-
|
1824
|
-
|
1825
|
-
"""
|
1826
|
-
...
|
1827
|
-
|
1828
1828
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1829
1829
|
"""
|
1830
1830
|
Switch namespace to the one provided.
|