metaflow-stubs 2.11.16__py2.py3-none-any.whl → 2.12.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metaflow-stubs/__init__.pyi +698 -499
- metaflow-stubs/cards.pyi +5 -5
- metaflow-stubs/cli.pyi +46 -21
- metaflow-stubs/client/__init__.pyi +5 -5
- 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 +5 -5
- 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 +4 -2
- metaflow-stubs/metaflow_current.pyi +3 -3
- 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 +2 -2
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow.pyi +3 -3
- metaflow-stubs/plugins/airflow/airflow_cli.pyi +4 -4
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +4 -4
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +4 -4
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +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 +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +4 -4
- 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_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 +2 -2
- 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 +3 -3
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +4 -4
- 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 +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 +3 -3
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +4 -4
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +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 +3 -3
- 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 +4 -4
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +3 -3
- metaflow-stubs/plugins/logs_cli.pyi +2 -2
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +3 -3
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +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/runner/__init__.pyi +9 -0
- metaflow-stubs/runner/metaflow_runner.pyi +696 -0
- metaflow-stubs/runner/nbrun.pyi +224 -0
- metaflow-stubs/runner/subprocess_manager.pyi +221 -0
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.11.16.dist-info → metaflow_stubs-2.12.1.dist-info}/METADATA +2 -2
- metaflow_stubs-2.12.1.dist-info/RECORD +142 -0
- metaflow_stubs-2.11.16.dist-info/RECORD +0 -138
- {metaflow_stubs-2.11.16.dist-info → metaflow_stubs-2.12.1.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.11.16.dist-info → metaflow_stubs-2.12.1.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.1 #
|
4
|
+
# Generated on 2024-06-03T17:47:01.111972 #
|
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._vendor.click.types
|
12
11
|
import metaflow.plugins.datatools.s3.s3
|
13
|
-
import metaflow.
|
14
|
-
import
|
12
|
+
import metaflow._vendor.click.types
|
13
|
+
import io
|
15
14
|
import typing
|
15
|
+
import metaflow.events
|
16
16
|
import datetime
|
17
17
|
import metaflow.client.core
|
18
|
-
import
|
19
|
-
import metaflow.metaflow_current
|
18
|
+
import metaflow.datastore.inputs
|
20
19
|
import metaflow.parameters
|
20
|
+
import metaflow.runner.metaflow_runner
|
21
|
+
import metaflow.metaflow_current
|
21
22
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
22
23
|
StepFlag = typing.NewType("StepFlag", bool)
|
23
24
|
|
@@ -726,79 +727,141 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
726
727
|
...
|
727
728
|
|
728
729
|
@typing.overload
|
729
|
-
def
|
730
|
+
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]]]:
|
730
731
|
"""
|
731
|
-
Specifies the
|
732
|
-
|
733
|
-
Use `@resources` to specify the resource requirements
|
734
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
732
|
+
Specifies the PyPI packages for the step.
|
735
733
|
|
736
|
-
|
737
|
-
|
738
|
-
|
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`.
|
734
|
+
Information in this decorator will augment any
|
735
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
736
|
+
you can use `@pypi_base` to set packages required by all
|
737
|
+
steps and use `@pypi` to specify step-specific overrides.
|
746
738
|
|
747
739
|
Parameters
|
748
740
|
----------
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
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.
|
741
|
+
packages : Dict[str, str], default: {}
|
742
|
+
Packages to use for this step. The key is the name of the package
|
743
|
+
and the value is the version to use.
|
744
|
+
python : str, optional, default: None
|
745
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
746
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
760
747
|
"""
|
761
748
|
...
|
762
749
|
|
763
750
|
@typing.overload
|
764
|
-
def
|
751
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
765
752
|
...
|
766
753
|
|
767
754
|
@typing.overload
|
768
|
-
def
|
755
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
769
756
|
...
|
770
757
|
|
771
|
-
def
|
758
|
+
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):
|
772
759
|
"""
|
773
|
-
Specifies the
|
760
|
+
Specifies the PyPI packages for the step.
|
774
761
|
|
775
|
-
|
776
|
-
|
762
|
+
Information in this decorator will augment any
|
763
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
764
|
+
you can use `@pypi_base` to set packages required by all
|
765
|
+
steps and use `@pypi` to specify step-specific overrides.
|
777
766
|
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
767
|
+
Parameters
|
768
|
+
----------
|
769
|
+
packages : Dict[str, str], default: {}
|
770
|
+
Packages to use for this step. The key is the name of the package
|
771
|
+
and the value is the version to use.
|
772
|
+
python : str, optional, default: None
|
773
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
774
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
775
|
+
"""
|
776
|
+
...
|
777
|
+
|
778
|
+
@typing.overload
|
779
|
+
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]]]:
|
780
|
+
"""
|
781
|
+
Specifies environment variables to be set prior to the execution of a step.
|
782
|
+
|
783
|
+
Parameters
|
784
|
+
----------
|
785
|
+
vars : Dict[str, str], default {}
|
786
|
+
Dictionary of environment variables to set.
|
787
|
+
"""
|
788
|
+
...
|
789
|
+
|
790
|
+
@typing.overload
|
791
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
792
|
+
...
|
793
|
+
|
794
|
+
@typing.overload
|
795
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
796
|
+
...
|
797
|
+
|
798
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
799
|
+
"""
|
800
|
+
Specifies environment variables to be set prior to the execution of a step.
|
801
|
+
|
802
|
+
Parameters
|
803
|
+
----------
|
804
|
+
vars : Dict[str, str], default {}
|
805
|
+
Dictionary of environment variables to set.
|
806
|
+
"""
|
807
|
+
...
|
808
|
+
|
809
|
+
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]]]:
|
810
|
+
"""
|
811
|
+
Specifies that this step should execute on Kubernetes.
|
788
812
|
|
789
813
|
Parameters
|
790
814
|
----------
|
791
815
|
cpu : int, default 1
|
792
|
-
Number of CPUs required for this step.
|
793
|
-
|
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.
|
816
|
+
Number of CPUs required for this step. If `@resources` is
|
817
|
+
also present, the maximum value from all decorators is used.
|
797
818
|
memory : int, default 4096
|
798
|
-
Memory size (in MB) required for this step.
|
799
|
-
|
800
|
-
|
801
|
-
|
819
|
+
Memory size (in MB) required for this step. If
|
820
|
+
`@resources` is also present, the maximum value from all decorators is
|
821
|
+
used.
|
822
|
+
disk : int, default 10240
|
823
|
+
Disk size (in MB) required for this step. If
|
824
|
+
`@resources` is also present, the maximum value from all decorators is
|
825
|
+
used.
|
826
|
+
image : str, optional, default None
|
827
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
828
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
829
|
+
not, a default Docker image mapping to the current version of Python is used.
|
830
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
831
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
832
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
833
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
834
|
+
secrets : List[str], optional, default None
|
835
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
836
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
837
|
+
in Metaflow configuration.
|
838
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
839
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
840
|
+
gpu : int, optional, default None
|
841
|
+
Number of GPUs required for this step. A value of zero implies that
|
842
|
+
the scheduled node should not have GPUs.
|
843
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
844
|
+
The vendor of the GPUs to be used for this step.
|
845
|
+
tolerations : List[str], default []
|
846
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
847
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
848
|
+
use_tmpfs : bool, default False
|
849
|
+
This enables an explicit tmpfs mount for this step.
|
850
|
+
tmpfs_tempdir : bool, default True
|
851
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
852
|
+
tmpfs_size : int, optional, default: None
|
853
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
854
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
855
|
+
memory allocated for this step.
|
856
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
857
|
+
Path to tmpfs mount for this step.
|
858
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
859
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
860
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
861
|
+
shared_memory: int, optional
|
862
|
+
Shared memory size (in MiB) required for this step
|
863
|
+
port: int, optional
|
864
|
+
Port number to specify in the Kubernetes job object
|
802
865
|
"""
|
803
866
|
...
|
804
867
|
|
@@ -854,288 +917,136 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
854
917
|
...
|
855
918
|
|
856
919
|
@typing.overload
|
857
|
-
def
|
920
|
+
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]]]:
|
858
921
|
"""
|
859
|
-
Specifies
|
922
|
+
Specifies the resources needed when executing this step.
|
923
|
+
|
924
|
+
Use `@resources` to specify the resource requirements
|
925
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
926
|
+
|
927
|
+
You can choose the compute layer on the command line by executing e.g.
|
928
|
+
```
|
929
|
+
python myflow.py run --with batch
|
930
|
+
```
|
931
|
+
or
|
932
|
+
```
|
933
|
+
python myflow.py run --with kubernetes
|
934
|
+
```
|
935
|
+
which executes the flow on the desired system using the
|
936
|
+
requirements specified in `@resources`.
|
860
937
|
|
861
938
|
Parameters
|
862
939
|
----------
|
863
940
|
cpu : int, default 1
|
864
|
-
Number of CPUs required for this step.
|
865
|
-
also present, the maximum value from all decorators is used.
|
941
|
+
Number of CPUs required for this step.
|
866
942
|
gpu : int, default 0
|
867
|
-
Number of GPUs required for this step.
|
868
|
-
|
943
|
+
Number of GPUs required for this step.
|
944
|
+
disk : int, optional, default None
|
945
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
869
946
|
memory : int, default 4096
|
870
|
-
Memory size (in MB) required for this step.
|
871
|
-
`@resources` is also present, the maximum value from all decorators is
|
872
|
-
used.
|
873
|
-
image : str, optional, default None
|
874
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
875
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
876
|
-
not, a default Docker image mapping to the current version of Python is used.
|
877
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
878
|
-
AWS Batch Job Queue to submit the job to.
|
879
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
880
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
881
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
882
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
883
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
947
|
+
Memory size (in MB) required for this step.
|
884
948
|
shared_memory : int, optional, default None
|
885
949
|
The value for the size (in MiB) of the /dev/shm volume for this step.
|
886
950
|
This parameter maps to the `--shm-size` option in Docker.
|
887
|
-
max_swap : int, optional, default None
|
888
|
-
The total amount of swap memory (in MiB) a container can use for this
|
889
|
-
step. This parameter is translated to the `--memory-swap` option in
|
890
|
-
Docker where the value is the sum of the container memory plus the
|
891
|
-
`max_swap` value.
|
892
|
-
swappiness : int, optional, default None
|
893
|
-
This allows you to tune memory swappiness behavior for this step.
|
894
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
895
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
896
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
897
|
-
use_tmpfs : bool, default False
|
898
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
899
|
-
not available on Fargate compute environments
|
900
|
-
tmpfs_tempdir : bool, default True
|
901
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
902
|
-
tmpfs_size : int, optional, default None
|
903
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
904
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
905
|
-
memory allocated for this step.
|
906
|
-
tmpfs_path : str, optional, default None
|
907
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
908
|
-
inferentia : int, default 0
|
909
|
-
Number of Inferentia chips required for this step.
|
910
|
-
trainium : int, default None
|
911
|
-
Alias for inferentia. Use only one of the two.
|
912
|
-
efa : int, default 0
|
913
|
-
Number of elastic fabric adapter network devices to attach to container
|
914
|
-
ephemeral_storage: int, default None
|
915
|
-
The total amount, in GiB, of ephemeral storage to set for the task (21-200)
|
916
|
-
This is only relevant for Fargate compute environments
|
917
|
-
log_driver: str, optional, default None
|
918
|
-
The log driver to use for the Amazon ECS container.
|
919
|
-
log_options: List[str], optional, default None
|
920
|
-
List of strings containing options for the chosen log driver. The configurable values
|
921
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
922
|
-
Example usage: ["awslogs-group:aws/batch/job"]
|
923
951
|
"""
|
924
952
|
...
|
925
953
|
|
926
954
|
@typing.overload
|
927
|
-
def
|
955
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
928
956
|
...
|
929
957
|
|
930
958
|
@typing.overload
|
931
|
-
def
|
959
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
932
960
|
...
|
933
961
|
|
934
|
-
def
|
962
|
+
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):
|
935
963
|
"""
|
936
|
-
Specifies
|
964
|
+
Specifies the resources needed when executing this step.
|
965
|
+
|
966
|
+
Use `@resources` to specify the resource requirements
|
967
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
968
|
+
|
969
|
+
You can choose the compute layer on the command line by executing e.g.
|
970
|
+
```
|
971
|
+
python myflow.py run --with batch
|
972
|
+
```
|
973
|
+
or
|
974
|
+
```
|
975
|
+
python myflow.py run --with kubernetes
|
976
|
+
```
|
977
|
+
which executes the flow on the desired system using the
|
978
|
+
requirements specified in `@resources`.
|
937
979
|
|
938
980
|
Parameters
|
939
981
|
----------
|
940
982
|
cpu : int, default 1
|
941
|
-
Number of CPUs required for this step.
|
942
|
-
also present, the maximum value from all decorators is used.
|
983
|
+
Number of CPUs required for this step.
|
943
984
|
gpu : int, default 0
|
944
|
-
Number of GPUs required for this step.
|
945
|
-
|
985
|
+
Number of GPUs required for this step.
|
986
|
+
disk : int, optional, default None
|
987
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
946
988
|
memory : int, default 4096
|
947
|
-
Memory size (in MB) required for this step.
|
948
|
-
`@resources` is also present, the maximum value from all decorators is
|
949
|
-
used.
|
950
|
-
image : str, optional, default None
|
951
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
952
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
953
|
-
not, a default Docker image mapping to the current version of Python is used.
|
954
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
955
|
-
AWS Batch Job Queue to submit the job to.
|
956
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
957
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
958
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
959
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
960
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
989
|
+
Memory size (in MB) required for this step.
|
961
990
|
shared_memory : int, optional, default None
|
962
991
|
The value for the size (in MiB) of the /dev/shm volume for this step.
|
963
992
|
This parameter maps to the `--shm-size` option in Docker.
|
964
|
-
max_swap : int, optional, default None
|
965
|
-
The total amount of swap memory (in MiB) a container can use for this
|
966
|
-
step. This parameter is translated to the `--memory-swap` option in
|
967
|
-
Docker where the value is the sum of the container memory plus the
|
968
|
-
`max_swap` value.
|
969
|
-
swappiness : int, optional, default None
|
970
|
-
This allows you to tune memory swappiness behavior for this step.
|
971
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
972
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
973
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
974
|
-
use_tmpfs : bool, default False
|
975
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
976
|
-
not available on Fargate compute environments
|
977
|
-
tmpfs_tempdir : bool, default True
|
978
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
979
|
-
tmpfs_size : int, optional, default None
|
980
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
981
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
982
|
-
memory allocated for this step.
|
983
|
-
tmpfs_path : str, optional, default None
|
984
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
985
|
-
inferentia : int, default 0
|
986
|
-
Number of Inferentia chips required for this step.
|
987
|
-
trainium : int, default None
|
988
|
-
Alias for inferentia. Use only one of the two.
|
989
|
-
efa : int, default 0
|
990
|
-
Number of elastic fabric adapter network devices to attach to container
|
991
|
-
ephemeral_storage: int, default None
|
992
|
-
The total amount, in GiB, of ephemeral storage to set for the task (21-200)
|
993
|
-
This is only relevant for Fargate compute environments
|
994
|
-
log_driver: str, optional, default None
|
995
|
-
The log driver to use for the Amazon ECS container.
|
996
|
-
log_options: List[str], optional, default None
|
997
|
-
List of strings containing options for the chosen log driver. The configurable values
|
998
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
999
|
-
Example usage: ["awslogs-group:aws/batch/job"]
|
1000
|
-
"""
|
1001
|
-
...
|
1002
|
-
|
1003
|
-
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]]]:
|
1004
|
-
"""
|
1005
|
-
Specifies that this step should execute on Kubernetes.
|
1006
|
-
|
1007
|
-
Parameters
|
1008
|
-
----------
|
1009
|
-
cpu : int, default 1
|
1010
|
-
Number of CPUs required for this step. If `@resources` is
|
1011
|
-
also present, the maximum value from all decorators is used.
|
1012
|
-
memory : int, default 4096
|
1013
|
-
Memory size (in MB) required for this step. If
|
1014
|
-
`@resources` is also present, the maximum value from all decorators is
|
1015
|
-
used.
|
1016
|
-
disk : int, default 10240
|
1017
|
-
Disk size (in MB) required for this step. If
|
1018
|
-
`@resources` is also present, the maximum value from all decorators is
|
1019
|
-
used.
|
1020
|
-
image : str, optional, default None
|
1021
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
1022
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1023
|
-
not, a default Docker image mapping to the current version of Python is used.
|
1024
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1025
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1026
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1027
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
1028
|
-
secrets : List[str], optional, default None
|
1029
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1030
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1031
|
-
in Metaflow configuration.
|
1032
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1033
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
1034
|
-
gpu : int, optional, default None
|
1035
|
-
Number of GPUs required for this step. A value of zero implies that
|
1036
|
-
the scheduled node should not have GPUs.
|
1037
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1038
|
-
The vendor of the GPUs to be used for this step.
|
1039
|
-
tolerations : List[str], default []
|
1040
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1041
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1042
|
-
use_tmpfs : bool, default False
|
1043
|
-
This enables an explicit tmpfs mount for this step.
|
1044
|
-
tmpfs_tempdir : bool, default True
|
1045
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1046
|
-
tmpfs_size : int, optional, default: None
|
1047
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1048
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1049
|
-
memory allocated for this step.
|
1050
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
1051
|
-
Path to tmpfs mount for this step.
|
1052
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
1053
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1054
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1055
|
-
shared_memory: int, optional
|
1056
|
-
Shared memory size (in MiB) required for this step
|
1057
|
-
port: int, optional
|
1058
|
-
Port number to specify in the Kubernetes job object
|
1059
|
-
"""
|
1060
|
-
...
|
1061
|
-
|
1062
|
-
@typing.overload
|
1063
|
-
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]]]:
|
1064
|
-
"""
|
1065
|
-
Specifies environment variables to be set prior to the execution of a step.
|
1066
|
-
|
1067
|
-
Parameters
|
1068
|
-
----------
|
1069
|
-
vars : Dict[str, str], default {}
|
1070
|
-
Dictionary of environment variables to set.
|
1071
|
-
"""
|
1072
|
-
...
|
1073
|
-
|
1074
|
-
@typing.overload
|
1075
|
-
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1076
|
-
...
|
1077
|
-
|
1078
|
-
@typing.overload
|
1079
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1080
|
-
...
|
1081
|
-
|
1082
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1083
|
-
"""
|
1084
|
-
Specifies environment variables to be set prior to the execution of a step.
|
1085
|
-
|
1086
|
-
Parameters
|
1087
|
-
----------
|
1088
|
-
vars : Dict[str, str], default {}
|
1089
|
-
Dictionary of environment variables to set.
|
1090
993
|
"""
|
1091
994
|
...
|
1092
995
|
|
1093
996
|
@typing.overload
|
1094
|
-
def
|
997
|
+
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]]]:
|
1095
998
|
"""
|
1096
|
-
Specifies
|
999
|
+
Specifies the Conda environment for the step.
|
1097
1000
|
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1001
|
+
Information in this decorator will augment any
|
1002
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1003
|
+
you can use `@conda_base` to set packages required by all
|
1004
|
+
steps and use `@conda` to specify step-specific overrides.
|
1102
1005
|
|
1103
1006
|
Parameters
|
1104
1007
|
----------
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1008
|
+
packages : Dict[str, str], default {}
|
1009
|
+
Packages to use for this step. The key is the name of the package
|
1010
|
+
and the value is the version to use.
|
1011
|
+
libraries : Dict[str, str], default {}
|
1012
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1013
|
+
python : str, optional, default None
|
1014
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1015
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1016
|
+
disabled : bool, default False
|
1017
|
+
If set to True, disables @conda.
|
1111
1018
|
"""
|
1112
1019
|
...
|
1113
1020
|
|
1114
1021
|
@typing.overload
|
1115
|
-
def
|
1022
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1116
1023
|
...
|
1117
1024
|
|
1118
1025
|
@typing.overload
|
1119
|
-
def
|
1026
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1120
1027
|
...
|
1121
1028
|
|
1122
|
-
def
|
1029
|
+
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):
|
1123
1030
|
"""
|
1124
|
-
Specifies
|
1031
|
+
Specifies the Conda environment for the step.
|
1125
1032
|
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1033
|
+
Information in this decorator will augment any
|
1034
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1035
|
+
you can use `@conda_base` to set packages required by all
|
1036
|
+
steps and use `@conda` to specify step-specific overrides.
|
1130
1037
|
|
1131
1038
|
Parameters
|
1132
1039
|
----------
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1040
|
+
packages : Dict[str, str], default {}
|
1041
|
+
Packages to use for this step. The key is the name of the package
|
1042
|
+
and the value is the version to use.
|
1043
|
+
libraries : Dict[str, str], default {}
|
1044
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1045
|
+
python : str, optional, default None
|
1046
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1047
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1048
|
+
disabled : bool, default False
|
1049
|
+
If set to True, disables @conda.
|
1139
1050
|
"""
|
1140
1051
|
...
|
1141
1052
|
|
@@ -1226,93 +1137,36 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
1226
1137
|
...
|
1227
1138
|
|
1228
1139
|
@typing.overload
|
1229
|
-
def
|
1140
|
+
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]]]:
|
1230
1141
|
"""
|
1231
|
-
Specifies
|
1142
|
+
Specifies a timeout for your step.
|
1232
1143
|
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1144
|
+
This decorator is useful if this step may hang indefinitely.
|
1145
|
+
|
1146
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1147
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1148
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1149
|
+
|
1150
|
+
Note that all the values specified in parameters are added together so if you specify
|
1151
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1237
1152
|
|
1238
1153
|
Parameters
|
1239
1154
|
----------
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1247
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1248
|
-
disabled : bool, default False
|
1249
|
-
If set to True, disables @conda.
|
1155
|
+
seconds : int, default 0
|
1156
|
+
Number of seconds to wait prior to timing out.
|
1157
|
+
minutes : int, default 0
|
1158
|
+
Number of minutes to wait prior to timing out.
|
1159
|
+
hours : int, default 0
|
1160
|
+
Number of hours to wait prior to timing out.
|
1250
1161
|
"""
|
1251
1162
|
...
|
1252
1163
|
|
1253
1164
|
@typing.overload
|
1254
|
-
def
|
1165
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1255
1166
|
...
|
1256
1167
|
|
1257
1168
|
@typing.overload
|
1258
|
-
def
|
1259
|
-
...
|
1260
|
-
|
1261
|
-
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):
|
1262
|
-
"""
|
1263
|
-
Specifies the Conda environment for the step.
|
1264
|
-
|
1265
|
-
Information in this decorator will augment any
|
1266
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1267
|
-
you can use `@conda_base` to set packages required by all
|
1268
|
-
steps and use `@conda` to specify step-specific overrides.
|
1269
|
-
|
1270
|
-
Parameters
|
1271
|
-
----------
|
1272
|
-
packages : Dict[str, str], default {}
|
1273
|
-
Packages to use for this step. The key is the name of the package
|
1274
|
-
and the value is the version to use.
|
1275
|
-
libraries : Dict[str, str], default {}
|
1276
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1277
|
-
python : str, optional, default None
|
1278
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1279
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1280
|
-
disabled : bool, default False
|
1281
|
-
If set to True, disables @conda.
|
1282
|
-
"""
|
1283
|
-
...
|
1284
|
-
|
1285
|
-
@typing.overload
|
1286
|
-
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]]]:
|
1287
|
-
"""
|
1288
|
-
Specifies a timeout for your step.
|
1289
|
-
|
1290
|
-
This decorator is useful if this step may hang indefinitely.
|
1291
|
-
|
1292
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1293
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1294
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1295
|
-
|
1296
|
-
Note that all the values specified in parameters are added together so if you specify
|
1297
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1298
|
-
|
1299
|
-
Parameters
|
1300
|
-
----------
|
1301
|
-
seconds : int, default 0
|
1302
|
-
Number of seconds to wait prior to timing out.
|
1303
|
-
minutes : int, default 0
|
1304
|
-
Number of minutes to wait prior to timing out.
|
1305
|
-
hours : int, default 0
|
1306
|
-
Number of hours to wait prior to timing out.
|
1307
|
-
"""
|
1308
|
-
...
|
1309
|
-
|
1310
|
-
@typing.overload
|
1311
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1312
|
-
...
|
1313
|
-
|
1314
|
-
@typing.overload
|
1315
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1169
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1316
1170
|
...
|
1317
1171
|
|
1318
1172
|
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):
|
@@ -1340,181 +1194,198 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
1340
1194
|
...
|
1341
1195
|
|
1342
1196
|
@typing.overload
|
1343
|
-
def
|
1197
|
+
def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1344
1198
|
"""
|
1345
|
-
Specifies
|
1346
|
-
|
1347
|
-
Information in this decorator will augment any
|
1348
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1349
|
-
you can use `@pypi_base` to set packages required by all
|
1350
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1199
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
1351
1200
|
|
1352
1201
|
Parameters
|
1353
1202
|
----------
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1203
|
+
cpu : int, default 1
|
1204
|
+
Number of CPUs required for this step. If `@resources` is
|
1205
|
+
also present, the maximum value from all decorators is used.
|
1206
|
+
gpu : int, default 0
|
1207
|
+
Number of GPUs required for this step. If `@resources` is
|
1208
|
+
also present, the maximum value from all decorators is used.
|
1209
|
+
memory : int, default 4096
|
1210
|
+
Memory size (in MB) required for this step. If
|
1211
|
+
`@resources` is also present, the maximum value from all decorators is
|
1212
|
+
used.
|
1213
|
+
image : str, optional, default None
|
1214
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
1215
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
1216
|
+
not, a default Docker image mapping to the current version of Python is used.
|
1217
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
1218
|
+
AWS Batch Job Queue to submit the job to.
|
1219
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
1220
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
1221
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
1222
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
1223
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
1224
|
+
shared_memory : int, optional, default None
|
1225
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1226
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1227
|
+
max_swap : int, optional, default None
|
1228
|
+
The total amount of swap memory (in MiB) a container can use for this
|
1229
|
+
step. This parameter is translated to the `--memory-swap` option in
|
1230
|
+
Docker where the value is the sum of the container memory plus the
|
1231
|
+
`max_swap` value.
|
1232
|
+
swappiness : int, optional, default None
|
1233
|
+
This allows you to tune memory swappiness behavior for this step.
|
1234
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
1235
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
1236
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
1237
|
+
use_tmpfs : bool, default False
|
1238
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
1239
|
+
not available on Fargate compute environments
|
1240
|
+
tmpfs_tempdir : bool, default True
|
1241
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1242
|
+
tmpfs_size : int, optional, default None
|
1243
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
1244
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1245
|
+
memory allocated for this step.
|
1246
|
+
tmpfs_path : str, optional, default None
|
1247
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1248
|
+
inferentia : int, default 0
|
1249
|
+
Number of Inferentia chips required for this step.
|
1250
|
+
trainium : int, default None
|
1251
|
+
Alias for inferentia. Use only one of the two.
|
1252
|
+
efa : int, default 0
|
1253
|
+
Number of elastic fabric adapter network devices to attach to container
|
1254
|
+
ephemeral_storage : int, default None
|
1255
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
1256
|
+
This is only relevant for Fargate compute environments
|
1257
|
+
log_driver: str, optional, default None
|
1258
|
+
The log driver to use for the Amazon ECS container.
|
1259
|
+
log_options: List[str], optional, default None
|
1260
|
+
List of strings containing options for the chosen log driver. The configurable values
|
1261
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1262
|
+
Example: [`awslogs-group:aws/batch/job`]
|
1360
1263
|
"""
|
1361
1264
|
...
|
1362
1265
|
|
1363
1266
|
@typing.overload
|
1364
|
-
def
|
1267
|
+
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1365
1268
|
...
|
1366
1269
|
|
1367
1270
|
@typing.overload
|
1368
|
-
def
|
1369
|
-
...
|
1370
|
-
|
1371
|
-
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):
|
1372
|
-
"""
|
1373
|
-
Specifies the PyPI packages for the step.
|
1374
|
-
|
1375
|
-
Information in this decorator will augment any
|
1376
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1377
|
-
you can use `@pypi_base` to set packages required by all
|
1378
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1379
|
-
|
1380
|
-
Parameters
|
1381
|
-
----------
|
1382
|
-
packages : Dict[str, str], default: {}
|
1383
|
-
Packages to use for this step. The key is the name of the package
|
1384
|
-
and the value is the version to use.
|
1385
|
-
python : str, optional, default: None
|
1386
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1387
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1388
|
-
"""
|
1271
|
+
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1389
1272
|
...
|
1390
1273
|
|
1391
|
-
|
1392
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1274
|
+
def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None):
|
1393
1275
|
"""
|
1394
|
-
Specifies
|
1276
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
1395
1277
|
|
1396
|
-
Use `@pypi_base` to set common packages required by all
|
1397
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1398
1278
|
Parameters
|
1399
1279
|
----------
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1280
|
+
cpu : int, default 1
|
1281
|
+
Number of CPUs required for this step. If `@resources` is
|
1282
|
+
also present, the maximum value from all decorators is used.
|
1283
|
+
gpu : int, default 0
|
1284
|
+
Number of GPUs required for this step. If `@resources` is
|
1285
|
+
also present, the maximum value from all decorators is used.
|
1286
|
+
memory : int, default 4096
|
1287
|
+
Memory size (in MB) required for this step. If
|
1288
|
+
`@resources` is also present, the maximum value from all decorators is
|
1289
|
+
used.
|
1290
|
+
image : str, optional, default None
|
1291
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
1292
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
1293
|
+
not, a default Docker image mapping to the current version of Python is used.
|
1294
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
1295
|
+
AWS Batch Job Queue to submit the job to.
|
1296
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
1297
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
1298
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
1299
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
1300
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
1301
|
+
shared_memory : int, optional, default None
|
1302
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1303
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1304
|
+
max_swap : int, optional, default None
|
1305
|
+
The total amount of swap memory (in MiB) a container can use for this
|
1306
|
+
step. This parameter is translated to the `--memory-swap` option in
|
1307
|
+
Docker where the value is the sum of the container memory plus the
|
1308
|
+
`max_swap` value.
|
1309
|
+
swappiness : int, optional, default None
|
1310
|
+
This allows you to tune memory swappiness behavior for this step.
|
1311
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
1312
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
1313
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
1314
|
+
use_tmpfs : bool, default False
|
1315
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
1316
|
+
not available on Fargate compute environments
|
1317
|
+
tmpfs_tempdir : bool, default True
|
1318
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1319
|
+
tmpfs_size : int, optional, default None
|
1320
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
1321
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1322
|
+
memory allocated for this step.
|
1323
|
+
tmpfs_path : str, optional, default None
|
1324
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1325
|
+
inferentia : int, default 0
|
1326
|
+
Number of Inferentia chips required for this step.
|
1327
|
+
trainium : int, default None
|
1328
|
+
Alias for inferentia. Use only one of the two.
|
1329
|
+
efa : int, default 0
|
1330
|
+
Number of elastic fabric adapter network devices to attach to container
|
1331
|
+
ephemeral_storage : int, default None
|
1332
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
1333
|
+
This is only relevant for Fargate compute environments
|
1334
|
+
log_driver: str, optional, default None
|
1335
|
+
The log driver to use for the Amazon ECS container.
|
1336
|
+
log_options: List[str], optional, default None
|
1337
|
+
List of strings containing options for the chosen log driver. The configurable values
|
1338
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1339
|
+
Example: [`awslogs-group:aws/batch/job`]
|
1406
1340
|
"""
|
1407
1341
|
...
|
1408
1342
|
|
1409
1343
|
@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):
|
1344
|
+
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]]]:
|
1414
1345
|
"""
|
1415
|
-
Specifies the
|
1346
|
+
Specifies that the step will success under all circumstances.
|
1416
1347
|
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
packages : Dict[str, str], default: {}
|
1422
|
-
Packages to use for this flow. The key is the name of the package
|
1423
|
-
and the value is the version to use.
|
1424
|
-
python : str, optional, default: None
|
1425
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1426
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1427
|
-
"""
|
1428
|
-
...
|
1429
|
-
|
1430
|
-
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]]:
|
1431
|
-
"""
|
1432
|
-
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)
|
1433
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1434
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1435
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1436
|
-
starts only after all sensors finish.
|
1348
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1349
|
+
contains the exception raised. You can use it to detect the presence
|
1350
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1351
|
+
are missing.
|
1437
1352
|
|
1438
1353
|
Parameters
|
1439
1354
|
----------
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
exponential_backoff : bool
|
1447
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1448
|
-
pool : str
|
1449
|
-
the slot pool this task should run in,
|
1450
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1451
|
-
soft_fail : bool
|
1452
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1453
|
-
name : str
|
1454
|
-
Name of the sensor on Airflow
|
1455
|
-
description : str
|
1456
|
-
Description of sensor in the Airflow UI
|
1457
|
-
bucket_key : Union[str, List[str]]
|
1458
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1459
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1460
|
-
bucket_name : str
|
1461
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1462
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1463
|
-
wildcard_match : bool
|
1464
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1465
|
-
aws_conn_id : str
|
1466
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1467
|
-
verify : bool
|
1468
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1355
|
+
var : str, optional, default None
|
1356
|
+
Name of the artifact in which to store the caught exception.
|
1357
|
+
If not specified, the exception is not stored.
|
1358
|
+
print_exception : bool, default True
|
1359
|
+
Determines whether or not the exception is printed to
|
1360
|
+
stdout when caught.
|
1469
1361
|
"""
|
1470
1362
|
...
|
1471
1363
|
|
1472
1364
|
@typing.overload
|
1473
|
-
def
|
1474
|
-
"""
|
1475
|
-
Specifies the Conda environment for all steps of the flow.
|
1476
|
-
|
1477
|
-
Use `@conda_base` to set common libraries required by all
|
1478
|
-
steps and use `@conda` to specify step-specific additions.
|
1479
|
-
|
1480
|
-
Parameters
|
1481
|
-
----------
|
1482
|
-
packages : Dict[str, str], default {}
|
1483
|
-
Packages to use for this flow. The key is the name of the package
|
1484
|
-
and the value is the version to use.
|
1485
|
-
libraries : Dict[str, str], default {}
|
1486
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1487
|
-
python : str, optional, default None
|
1488
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1489
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1490
|
-
disabled : bool, default False
|
1491
|
-
If set to True, disables Conda.
|
1492
|
-
"""
|
1365
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1493
1366
|
...
|
1494
1367
|
|
1495
1368
|
@typing.overload
|
1496
|
-
def
|
1369
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1497
1370
|
...
|
1498
1371
|
|
1499
|
-
def
|
1372
|
+
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):
|
1500
1373
|
"""
|
1501
|
-
Specifies the
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1374
|
+
Specifies that the step will success under all circumstances.
|
1375
|
+
|
1376
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1377
|
+
contains the exception raised. You can use it to detect the presence
|
1378
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1379
|
+
are missing.
|
1505
1380
|
|
1506
1381
|
Parameters
|
1507
1382
|
----------
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1515
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1516
|
-
disabled : bool, default False
|
1517
|
-
If set to True, disables Conda.
|
1383
|
+
var : str, optional, default None
|
1384
|
+
Name of the artifact in which to store the caught exception.
|
1385
|
+
If not specified, the exception is not stored.
|
1386
|
+
print_exception : bool, default True
|
1387
|
+
Determines whether or not the exception is printed to
|
1388
|
+
stdout when caught.
|
1518
1389
|
"""
|
1519
1390
|
...
|
1520
1391
|
|
@@ -1758,6 +1629,87 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1758
1629
|
"""
|
1759
1630
|
...
|
1760
1631
|
|
1632
|
+
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]]:
|
1633
|
+
"""
|
1634
|
+
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)
|
1635
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1636
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1637
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1638
|
+
starts only after all sensors finish.
|
1639
|
+
|
1640
|
+
Parameters
|
1641
|
+
----------
|
1642
|
+
timeout : int
|
1643
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1644
|
+
poke_interval : int
|
1645
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1646
|
+
mode : str
|
1647
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1648
|
+
exponential_backoff : bool
|
1649
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1650
|
+
pool : str
|
1651
|
+
the slot pool this task should run in,
|
1652
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1653
|
+
soft_fail : bool
|
1654
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1655
|
+
name : str
|
1656
|
+
Name of the sensor on Airflow
|
1657
|
+
description : str
|
1658
|
+
Description of sensor in the Airflow UI
|
1659
|
+
bucket_key : Union[str, List[str]]
|
1660
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1661
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1662
|
+
bucket_name : str
|
1663
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1664
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1665
|
+
wildcard_match : bool
|
1666
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1667
|
+
aws_conn_id : str
|
1668
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1669
|
+
verify : bool
|
1670
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1671
|
+
"""
|
1672
|
+
...
|
1673
|
+
|
1674
|
+
@typing.overload
|
1675
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1676
|
+
"""
|
1677
|
+
Specifies the PyPI packages for all steps of the flow.
|
1678
|
+
|
1679
|
+
Use `@pypi_base` to set common packages required by all
|
1680
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1681
|
+
Parameters
|
1682
|
+
----------
|
1683
|
+
packages : Dict[str, str], default: {}
|
1684
|
+
Packages to use for this flow. The key is the name of the package
|
1685
|
+
and the value is the version to use.
|
1686
|
+
python : str, optional, default: None
|
1687
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1688
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1689
|
+
"""
|
1690
|
+
...
|
1691
|
+
|
1692
|
+
@typing.overload
|
1693
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1694
|
+
...
|
1695
|
+
|
1696
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1697
|
+
"""
|
1698
|
+
Specifies the PyPI packages for all steps of the flow.
|
1699
|
+
|
1700
|
+
Use `@pypi_base` to set common packages required by all
|
1701
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1702
|
+
Parameters
|
1703
|
+
----------
|
1704
|
+
packages : Dict[str, str], default: {}
|
1705
|
+
Packages to use for this flow. The key is the name of the package
|
1706
|
+
and the value is the version to use.
|
1707
|
+
python : str, optional, default: None
|
1708
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1709
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1710
|
+
"""
|
1711
|
+
...
|
1712
|
+
|
1761
1713
|
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1762
1714
|
"""
|
1763
1715
|
Specifies what flows belong to the same project.
|
@@ -1776,6 +1728,55 @@ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typ
|
|
1776
1728
|
"""
|
1777
1729
|
...
|
1778
1730
|
|
1731
|
+
@typing.overload
|
1732
|
+
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]]:
|
1733
|
+
"""
|
1734
|
+
Specifies the Conda environment for all steps of the flow.
|
1735
|
+
|
1736
|
+
Use `@conda_base` to set common libraries required by all
|
1737
|
+
steps and use `@conda` to specify step-specific additions.
|
1738
|
+
|
1739
|
+
Parameters
|
1740
|
+
----------
|
1741
|
+
packages : Dict[str, str], default {}
|
1742
|
+
Packages to use for this flow. The key is the name of the package
|
1743
|
+
and the value is the version to use.
|
1744
|
+
libraries : Dict[str, str], default {}
|
1745
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1746
|
+
python : str, optional, default None
|
1747
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1748
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1749
|
+
disabled : bool, default False
|
1750
|
+
If set to True, disables Conda.
|
1751
|
+
"""
|
1752
|
+
...
|
1753
|
+
|
1754
|
+
@typing.overload
|
1755
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1756
|
+
...
|
1757
|
+
|
1758
|
+
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):
|
1759
|
+
"""
|
1760
|
+
Specifies the Conda environment for all steps of the flow.
|
1761
|
+
|
1762
|
+
Use `@conda_base` to set common libraries required by all
|
1763
|
+
steps and use `@conda` to specify step-specific additions.
|
1764
|
+
|
1765
|
+
Parameters
|
1766
|
+
----------
|
1767
|
+
packages : Dict[str, str], default {}
|
1768
|
+
Packages to use for this flow. The key is the name of the package
|
1769
|
+
and the value is the version to use.
|
1770
|
+
libraries : Dict[str, str], default {}
|
1771
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1772
|
+
python : str, optional, default None
|
1773
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1774
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1775
|
+
disabled : bool, default False
|
1776
|
+
If set to True, disables Conda.
|
1777
|
+
"""
|
1778
|
+
...
|
1779
|
+
|
1779
1780
|
@typing.overload
|
1780
1781
|
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1781
1782
|
"""
|
@@ -2775,3 +2776,201 @@ class DataArtifact(metaflow.client.core.MetaflowObject, metaclass=type):
|
|
2775
2776
|
...
|
2776
2777
|
...
|
2777
2778
|
|
2779
|
+
class Runner(object, metaclass=type):
|
2780
|
+
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):
|
2781
|
+
...
|
2782
|
+
def __enter__(self) -> metaflow.runner.metaflow_runner.Runner:
|
2783
|
+
...
|
2784
|
+
def __aenter__(self) -> metaflow.runner.metaflow_runner.Runner:
|
2785
|
+
...
|
2786
|
+
def _Runner__get_executing_run(self, tfp_runner_attribute, command_obj):
|
2787
|
+
...
|
2788
|
+
def run(self, **kwargs) -> metaflow.runner.metaflow_runner.ExecutingRun:
|
2789
|
+
"""
|
2790
|
+
Blocking execution of the run. This method will wait until
|
2791
|
+
the run has completed execution.
|
2792
|
+
|
2793
|
+
Parameters
|
2794
|
+
----------
|
2795
|
+
**kwargs : Any
|
2796
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2797
|
+
the `run` command, in particular, any parameters accepted by the flow.
|
2798
|
+
|
2799
|
+
Returns
|
2800
|
+
-------
|
2801
|
+
ExecutingRun
|
2802
|
+
ExecutingRun containing the results of the run.
|
2803
|
+
"""
|
2804
|
+
...
|
2805
|
+
def resume(self, **kwargs):
|
2806
|
+
"""
|
2807
|
+
Blocking resume execution of the run.
|
2808
|
+
This method will wait until the resumed run has completed execution.
|
2809
|
+
|
2810
|
+
Parameters
|
2811
|
+
----------
|
2812
|
+
**kwargs : Any
|
2813
|
+
Additional arguments that you would pass to `python ./myflow.py` after
|
2814
|
+
the `resume` command.
|
2815
|
+
|
2816
|
+
Returns
|
2817
|
+
-------
|
2818
|
+
ExecutingRun
|
2819
|
+
ExecutingRun containing the results of the resumed run.
|
2820
|
+
"""
|
2821
|
+
...
|
2822
|
+
def async_run(self, **kwargs) -> metaflow.runner.metaflow_runner.ExecutingRun:
|
2823
|
+
"""
|
2824
|
+
Non-blocking execution of the run. This method will return as soon as the
|
2825
|
+
run has launched.
|
2826
|
+
|
2827
|
+
Note that this method is asynchronous and needs to be `await`ed.
|
2828
|
+
|
2829
|
+
Parameters
|
2830
|
+
----------
|
2831
|
+
**kwargs : Any
|
2832
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2833
|
+
the `run` command, in particular, any parameters accepted by the flow.
|
2834
|
+
|
2835
|
+
Returns
|
2836
|
+
-------
|
2837
|
+
ExecutingRun
|
2838
|
+
ExecutingRun representing the run that was started.
|
2839
|
+
"""
|
2840
|
+
...
|
2841
|
+
def async_resume(self, **kwargs):
|
2842
|
+
"""
|
2843
|
+
Non-blocking resume execution of the run.
|
2844
|
+
This method will return as soon as the resume has launched.
|
2845
|
+
|
2846
|
+
Note that this method is asynchronous and needs to be `await`ed.
|
2847
|
+
|
2848
|
+
Parameters
|
2849
|
+
----------
|
2850
|
+
**kwargs : Any
|
2851
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2852
|
+
the `resume` command.
|
2853
|
+
|
2854
|
+
Returns
|
2855
|
+
-------
|
2856
|
+
ExecutingRun
|
2857
|
+
ExecutingRun representing the resumed run that was started.
|
2858
|
+
"""
|
2859
|
+
...
|
2860
|
+
def __exit__(self, exc_type, exc_value, traceback):
|
2861
|
+
...
|
2862
|
+
def __aexit__(self, exc_type, exc_value, traceback):
|
2863
|
+
...
|
2864
|
+
def cleanup(self):
|
2865
|
+
"""
|
2866
|
+
Delete any temporary files created during execution.
|
2867
|
+
"""
|
2868
|
+
...
|
2869
|
+
...
|
2870
|
+
|
2871
|
+
class NBRunner(object, metaclass=type):
|
2872
|
+
def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str = "/tmp", **kwargs):
|
2873
|
+
...
|
2874
|
+
def nbrun(self, **kwargs):
|
2875
|
+
"""
|
2876
|
+
Blocking execution of the run. This method will wait until
|
2877
|
+
the run has completed execution.
|
2878
|
+
|
2879
|
+
Note that in contrast to `run`, this method returns a
|
2880
|
+
`metaflow.Run` object directly and calls `cleanup()` internally
|
2881
|
+
to support a common notebook pattern of executing a flow and
|
2882
|
+
retrieving its results immediately.
|
2883
|
+
|
2884
|
+
Parameters
|
2885
|
+
----------
|
2886
|
+
**kwargs : Any
|
2887
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2888
|
+
the `run` command, in particular, any parameters accepted by the flow.
|
2889
|
+
|
2890
|
+
Returns
|
2891
|
+
-------
|
2892
|
+
Run
|
2893
|
+
A `metaflow.Run` object representing the finished run.
|
2894
|
+
"""
|
2895
|
+
...
|
2896
|
+
def nbresume(self, **kwargs):
|
2897
|
+
"""
|
2898
|
+
Blocking resuming of a run. This method will wait until
|
2899
|
+
the resumed run has completed execution.
|
2900
|
+
|
2901
|
+
Note that in contrast to `resume`, this method returns a
|
2902
|
+
`metaflow.Run` object directly and calls `cleanup()` internally
|
2903
|
+
to support a common notebook pattern of executing a flow and
|
2904
|
+
retrieving its results immediately.
|
2905
|
+
|
2906
|
+
Parameters
|
2907
|
+
----------
|
2908
|
+
**kwargs : Any
|
2909
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2910
|
+
the `resume` command.
|
2911
|
+
|
2912
|
+
Returns
|
2913
|
+
-------
|
2914
|
+
Run
|
2915
|
+
A `metaflow.Run` object representing the resumed run.
|
2916
|
+
"""
|
2917
|
+
...
|
2918
|
+
def run(self, **kwargs):
|
2919
|
+
"""
|
2920
|
+
Runs the flow.
|
2921
|
+
"""
|
2922
|
+
...
|
2923
|
+
def resume(self, **kwargs):
|
2924
|
+
"""
|
2925
|
+
Resumes the flow.
|
2926
|
+
"""
|
2927
|
+
...
|
2928
|
+
def async_run(self, **kwargs):
|
2929
|
+
"""
|
2930
|
+
Non-blocking execution of the run. This method will return as soon as the
|
2931
|
+
run has launched. This method is equivalent to `Runner.async_run`.
|
2932
|
+
|
2933
|
+
Note that this method is asynchronous and needs to be `await`ed.
|
2934
|
+
|
2935
|
+
|
2936
|
+
Parameters
|
2937
|
+
----------
|
2938
|
+
**kwargs : Any
|
2939
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2940
|
+
the `run` command, in particular, any parameters accepted by the flow.
|
2941
|
+
|
2942
|
+
Returns
|
2943
|
+
-------
|
2944
|
+
ExecutingRun
|
2945
|
+
ExecutingRun representing the run that was started.
|
2946
|
+
"""
|
2947
|
+
...
|
2948
|
+
def async_resume(self, **kwargs):
|
2949
|
+
"""
|
2950
|
+
Non-blocking execution of the run. This method will return as soon as the
|
2951
|
+
run has launched. This method is equivalent to `Runner.async_resume`.
|
2952
|
+
|
2953
|
+
Note that this method is asynchronous and needs to be `await`ed.
|
2954
|
+
|
2955
|
+
Parameters
|
2956
|
+
----------
|
2957
|
+
**kwargs : Any
|
2958
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2959
|
+
the `run` command, in particular, any parameters accepted by the flow.
|
2960
|
+
|
2961
|
+
Returns
|
2962
|
+
-------
|
2963
|
+
ExecutingRun
|
2964
|
+
ExecutingRun representing the run that was started.
|
2965
|
+
"""
|
2966
|
+
...
|
2967
|
+
def cleanup(self):
|
2968
|
+
"""
|
2969
|
+
Delete any temporary files created during execution.
|
2970
|
+
|
2971
|
+
Call this method after using `async_run` or `async_resume`. You don't
|
2972
|
+
have to call this after `nbrun` or `nbresume`.
|
2973
|
+
"""
|
2974
|
+
...
|
2975
|
+
...
|
2976
|
+
|