metaflow-stubs 2.12.7__py2.py3-none-any.whl → 2.12.9__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 +446 -397
- metaflow-stubs/cards.pyi +5 -5
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +3 -3
- metaflow-stubs/client/core.pyi +7 -7
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/clone_util.pyi +2 -2
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +6 -6
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- 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 +44 -21
- metaflow-stubs/mflog/mflog.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +4 -4
- metaflow-stubs/plugins/__init__.pyi +6 -2
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow.pyi +5 -5
- 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 +38 -5
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +270 -5
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +230 -5
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +292 -0
- 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 +2 -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 +24 -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/aws/step_functions/step_functions_deployer.pyi +260 -0
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
- 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 +4 -4
- 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 +3 -3
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +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 +7 -7
- 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 +5 -3
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
- 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 +18 -10
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +13 -13
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +26 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +14 -31
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +26 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +82 -28
- metaflow-stubs/plugins/logs_cli.pyi +3 -3
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +47 -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 +3 -3
- 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 +3 -3
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/tag_cli.pyi +4 -4
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +26 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/procpoll.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +354 -0
- metaflow-stubs/runner/metaflow_runner.pyi +9 -9
- metaflow-stubs/runner/nbdeploy.pyi +54 -0
- metaflow-stubs/runner/nbrun.pyi +7 -7
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +25 -0
- metaflow-stubs/system/__init__.pyi +3 -3
- metaflow-stubs/system/system_logger.pyi +3 -3
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.12.7.dist-info → metaflow_stubs-2.12.9.dist-info}/METADATA +2 -2
- metaflow_stubs-2.12.9.dist-info/RECORD +150 -0
- {metaflow_stubs-2.12.7.dist-info → metaflow_stubs-2.12.9.dist-info}/WHEEL +1 -1
- metaflow_stubs-2.12.7.dist-info/RECORD +0 -145
- {metaflow_stubs-2.12.7.dist-info → metaflow_stubs-2.12.9.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-07-
|
3
|
+
# MF version: 2.12.9 #
|
4
|
+
# Generated on 2024-07-25T18:20:16.223359 #
|
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.runner.metaflow_runner
|
12
|
+
import io
|
13
|
+
import metaflow.flowspec
|
14
|
+
import typing
|
15
|
+
import datetime
|
11
16
|
import metaflow.client.core
|
12
|
-
import metaflow.datastore.inputs
|
13
17
|
import metaflow.parameters
|
14
18
|
import metaflow.metaflow_current
|
19
|
+
import metaflow.datastore.inputs
|
15
20
|
import metaflow._vendor.click.types
|
16
|
-
import typing
|
17
|
-
import metaflow.runner.metaflow_runner
|
18
|
-
import io
|
19
|
-
import metaflow.plugins.datatools.s3.s3
|
20
|
-
import datetime
|
21
21
|
import metaflow.events
|
22
|
-
import metaflow.
|
22
|
+
import metaflow.plugins.datatools.s3.s3
|
23
23
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
24
24
|
StepFlag = typing.NewType("StepFlag", bool)
|
25
25
|
|
@@ -727,60 +727,62 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
727
727
|
"""
|
728
728
|
...
|
729
729
|
|
730
|
-
|
731
|
-
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]]]:
|
732
|
-
"""
|
733
|
-
Specifies the Conda environment for the step.
|
734
|
-
|
735
|
-
Information in this decorator will augment any
|
736
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
737
|
-
you can use `@conda_base` to set packages required by all
|
738
|
-
steps and use `@conda` to specify step-specific overrides.
|
739
|
-
|
740
|
-
Parameters
|
741
|
-
----------
|
742
|
-
packages : Dict[str, str], default {}
|
743
|
-
Packages to use for this step. The key is the name of the package
|
744
|
-
and the value is the version to use.
|
745
|
-
libraries : Dict[str, str], default {}
|
746
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
747
|
-
python : str, optional, default None
|
748
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
749
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
750
|
-
disabled : bool, default False
|
751
|
-
If set to True, disables @conda.
|
752
|
-
"""
|
753
|
-
...
|
754
|
-
|
755
|
-
@typing.overload
|
756
|
-
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
757
|
-
...
|
758
|
-
|
759
|
-
@typing.overload
|
760
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
761
|
-
...
|
762
|
-
|
763
|
-
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):
|
730
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None) -> 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]]]:
|
764
731
|
"""
|
765
|
-
Specifies
|
766
|
-
|
767
|
-
Information in this decorator will augment any
|
768
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
769
|
-
you can use `@conda_base` to set packages required by all
|
770
|
-
steps and use `@conda` to specify step-specific overrides.
|
732
|
+
Specifies that this step should execute on Kubernetes.
|
771
733
|
|
772
734
|
Parameters
|
773
735
|
----------
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
736
|
+
cpu : int, default 1
|
737
|
+
Number of CPUs required for this step. If `@resources` is
|
738
|
+
also present, the maximum value from all decorators is used.
|
739
|
+
memory : int, default 4096
|
740
|
+
Memory size (in MB) required for this step. If
|
741
|
+
`@resources` is also present, the maximum value from all decorators is
|
742
|
+
used.
|
743
|
+
disk : int, default 10240
|
744
|
+
Disk size (in MB) required for this step. If
|
745
|
+
`@resources` is also present, the maximum value from all decorators is
|
746
|
+
used.
|
747
|
+
image : str, optional, default None
|
748
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
749
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
750
|
+
not, a default Docker image mapping to the current version of Python is used.
|
751
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
752
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
753
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
754
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
755
|
+
secrets : List[str], optional, default None
|
756
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
757
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
758
|
+
in Metaflow configuration.
|
759
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
760
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
761
|
+
gpu : int, optional, default None
|
762
|
+
Number of GPUs required for this step. A value of zero implies that
|
763
|
+
the scheduled node should not have GPUs.
|
764
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
765
|
+
The vendor of the GPUs to be used for this step.
|
766
|
+
tolerations : List[str], default []
|
767
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
768
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
769
|
+
use_tmpfs : bool, default False
|
770
|
+
This enables an explicit tmpfs mount for this step.
|
771
|
+
tmpfs_tempdir : bool, default True
|
772
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
773
|
+
tmpfs_size : int, optional, default: None
|
774
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
775
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
776
|
+
memory allocated for this step.
|
777
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
778
|
+
Path to tmpfs mount for this step.
|
779
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
780
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
781
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
782
|
+
shared_memory: int, optional
|
783
|
+
Shared memory size (in MiB) required for this step
|
784
|
+
port: int, optional
|
785
|
+
Port number to specify in the Kubernetes job object
|
784
786
|
"""
|
785
787
|
...
|
786
788
|
|
@@ -1080,6 +1082,39 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1080
1082
|
"""
|
1081
1083
|
...
|
1082
1084
|
|
1085
|
+
@typing.overload
|
1086
|
+
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]]]:
|
1087
|
+
"""
|
1088
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1089
|
+
the execution of a step.
|
1090
|
+
|
1091
|
+
Parameters
|
1092
|
+
----------
|
1093
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1094
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1095
|
+
"""
|
1096
|
+
...
|
1097
|
+
|
1098
|
+
@typing.overload
|
1099
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1100
|
+
...
|
1101
|
+
|
1102
|
+
@typing.overload
|
1103
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1104
|
+
...
|
1105
|
+
|
1106
|
+
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]]] = []):
|
1107
|
+
"""
|
1108
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1109
|
+
the execution of a step.
|
1110
|
+
|
1111
|
+
Parameters
|
1112
|
+
----------
|
1113
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1114
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1115
|
+
"""
|
1116
|
+
...
|
1117
|
+
|
1083
1118
|
@typing.overload
|
1084
1119
|
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]]]:
|
1085
1120
|
"""
|
@@ -1133,6 +1168,113 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1133
1168
|
"""
|
1134
1169
|
...
|
1135
1170
|
|
1171
|
+
@typing.overload
|
1172
|
+
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]]]:
|
1173
|
+
"""
|
1174
|
+
Specifies the Conda environment for the step.
|
1175
|
+
|
1176
|
+
Information in this decorator will augment any
|
1177
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1178
|
+
you can use `@conda_base` to set packages required by all
|
1179
|
+
steps and use `@conda` to specify step-specific overrides.
|
1180
|
+
|
1181
|
+
Parameters
|
1182
|
+
----------
|
1183
|
+
packages : Dict[str, str], default {}
|
1184
|
+
Packages to use for this step. The key is the name of the package
|
1185
|
+
and the value is the version to use.
|
1186
|
+
libraries : Dict[str, str], default {}
|
1187
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1188
|
+
python : str, optional, default None
|
1189
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1190
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1191
|
+
disabled : bool, default False
|
1192
|
+
If set to True, disables @conda.
|
1193
|
+
"""
|
1194
|
+
...
|
1195
|
+
|
1196
|
+
@typing.overload
|
1197
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1198
|
+
...
|
1199
|
+
|
1200
|
+
@typing.overload
|
1201
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1202
|
+
...
|
1203
|
+
|
1204
|
+
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):
|
1205
|
+
"""
|
1206
|
+
Specifies the Conda environment for the step.
|
1207
|
+
|
1208
|
+
Information in this decorator will augment any
|
1209
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1210
|
+
you can use `@conda_base` to set packages required by all
|
1211
|
+
steps and use `@conda` to specify step-specific overrides.
|
1212
|
+
|
1213
|
+
Parameters
|
1214
|
+
----------
|
1215
|
+
packages : Dict[str, str], default {}
|
1216
|
+
Packages to use for this step. The key is the name of the package
|
1217
|
+
and the value is the version to use.
|
1218
|
+
libraries : Dict[str, str], default {}
|
1219
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1220
|
+
python : str, optional, default None
|
1221
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1222
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1223
|
+
disabled : bool, default False
|
1224
|
+
If set to True, disables @conda.
|
1225
|
+
"""
|
1226
|
+
...
|
1227
|
+
|
1228
|
+
@typing.overload
|
1229
|
+
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]]]:
|
1230
|
+
"""
|
1231
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1232
|
+
|
1233
|
+
Parameters
|
1234
|
+
----------
|
1235
|
+
vars : Dict[str, str], default {}
|
1236
|
+
Dictionary of environment variables to set.
|
1237
|
+
"""
|
1238
|
+
...
|
1239
|
+
|
1240
|
+
@typing.overload
|
1241
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1242
|
+
...
|
1243
|
+
|
1244
|
+
@typing.overload
|
1245
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1246
|
+
...
|
1247
|
+
|
1248
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1249
|
+
"""
|
1250
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1251
|
+
|
1252
|
+
Parameters
|
1253
|
+
----------
|
1254
|
+
vars : Dict[str, str], default {}
|
1255
|
+
Dictionary of environment variables to set.
|
1256
|
+
"""
|
1257
|
+
...
|
1258
|
+
|
1259
|
+
@typing.overload
|
1260
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1261
|
+
"""
|
1262
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1263
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1264
|
+
"""
|
1265
|
+
...
|
1266
|
+
|
1267
|
+
@typing.overload
|
1268
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1269
|
+
...
|
1270
|
+
|
1271
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1272
|
+
"""
|
1273
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1274
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1275
|
+
"""
|
1276
|
+
...
|
1277
|
+
|
1136
1278
|
@typing.overload
|
1137
1279
|
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]]]:
|
1138
1280
|
"""
|
@@ -1191,101 +1333,9 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
1191
1333
|
...
|
1192
1334
|
|
1193
1335
|
@typing.overload
|
1194
|
-
def
|
1336
|
+
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]]]:
|
1195
1337
|
"""
|
1196
|
-
Specifies
|
1197
|
-
the execution of a step.
|
1198
|
-
|
1199
|
-
Parameters
|
1200
|
-
----------
|
1201
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
1202
|
-
List of secret specs, defining how the secrets are to be retrieved
|
1203
|
-
"""
|
1204
|
-
...
|
1205
|
-
|
1206
|
-
@typing.overload
|
1207
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1208
|
-
...
|
1209
|
-
|
1210
|
-
@typing.overload
|
1211
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1212
|
-
...
|
1213
|
-
|
1214
|
-
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]]] = []):
|
1215
|
-
"""
|
1216
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
1217
|
-
the execution of a step.
|
1218
|
-
|
1219
|
-
Parameters
|
1220
|
-
----------
|
1221
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
1222
|
-
List of secret specs, defining how the secrets are to be retrieved
|
1223
|
-
"""
|
1224
|
-
...
|
1225
|
-
|
1226
|
-
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]]]:
|
1227
|
-
"""
|
1228
|
-
Specifies that this step should execute on Kubernetes.
|
1229
|
-
|
1230
|
-
Parameters
|
1231
|
-
----------
|
1232
|
-
cpu : int, default 1
|
1233
|
-
Number of CPUs required for this step. If `@resources` is
|
1234
|
-
also present, the maximum value from all decorators is used.
|
1235
|
-
memory : int, default 4096
|
1236
|
-
Memory size (in MB) required for this step. If
|
1237
|
-
`@resources` is also present, the maximum value from all decorators is
|
1238
|
-
used.
|
1239
|
-
disk : int, default 10240
|
1240
|
-
Disk size (in MB) required for this step. If
|
1241
|
-
`@resources` is also present, the maximum value from all decorators is
|
1242
|
-
used.
|
1243
|
-
image : str, optional, default None
|
1244
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
1245
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1246
|
-
not, a default Docker image mapping to the current version of Python is used.
|
1247
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1248
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1249
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1250
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
1251
|
-
secrets : List[str], optional, default None
|
1252
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1253
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1254
|
-
in Metaflow configuration.
|
1255
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1256
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
1257
|
-
gpu : int, optional, default None
|
1258
|
-
Number of GPUs required for this step. A value of zero implies that
|
1259
|
-
the scheduled node should not have GPUs.
|
1260
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1261
|
-
The vendor of the GPUs to be used for this step.
|
1262
|
-
tolerations : List[str], default []
|
1263
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1264
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1265
|
-
use_tmpfs : bool, default False
|
1266
|
-
This enables an explicit tmpfs mount for this step.
|
1267
|
-
tmpfs_tempdir : bool, default True
|
1268
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1269
|
-
tmpfs_size : int, optional, default: None
|
1270
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1271
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1272
|
-
memory allocated for this step.
|
1273
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
1274
|
-
Path to tmpfs mount for this step.
|
1275
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
1276
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1277
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1278
|
-
shared_memory: int, optional
|
1279
|
-
Shared memory size (in MiB) required for this step
|
1280
|
-
port: int, optional
|
1281
|
-
Port number to specify in the Kubernetes job object
|
1282
|
-
"""
|
1283
|
-
...
|
1284
|
-
|
1285
|
-
@typing.overload
|
1286
|
-
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]]]:
|
1287
|
-
"""
|
1288
|
-
Specifies the resources needed when executing this step.
|
1338
|
+
Specifies the resources needed when executing this step.
|
1289
1339
|
|
1290
1340
|
Use `@resources` to specify the resource requirements
|
1291
1341
|
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
@@ -1359,97 +1409,6 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
1359
1409
|
"""
|
1360
1410
|
...
|
1361
1411
|
|
1362
|
-
@typing.overload
|
1363
|
-
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]]]:
|
1364
|
-
"""
|
1365
|
-
Specifies environment variables to be set prior to the execution of a step.
|
1366
|
-
|
1367
|
-
Parameters
|
1368
|
-
----------
|
1369
|
-
vars : Dict[str, str], default {}
|
1370
|
-
Dictionary of environment variables to set.
|
1371
|
-
"""
|
1372
|
-
...
|
1373
|
-
|
1374
|
-
@typing.overload
|
1375
|
-
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1376
|
-
...
|
1377
|
-
|
1378
|
-
@typing.overload
|
1379
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1380
|
-
...
|
1381
|
-
|
1382
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1383
|
-
"""
|
1384
|
-
Specifies environment variables to be set prior to the execution of a step.
|
1385
|
-
|
1386
|
-
Parameters
|
1387
|
-
----------
|
1388
|
-
vars : Dict[str, str], default {}
|
1389
|
-
Dictionary of environment variables to set.
|
1390
|
-
"""
|
1391
|
-
...
|
1392
|
-
|
1393
|
-
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]]:
|
1394
|
-
"""
|
1395
|
-
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.
|
1396
|
-
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.
|
1397
|
-
|
1398
|
-
Parameters
|
1399
|
-
----------
|
1400
|
-
timeout : int
|
1401
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1402
|
-
poke_interval : int
|
1403
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1404
|
-
mode : str
|
1405
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1406
|
-
exponential_backoff : bool
|
1407
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1408
|
-
pool : str
|
1409
|
-
the slot pool this task should run in,
|
1410
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1411
|
-
soft_fail : bool
|
1412
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1413
|
-
name : str
|
1414
|
-
Name of the sensor on Airflow
|
1415
|
-
description : str
|
1416
|
-
Description of sensor in the Airflow UI
|
1417
|
-
external_dag_id : str
|
1418
|
-
The dag_id that contains the task you want to wait for.
|
1419
|
-
external_task_ids : List[str]
|
1420
|
-
The list of task_ids that you want to wait for.
|
1421
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1422
|
-
allowed_states : List[str]
|
1423
|
-
Iterable of allowed states, (Default: ['success'])
|
1424
|
-
failed_states : List[str]
|
1425
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1426
|
-
execution_delta : datetime.timedelta
|
1427
|
-
time difference with the previous execution to look at,
|
1428
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1429
|
-
check_existence: bool
|
1430
|
-
Set to True to check if the external task exists or check if
|
1431
|
-
the DAG to wait for exists. (Default: True)
|
1432
|
-
"""
|
1433
|
-
...
|
1434
|
-
|
1435
|
-
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1436
|
-
"""
|
1437
|
-
Specifies what flows belong to the same project.
|
1438
|
-
|
1439
|
-
A project-specific namespace is created for all flows that
|
1440
|
-
use the same `@project(name)`.
|
1441
|
-
|
1442
|
-
Parameters
|
1443
|
-
----------
|
1444
|
-
name : str
|
1445
|
-
Project name. Make sure that the name is unique amongst all
|
1446
|
-
projects that use the same production scheduler. The name may
|
1447
|
-
contain only lowercase alphanumeric characters and underscores.
|
1448
|
-
|
1449
|
-
|
1450
|
-
"""
|
1451
|
-
...
|
1452
|
-
|
1453
1412
|
@typing.overload
|
1454
1413
|
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]]:
|
1455
1414
|
"""
|
@@ -1545,6 +1504,148 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1545
1504
|
"""
|
1546
1505
|
...
|
1547
1506
|
|
1507
|
+
@typing.overload
|
1508
|
+
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]]:
|
1509
|
+
"""
|
1510
|
+
Specifies the flow(s) that this flow depends on.
|
1511
|
+
|
1512
|
+
```
|
1513
|
+
@trigger_on_finish(flow='FooFlow')
|
1514
|
+
```
|
1515
|
+
or
|
1516
|
+
```
|
1517
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1518
|
+
```
|
1519
|
+
This decorator respects the @project decorator and triggers the flow
|
1520
|
+
when upstream runs within the same namespace complete successfully
|
1521
|
+
|
1522
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1523
|
+
by specifying the fully qualified project_flow_name.
|
1524
|
+
```
|
1525
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1526
|
+
```
|
1527
|
+
or
|
1528
|
+
```
|
1529
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1530
|
+
```
|
1531
|
+
|
1532
|
+
You can also specify just the project or project branch (other values will be
|
1533
|
+
inferred from the current project or project branch):
|
1534
|
+
```
|
1535
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1536
|
+
```
|
1537
|
+
|
1538
|
+
Note that `branch` is typically one of:
|
1539
|
+
- `prod`
|
1540
|
+
- `user.bob`
|
1541
|
+
- `test.my_experiment`
|
1542
|
+
- `prod.staging`
|
1543
|
+
|
1544
|
+
Parameters
|
1545
|
+
----------
|
1546
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1547
|
+
Upstream flow dependency for this flow.
|
1548
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1549
|
+
Upstream flow dependencies for this flow.
|
1550
|
+
options : Dict[str, Any], default {}
|
1551
|
+
Backend-specific configuration for tuning eventing behavior.
|
1552
|
+
|
1553
|
+
|
1554
|
+
"""
|
1555
|
+
...
|
1556
|
+
|
1557
|
+
@typing.overload
|
1558
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1559
|
+
...
|
1560
|
+
|
1561
|
+
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] = {}):
|
1562
|
+
"""
|
1563
|
+
Specifies the flow(s) that this flow depends on.
|
1564
|
+
|
1565
|
+
```
|
1566
|
+
@trigger_on_finish(flow='FooFlow')
|
1567
|
+
```
|
1568
|
+
or
|
1569
|
+
```
|
1570
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1571
|
+
```
|
1572
|
+
This decorator respects the @project decorator and triggers the flow
|
1573
|
+
when upstream runs within the same namespace complete successfully
|
1574
|
+
|
1575
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1576
|
+
by specifying the fully qualified project_flow_name.
|
1577
|
+
```
|
1578
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1579
|
+
```
|
1580
|
+
or
|
1581
|
+
```
|
1582
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1583
|
+
```
|
1584
|
+
|
1585
|
+
You can also specify just the project or project branch (other values will be
|
1586
|
+
inferred from the current project or project branch):
|
1587
|
+
```
|
1588
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1589
|
+
```
|
1590
|
+
|
1591
|
+
Note that `branch` is typically one of:
|
1592
|
+
- `prod`
|
1593
|
+
- `user.bob`
|
1594
|
+
- `test.my_experiment`
|
1595
|
+
- `prod.staging`
|
1596
|
+
|
1597
|
+
Parameters
|
1598
|
+
----------
|
1599
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1600
|
+
Upstream flow dependency for this flow.
|
1601
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1602
|
+
Upstream flow dependencies for this flow.
|
1603
|
+
options : Dict[str, Any], default {}
|
1604
|
+
Backend-specific configuration for tuning eventing behavior.
|
1605
|
+
|
1606
|
+
|
1607
|
+
"""
|
1608
|
+
...
|
1609
|
+
|
1610
|
+
@typing.overload
|
1611
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1612
|
+
"""
|
1613
|
+
Specifies the PyPI packages for all steps of the flow.
|
1614
|
+
|
1615
|
+
Use `@pypi_base` to set common packages required by all
|
1616
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1617
|
+
Parameters
|
1618
|
+
----------
|
1619
|
+
packages : Dict[str, str], default: {}
|
1620
|
+
Packages to use for this flow. The key is the name of the package
|
1621
|
+
and the value is the version to use.
|
1622
|
+
python : str, optional, default: None
|
1623
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1624
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1625
|
+
"""
|
1626
|
+
...
|
1627
|
+
|
1628
|
+
@typing.overload
|
1629
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1630
|
+
...
|
1631
|
+
|
1632
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1633
|
+
"""
|
1634
|
+
Specifies the PyPI packages for all steps of the flow.
|
1635
|
+
|
1636
|
+
Use `@pypi_base` to set common packages required by all
|
1637
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1638
|
+
Parameters
|
1639
|
+
----------
|
1640
|
+
packages : Dict[str, str], default: {}
|
1641
|
+
Packages to use for this flow. The key is the name of the package
|
1642
|
+
and the value is the version to use.
|
1643
|
+
python : str, optional, default: None
|
1644
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1645
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1646
|
+
"""
|
1647
|
+
...
|
1648
|
+
|
1548
1649
|
@typing.overload
|
1549
1650
|
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]]:
|
1550
1651
|
"""
|
@@ -1594,52 +1695,10 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1594
1695
|
"""
|
1595
1696
|
...
|
1596
1697
|
|
1597
|
-
|
1598
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1599
|
-
"""
|
1600
|
-
Specifies the PyPI packages for all steps of the flow.
|
1601
|
-
|
1602
|
-
Use `@pypi_base` to set common packages required by all
|
1603
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1604
|
-
Parameters
|
1605
|
-
----------
|
1606
|
-
packages : Dict[str, str], default: {}
|
1607
|
-
Packages to use for this flow. The key is the name of the package
|
1608
|
-
and the value is the version to use.
|
1609
|
-
python : str, optional, default: None
|
1610
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1611
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1612
|
-
"""
|
1613
|
-
...
|
1614
|
-
|
1615
|
-
@typing.overload
|
1616
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1617
|
-
...
|
1618
|
-
|
1619
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1620
|
-
"""
|
1621
|
-
Specifies the PyPI packages for all steps of the flow.
|
1622
|
-
|
1623
|
-
Use `@pypi_base` to set common packages required by all
|
1624
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1625
|
-
Parameters
|
1626
|
-
----------
|
1627
|
-
packages : Dict[str, str], default: {}
|
1628
|
-
Packages to use for this flow. The key is the name of the package
|
1629
|
-
and the value is the version to use.
|
1630
|
-
python : str, optional, default: None
|
1631
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1632
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1633
|
-
"""
|
1634
|
-
...
|
1635
|
-
|
1636
|
-
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]]:
|
1698
|
+
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]]:
|
1637
1699
|
"""
|
1638
|
-
The `@
|
1639
|
-
|
1640
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1641
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1642
|
-
starts only after all sensors finish.
|
1700
|
+
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.
|
1701
|
+
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.
|
1643
1702
|
|
1644
1703
|
Parameters
|
1645
1704
|
----------
|
@@ -1660,18 +1719,39 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1660
1719
|
Name of the sensor on Airflow
|
1661
1720
|
description : str
|
1662
1721
|
Description of sensor in the Airflow UI
|
1663
|
-
|
1664
|
-
The
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1722
|
+
external_dag_id : str
|
1723
|
+
The dag_id that contains the task you want to wait for.
|
1724
|
+
external_task_ids : List[str]
|
1725
|
+
The list of task_ids that you want to wait for.
|
1726
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1727
|
+
allowed_states : List[str]
|
1728
|
+
Iterable of allowed states, (Default: ['success'])
|
1729
|
+
failed_states : List[str]
|
1730
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1731
|
+
execution_delta : datetime.timedelta
|
1732
|
+
time difference with the previous execution to look at,
|
1733
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1734
|
+
check_existence: bool
|
1735
|
+
Set to True to check if the external task exists or check if
|
1736
|
+
the DAG to wait for exists. (Default: True)
|
1737
|
+
"""
|
1738
|
+
...
|
1739
|
+
|
1740
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1741
|
+
"""
|
1742
|
+
Specifies what flows belong to the same project.
|
1743
|
+
|
1744
|
+
A project-specific namespace is created for all flows that
|
1745
|
+
use the same `@project(name)`.
|
1746
|
+
|
1747
|
+
Parameters
|
1748
|
+
----------
|
1749
|
+
name : str
|
1750
|
+
Project name. Make sure that the name is unique amongst all
|
1751
|
+
projects that use the same production scheduler. The name may
|
1752
|
+
contain only lowercase alphanumeric characters and underscores.
|
1753
|
+
|
1754
|
+
|
1675
1755
|
"""
|
1676
1756
|
...
|
1677
1757
|
|
@@ -1724,106 +1804,45 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1724
1804
|
"""
|
1725
1805
|
...
|
1726
1806
|
|
1727
|
-
|
1728
|
-
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]]:
|
1729
|
-
"""
|
1730
|
-
Specifies the flow(s) that this flow depends on.
|
1731
|
-
|
1732
|
-
```
|
1733
|
-
@trigger_on_finish(flow='FooFlow')
|
1734
|
-
```
|
1735
|
-
or
|
1736
|
-
```
|
1737
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1738
|
-
```
|
1739
|
-
This decorator respects the @project decorator and triggers the flow
|
1740
|
-
when upstream runs within the same namespace complete successfully
|
1741
|
-
|
1742
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1743
|
-
by specifying the fully qualified project_flow_name.
|
1744
|
-
```
|
1745
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1746
|
-
```
|
1747
|
-
or
|
1748
|
-
```
|
1749
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1750
|
-
```
|
1751
|
-
|
1752
|
-
You can also specify just the project or project branch (other values will be
|
1753
|
-
inferred from the current project or project branch):
|
1754
|
-
```
|
1755
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1756
|
-
```
|
1757
|
-
|
1758
|
-
Note that `branch` is typically one of:
|
1759
|
-
- `prod`
|
1760
|
-
- `user.bob`
|
1761
|
-
- `test.my_experiment`
|
1762
|
-
- `prod.staging`
|
1763
|
-
|
1764
|
-
Parameters
|
1765
|
-
----------
|
1766
|
-
flow : Union[str, Dict[str, str]], optional, default None
|
1767
|
-
Upstream flow dependency for this flow.
|
1768
|
-
flows : List[Union[str, Dict[str, str]]], default []
|
1769
|
-
Upstream flow dependencies for this flow.
|
1770
|
-
options : Dict[str, Any], default {}
|
1771
|
-
Backend-specific configuration for tuning eventing behavior.
|
1772
|
-
|
1773
|
-
|
1774
|
-
"""
|
1775
|
-
...
|
1776
|
-
|
1777
|
-
@typing.overload
|
1778
|
-
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1779
|
-
...
|
1780
|
-
|
1781
|
-
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] = {}):
|
1807
|
+
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]]:
|
1782
1808
|
"""
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
or
|
1789
|
-
```
|
1790
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1791
|
-
```
|
1792
|
-
This decorator respects the @project decorator and triggers the flow
|
1793
|
-
when upstream runs within the same namespace complete successfully
|
1794
|
-
|
1795
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1796
|
-
by specifying the fully qualified project_flow_name.
|
1797
|
-
```
|
1798
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1799
|
-
```
|
1800
|
-
or
|
1801
|
-
```
|
1802
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1803
|
-
```
|
1804
|
-
|
1805
|
-
You can also specify just the project or project branch (other values will be
|
1806
|
-
inferred from the current project or project branch):
|
1807
|
-
```
|
1808
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1809
|
-
```
|
1810
|
-
|
1811
|
-
Note that `branch` is typically one of:
|
1812
|
-
- `prod`
|
1813
|
-
- `user.bob`
|
1814
|
-
- `test.my_experiment`
|
1815
|
-
- `prod.staging`
|
1809
|
+
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)
|
1810
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1811
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1812
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1813
|
+
starts only after all sensors finish.
|
1816
1814
|
|
1817
1815
|
Parameters
|
1818
1816
|
----------
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1817
|
+
timeout : int
|
1818
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1819
|
+
poke_interval : int
|
1820
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1821
|
+
mode : str
|
1822
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1823
|
+
exponential_backoff : bool
|
1824
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1825
|
+
pool : str
|
1826
|
+
the slot pool this task should run in,
|
1827
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1828
|
+
soft_fail : bool
|
1829
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1830
|
+
name : str
|
1831
|
+
Name of the sensor on Airflow
|
1832
|
+
description : str
|
1833
|
+
Description of sensor in the Airflow UI
|
1834
|
+
bucket_key : Union[str, List[str]]
|
1835
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1836
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1837
|
+
bucket_name : str
|
1838
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1839
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1840
|
+
wildcard_match : bool
|
1841
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1842
|
+
aws_conn_id : str
|
1843
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1844
|
+
verify : bool
|
1845
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1827
1846
|
"""
|
1828
1847
|
...
|
1829
1848
|
|
@@ -2975,3 +2994,33 @@ class NBRunner(object, metaclass=type):
|
|
2975
2994
|
...
|
2976
2995
|
...
|
2977
2996
|
|
2997
|
+
class Deployer(object, metaclass=type):
|
2998
|
+
def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, **kwargs):
|
2999
|
+
...
|
3000
|
+
def _Deployer__make_function(self, deployer_class):
|
3001
|
+
"""
|
3002
|
+
Create a function for the given deployer class.
|
3003
|
+
|
3004
|
+
Parameters
|
3005
|
+
----------
|
3006
|
+
deployer_class : Type[DeployerImpl]
|
3007
|
+
Deployer implementation class.
|
3008
|
+
|
3009
|
+
Returns
|
3010
|
+
-------
|
3011
|
+
Callable
|
3012
|
+
Function that initializes and returns an instance of the deployer class.
|
3013
|
+
"""
|
3014
|
+
...
|
3015
|
+
...
|
3016
|
+
|
3017
|
+
class NBDeployer(object, metaclass=type):
|
3018
|
+
def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str = "/tmp", **kwargs):
|
3019
|
+
...
|
3020
|
+
def cleanup(self):
|
3021
|
+
"""
|
3022
|
+
Delete any temporary files created during execution.
|
3023
|
+
"""
|
3024
|
+
...
|
3025
|
+
...
|
3026
|
+
|