metaflow-stubs 2.12.15__py2.py3-none-any.whl → 2.12.16__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 +559 -559
- metaflow-stubs/cards.pyi +6 -6
- 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 +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 +3 -3
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +36 -36
- 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 +2 -2
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_cli.pyi +3 -3
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +7 -7
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +6 -6
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +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 +3 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +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/aws/step_functions/step_functions_deployer.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_cli.pyi +5 -5
- 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 +4 -4
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/s3/s3.pyi +6 -6
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +3 -3
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +3 -3
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/logs_cli.pyi +3 -3
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +3 -3
- 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 +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/tag_cli.pyi +5 -5
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- 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 +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +5 -5
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +3 -3
- metaflow-stubs/system/system_logger.pyi +3 -3
- metaflow-stubs/system/system_monitor.pyi +3 -3
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.12.15.dist-info → metaflow_stubs-2.12.16.dist-info}/METADATA +2 -2
- metaflow_stubs-2.12.16.dist-info/RECORD +150 -0
- metaflow_stubs-2.12.15.dist-info/RECORD +0 -150
- {metaflow_stubs-2.12.15.dist-info → metaflow_stubs-2.12.16.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.12.15.dist-info → metaflow_stubs-2.12.16.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-08-
|
3
|
+
# MF version: 2.12.16 #
|
4
|
+
# Generated on 2024-08-26T21:06:14.574066 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import
|
11
|
+
import typing
|
12
|
+
import metaflow.client.core
|
13
|
+
import metaflow.flowspec
|
14
|
+
import metaflow._vendor.click.types
|
12
15
|
import metaflow.parameters
|
16
|
+
import metaflow.metaflow_current
|
13
17
|
import io
|
14
|
-
import metaflow.flowspec
|
15
|
-
import metaflow.client.core
|
16
|
-
import metaflow.events
|
17
18
|
import datetime
|
18
19
|
import metaflow.datastore.inputs
|
19
|
-
import
|
20
|
+
import metaflow.events
|
21
|
+
import metaflow.runner.metaflow_runner
|
20
22
|
import metaflow.plugins.datatools.s3.s3
|
21
|
-
import metaflow._vendor.click.types
|
22
|
-
import metaflow.metaflow_current
|
23
23
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
24
24
|
StepFlag = typing.NewType("StepFlag", bool)
|
25
25
|
|
@@ -727,167 +727,234 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
727
727
|
"""
|
728
728
|
...
|
729
729
|
|
730
|
-
|
730
|
+
@typing.overload
|
731
|
+
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]]]:
|
731
732
|
"""
|
732
|
-
Specifies that this step should execute on
|
733
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
733
734
|
|
734
735
|
Parameters
|
735
736
|
----------
|
736
737
|
cpu : int, default 1
|
737
738
|
Number of CPUs required for this step. If `@resources` is
|
738
739
|
also present, the maximum value from all decorators is used.
|
740
|
+
gpu : int, default 0
|
741
|
+
Number of GPUs required for this step. If `@resources` is
|
742
|
+
also present, the maximum value from all decorators is used.
|
739
743
|
memory : int, default 4096
|
740
744
|
Memory size (in MB) required for this step. If
|
741
745
|
`@resources` is also present, the maximum value from all decorators is
|
742
746
|
used.
|
743
|
-
|
744
|
-
|
747
|
+
image : str, optional, default None
|
748
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
749
|
+
METAFLOW_BATCH_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
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
752
|
+
AWS Batch Job Queue to submit the job to.
|
753
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
754
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
755
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
756
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
757
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
758
|
+
shared_memory : int, optional, default None
|
759
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
760
|
+
This parameter maps to the `--shm-size` option in Docker.
|
761
|
+
max_swap : int, optional, default None
|
762
|
+
The total amount of swap memory (in MiB) a container can use for this
|
763
|
+
step. This parameter is translated to the `--memory-swap` option in
|
764
|
+
Docker where the value is the sum of the container memory plus the
|
765
|
+
`max_swap` value.
|
766
|
+
swappiness : int, optional, default None
|
767
|
+
This allows you to tune memory swappiness behavior for this step.
|
768
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
769
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
770
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
771
|
+
use_tmpfs : bool, default False
|
772
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
773
|
+
not available on Fargate compute environments
|
774
|
+
tmpfs_tempdir : bool, default True
|
775
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
776
|
+
tmpfs_size : int, optional, default None
|
777
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
778
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
779
|
+
memory allocated for this step.
|
780
|
+
tmpfs_path : str, optional, default None
|
781
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
782
|
+
inferentia : int, default 0
|
783
|
+
Number of Inferentia chips required for this step.
|
784
|
+
trainium : int, default None
|
785
|
+
Alias for inferentia. Use only one of the two.
|
786
|
+
efa : int, default 0
|
787
|
+
Number of elastic fabric adapter network devices to attach to container
|
788
|
+
ephemeral_storage : int, default None
|
789
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
790
|
+
This is only relevant for Fargate compute environments
|
791
|
+
log_driver: str, optional, default None
|
792
|
+
The log driver to use for the Amazon ECS container.
|
793
|
+
log_options: List[str], optional, default None
|
794
|
+
List of strings containing options for the chosen log driver. The configurable values
|
795
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
796
|
+
Example: [`awslogs-group:aws/batch/job`]
|
797
|
+
"""
|
798
|
+
...
|
799
|
+
|
800
|
+
@typing.overload
|
801
|
+
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
802
|
+
...
|
803
|
+
|
804
|
+
@typing.overload
|
805
|
+
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
806
|
+
...
|
807
|
+
|
808
|
+
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):
|
809
|
+
"""
|
810
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
811
|
+
|
812
|
+
Parameters
|
813
|
+
----------
|
814
|
+
cpu : int, default 1
|
815
|
+
Number of CPUs required for this step. If `@resources` is
|
816
|
+
also present, the maximum value from all decorators is used.
|
817
|
+
gpu : int, default 0
|
818
|
+
Number of GPUs required for this step. If `@resources` is
|
819
|
+
also present, the maximum value from all decorators is used.
|
820
|
+
memory : int, default 4096
|
821
|
+
Memory size (in MB) required for this step. If
|
745
822
|
`@resources` is also present, the maximum value from all decorators is
|
746
823
|
used.
|
747
824
|
image : str, optional, default None
|
748
|
-
Docker image to use when launching on
|
749
|
-
|
825
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
826
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
750
827
|
not, a default Docker image mapping to the current version of Python is used.
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
828
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
829
|
+
AWS Batch Job Queue to submit the job to.
|
830
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
831
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
832
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
833
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
834
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
835
|
+
shared_memory : int, optional, default None
|
836
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
837
|
+
This parameter maps to the `--shm-size` option in Docker.
|
838
|
+
max_swap : int, optional, default None
|
839
|
+
The total amount of swap memory (in MiB) a container can use for this
|
840
|
+
step. This parameter is translated to the `--memory-swap` option in
|
841
|
+
Docker where the value is the sum of the container memory plus the
|
842
|
+
`max_swap` value.
|
843
|
+
swappiness : int, optional, default None
|
844
|
+
This allows you to tune memory swappiness behavior for this step.
|
845
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
846
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
847
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
769
848
|
use_tmpfs : bool, default False
|
770
|
-
This enables an explicit tmpfs mount for this step.
|
849
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
850
|
+
not available on Fargate compute environments
|
771
851
|
tmpfs_tempdir : bool, default True
|
772
852
|
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
773
|
-
tmpfs_size : int, optional, default
|
853
|
+
tmpfs_size : int, optional, default None
|
774
854
|
The value for the size (in MiB) of the tmpfs mount for this step.
|
775
855
|
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
776
856
|
memory allocated for this step.
|
777
|
-
tmpfs_path : str, optional, default
|
778
|
-
Path to tmpfs mount for this step.
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
857
|
+
tmpfs_path : str, optional, default None
|
858
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
859
|
+
inferentia : int, default 0
|
860
|
+
Number of Inferentia chips required for this step.
|
861
|
+
trainium : int, default None
|
862
|
+
Alias for inferentia. Use only one of the two.
|
863
|
+
efa : int, default 0
|
864
|
+
Number of elastic fabric adapter network devices to attach to container
|
865
|
+
ephemeral_storage : int, default None
|
866
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
867
|
+
This is only relevant for Fargate compute environments
|
868
|
+
log_driver: str, optional, default None
|
869
|
+
The log driver to use for the Amazon ECS container.
|
870
|
+
log_options: List[str], optional, default None
|
871
|
+
List of strings containing options for the chosen log driver. The configurable values
|
872
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
873
|
+
Example: [`awslogs-group:aws/batch/job`]
|
789
874
|
"""
|
790
875
|
...
|
791
876
|
|
792
877
|
@typing.overload
|
793
|
-
def
|
878
|
+
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]]]:
|
794
879
|
"""
|
795
|
-
Specifies
|
796
|
-
|
797
|
-
|
798
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
799
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
800
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
801
|
-
|
802
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
803
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
804
|
-
ensuring that the flow execution can continue.
|
880
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
881
|
+
the execution of a step.
|
805
882
|
|
806
883
|
Parameters
|
807
884
|
----------
|
808
|
-
|
809
|
-
|
810
|
-
minutes_between_retries : int, default 2
|
811
|
-
Number of minutes between retries.
|
885
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
886
|
+
List of secret specs, defining how the secrets are to be retrieved
|
812
887
|
"""
|
813
888
|
...
|
814
889
|
|
815
890
|
@typing.overload
|
816
|
-
def
|
891
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
817
892
|
...
|
818
893
|
|
819
894
|
@typing.overload
|
820
|
-
def
|
895
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
821
896
|
...
|
822
897
|
|
823
|
-
def
|
898
|
+
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]]] = []):
|
824
899
|
"""
|
825
|
-
Specifies
|
826
|
-
|
827
|
-
|
828
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
829
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
830
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
831
|
-
|
832
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
833
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
834
|
-
ensuring that the flow execution can continue.
|
900
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
901
|
+
the execution of a step.
|
835
902
|
|
836
903
|
Parameters
|
837
904
|
----------
|
838
|
-
|
839
|
-
|
840
|
-
minutes_between_retries : int, default 2
|
841
|
-
Number of minutes between retries.
|
905
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
906
|
+
List of secret specs, defining how the secrets are to be retrieved
|
842
907
|
"""
|
843
908
|
...
|
844
909
|
|
845
910
|
@typing.overload
|
846
|
-
def
|
911
|
+
def card(*, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
847
912
|
"""
|
848
|
-
|
913
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
849
914
|
|
850
|
-
|
851
|
-
contains the exception raised. You can use it to detect the presence
|
852
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
853
|
-
are missing.
|
915
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
854
916
|
|
855
917
|
Parameters
|
856
918
|
----------
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
919
|
+
type : str, default 'default'
|
920
|
+
Card type.
|
921
|
+
id : str, optional, default None
|
922
|
+
If multiple cards are present, use this id to identify this card.
|
923
|
+
options : Dict[str, Any], default {}
|
924
|
+
Options passed to the card. The contents depend on the card type.
|
925
|
+
timeout : int, default 45
|
926
|
+
Interrupt reporting if it takes more than this many seconds.
|
927
|
+
|
928
|
+
|
863
929
|
"""
|
864
930
|
...
|
865
931
|
|
866
932
|
@typing.overload
|
867
|
-
def
|
933
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
868
934
|
...
|
869
935
|
|
870
936
|
@typing.overload
|
871
|
-
def
|
937
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
872
938
|
...
|
873
939
|
|
874
|
-
def
|
940
|
+
def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
|
875
941
|
"""
|
876
|
-
|
942
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
877
943
|
|
878
|
-
|
879
|
-
contains the exception raised. You can use it to detect the presence
|
880
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
881
|
-
are missing.
|
944
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
882
945
|
|
883
946
|
Parameters
|
884
947
|
----------
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
948
|
+
type : str, default 'default'
|
949
|
+
Card type.
|
950
|
+
id : str, optional, default None
|
951
|
+
If multiple cards are present, use this id to identify this card.
|
952
|
+
options : Dict[str, Any], default {}
|
953
|
+
Options passed to the card. The contents depend on the card type.
|
954
|
+
timeout : int, default 45
|
955
|
+
Interrupt reporting if it takes more than this many seconds.
|
956
|
+
|
957
|
+
|
891
958
|
"""
|
892
959
|
...
|
893
960
|
|
@@ -969,52 +1036,55 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
969
1036
|
...
|
970
1037
|
|
971
1038
|
@typing.overload
|
972
|
-
def
|
1039
|
+
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]]]:
|
973
1040
|
"""
|
974
|
-
Specifies
|
1041
|
+
Specifies the number of times the task corresponding
|
1042
|
+
to a step needs to be retried.
|
1043
|
+
|
1044
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1045
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1046
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1047
|
+
|
1048
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1049
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1050
|
+
ensuring that the flow execution can continue.
|
975
1051
|
|
976
1052
|
Parameters
|
977
1053
|
----------
|
978
|
-
|
979
|
-
|
1054
|
+
times : int, default 3
|
1055
|
+
Number of times to retry this task.
|
1056
|
+
minutes_between_retries : int, default 2
|
1057
|
+
Number of minutes between retries.
|
980
1058
|
"""
|
981
1059
|
...
|
982
1060
|
|
983
1061
|
@typing.overload
|
984
|
-
def
|
1062
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
985
1063
|
...
|
986
1064
|
|
987
1065
|
@typing.overload
|
988
|
-
def
|
1066
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
989
1067
|
...
|
990
1068
|
|
991
|
-
def
|
1069
|
+
def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
|
992
1070
|
"""
|
993
|
-
Specifies
|
1071
|
+
Specifies the number of times the task corresponding
|
1072
|
+
to a step needs to be retried.
|
1073
|
+
|
1074
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1075
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1076
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1077
|
+
|
1078
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1079
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1080
|
+
ensuring that the flow execution can continue.
|
994
1081
|
|
995
1082
|
Parameters
|
996
1083
|
----------
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
@typing.overload
|
1003
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1004
|
-
"""
|
1005
|
-
Decorator prototype for all step decorators. This function gets specialized
|
1006
|
-
and imported for all decorators types by _import_plugin_decorators().
|
1007
|
-
"""
|
1008
|
-
...
|
1009
|
-
|
1010
|
-
@typing.overload
|
1011
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1012
|
-
...
|
1013
|
-
|
1014
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1015
|
-
"""
|
1016
|
-
Decorator prototype for all step decorators. This function gets specialized
|
1017
|
-
and imported for all decorators types by _import_plugin_decorators().
|
1084
|
+
times : int, default 3
|
1085
|
+
Number of times to retry this task.
|
1086
|
+
minutes_between_retries : int, default 2
|
1087
|
+
Number of minutes between retries.
|
1018
1088
|
"""
|
1019
1089
|
...
|
1020
1090
|
|
@@ -1076,339 +1146,463 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
1076
1146
|
...
|
1077
1147
|
|
1078
1148
|
@typing.overload
|
1079
|
-
def
|
1149
|
+
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]]]:
|
1080
1150
|
"""
|
1081
|
-
|
1151
|
+
Specifies the PyPI packages for the step.
|
1082
1152
|
|
1083
|
-
|
1153
|
+
Information in this decorator will augment any
|
1154
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1155
|
+
you can use `@pypi_base` to set packages required by all
|
1156
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1084
1157
|
|
1085
1158
|
Parameters
|
1086
1159
|
----------
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
timeout : int, default 45
|
1094
|
-
Interrupt reporting if it takes more than this many seconds.
|
1095
|
-
|
1096
|
-
|
1160
|
+
packages : Dict[str, str], default: {}
|
1161
|
+
Packages to use for this step. The key is the name of the package
|
1162
|
+
and the value is the version to use.
|
1163
|
+
python : str, optional, default: None
|
1164
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1165
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1097
1166
|
"""
|
1098
1167
|
...
|
1099
1168
|
|
1100
1169
|
@typing.overload
|
1101
|
-
def
|
1170
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1102
1171
|
...
|
1103
1172
|
|
1104
1173
|
@typing.overload
|
1105
|
-
def
|
1174
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1106
1175
|
...
|
1107
1176
|
|
1108
|
-
def
|
1177
|
+
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):
|
1109
1178
|
"""
|
1110
|
-
|
1179
|
+
Specifies the PyPI packages for the step.
|
1111
1180
|
|
1112
|
-
|
1181
|
+
Information in this decorator will augment any
|
1182
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1183
|
+
you can use `@pypi_base` to set packages required by all
|
1184
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1113
1185
|
|
1114
1186
|
Parameters
|
1115
1187
|
----------
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1188
|
+
packages : Dict[str, str], default: {}
|
1189
|
+
Packages to use for this step. The key is the name of the package
|
1190
|
+
and the value is the version to use.
|
1191
|
+
python : str, optional, default: None
|
1192
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1193
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1194
|
+
"""
|
1195
|
+
...
|
1196
|
+
|
1197
|
+
@typing.overload
|
1198
|
+
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]]]:
|
1199
|
+
"""
|
1200
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1124
1201
|
|
1202
|
+
Parameters
|
1203
|
+
----------
|
1204
|
+
vars : Dict[str, str], default {}
|
1205
|
+
Dictionary of environment variables to set.
|
1206
|
+
"""
|
1207
|
+
...
|
1208
|
+
|
1209
|
+
@typing.overload
|
1210
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1211
|
+
...
|
1212
|
+
|
1213
|
+
@typing.overload
|
1214
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1215
|
+
...
|
1216
|
+
|
1217
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1218
|
+
"""
|
1219
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1125
1220
|
|
1221
|
+
Parameters
|
1222
|
+
----------
|
1223
|
+
vars : Dict[str, str], default {}
|
1224
|
+
Dictionary of environment variables to set.
|
1126
1225
|
"""
|
1127
1226
|
...
|
1128
1227
|
|
1129
1228
|
@typing.overload
|
1130
|
-
def
|
1229
|
+
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]]]:
|
1131
1230
|
"""
|
1132
|
-
Specifies that
|
1231
|
+
Specifies that the step will success under all circumstances.
|
1232
|
+
|
1233
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1234
|
+
contains the exception raised. You can use it to detect the presence
|
1235
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1236
|
+
are missing.
|
1133
1237
|
|
1134
1238
|
Parameters
|
1135
1239
|
----------
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
memory : int, default 4096
|
1143
|
-
Memory size (in MB) required for this step. If
|
1144
|
-
`@resources` is also present, the maximum value from all decorators is
|
1145
|
-
used.
|
1146
|
-
image : str, optional, default None
|
1147
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
1148
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
1149
|
-
not, a default Docker image mapping to the current version of Python is used.
|
1150
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
1151
|
-
AWS Batch Job Queue to submit the job to.
|
1152
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
1153
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
1154
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
1155
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
1156
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
1157
|
-
shared_memory : int, optional, default None
|
1158
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1159
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1160
|
-
max_swap : int, optional, default None
|
1161
|
-
The total amount of swap memory (in MiB) a container can use for this
|
1162
|
-
step. This parameter is translated to the `--memory-swap` option in
|
1163
|
-
Docker where the value is the sum of the container memory plus the
|
1164
|
-
`max_swap` value.
|
1165
|
-
swappiness : int, optional, default None
|
1166
|
-
This allows you to tune memory swappiness behavior for this step.
|
1167
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
1168
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
1169
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
1170
|
-
use_tmpfs : bool, default False
|
1171
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
1172
|
-
not available on Fargate compute environments
|
1173
|
-
tmpfs_tempdir : bool, default True
|
1174
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1175
|
-
tmpfs_size : int, optional, default None
|
1176
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1177
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1178
|
-
memory allocated for this step.
|
1179
|
-
tmpfs_path : str, optional, default None
|
1180
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1181
|
-
inferentia : int, default 0
|
1182
|
-
Number of Inferentia chips required for this step.
|
1183
|
-
trainium : int, default None
|
1184
|
-
Alias for inferentia. Use only one of the two.
|
1185
|
-
efa : int, default 0
|
1186
|
-
Number of elastic fabric adapter network devices to attach to container
|
1187
|
-
ephemeral_storage : int, default None
|
1188
|
-
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
1189
|
-
This is only relevant for Fargate compute environments
|
1190
|
-
log_driver: str, optional, default None
|
1191
|
-
The log driver to use for the Amazon ECS container.
|
1192
|
-
log_options: List[str], optional, default None
|
1193
|
-
List of strings containing options for the chosen log driver. The configurable values
|
1194
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1195
|
-
Example: [`awslogs-group:aws/batch/job`]
|
1240
|
+
var : str, optional, default None
|
1241
|
+
Name of the artifact in which to store the caught exception.
|
1242
|
+
If not specified, the exception is not stored.
|
1243
|
+
print_exception : bool, default True
|
1244
|
+
Determines whether or not the exception is printed to
|
1245
|
+
stdout when caught.
|
1196
1246
|
"""
|
1197
1247
|
...
|
1198
1248
|
|
1199
1249
|
@typing.overload
|
1200
|
-
def
|
1250
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1201
1251
|
...
|
1202
1252
|
|
1203
1253
|
@typing.overload
|
1204
|
-
def
|
1254
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1205
1255
|
...
|
1206
1256
|
|
1207
|
-
def
|
1257
|
+
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):
|
1208
1258
|
"""
|
1209
|
-
Specifies that
|
1259
|
+
Specifies that the step will success under all circumstances.
|
1260
|
+
|
1261
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1262
|
+
contains the exception raised. You can use it to detect the presence
|
1263
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1264
|
+
are missing.
|
1210
1265
|
|
1211
1266
|
Parameters
|
1212
1267
|
----------
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1268
|
+
var : str, optional, default None
|
1269
|
+
Name of the artifact in which to store the caught exception.
|
1270
|
+
If not specified, the exception is not stored.
|
1271
|
+
print_exception : bool, default True
|
1272
|
+
Determines whether or not the exception is printed to
|
1273
|
+
stdout when caught.
|
1274
|
+
"""
|
1275
|
+
...
|
1276
|
+
|
1277
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1278
|
+
"""
|
1279
|
+
Specifies that this step should execute on Kubernetes.
|
1280
|
+
|
1281
|
+
Parameters
|
1282
|
+
----------
|
1283
|
+
cpu : int, default 1
|
1284
|
+
Number of CPUs 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
|
+
disk : int, default 10240
|
1291
|
+
Disk size (in MB) required for this step. If
|
1292
|
+
`@resources` is also present, the maximum value from all decorators is
|
1222
1293
|
used.
|
1223
1294
|
image : str, optional, default None
|
1224
|
-
Docker image to use when launching on
|
1225
|
-
|
1295
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
1296
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1226
1297
|
not, a default Docker image mapping to the current version of Python is used.
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
1246
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
1298
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1299
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1300
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1301
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
1302
|
+
secrets : List[str], optional, default None
|
1303
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1304
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1305
|
+
in Metaflow configuration.
|
1306
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1307
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
1308
|
+
gpu : int, optional, default None
|
1309
|
+
Number of GPUs required for this step. A value of zero implies that
|
1310
|
+
the scheduled node should not have GPUs.
|
1311
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1312
|
+
The vendor of the GPUs to be used for this step.
|
1313
|
+
tolerations : List[str], default []
|
1314
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1315
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1247
1316
|
use_tmpfs : bool, default False
|
1248
|
-
This enables an explicit tmpfs mount for this step.
|
1249
|
-
not available on Fargate compute environments
|
1317
|
+
This enables an explicit tmpfs mount for this step.
|
1250
1318
|
tmpfs_tempdir : bool, default True
|
1251
1319
|
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1252
|
-
tmpfs_size : int, optional, default None
|
1320
|
+
tmpfs_size : int, optional, default: None
|
1253
1321
|
The value for the size (in MiB) of the tmpfs mount for this step.
|
1254
1322
|
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1255
1323
|
memory allocated for this step.
|
1256
|
-
tmpfs_path : str, optional, default
|
1257
|
-
Path to tmpfs mount for this step.
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
The log driver to use for the Amazon ECS container.
|
1269
|
-
log_options: List[str], optional, default None
|
1270
|
-
List of strings containing options for the chosen log driver. The configurable values
|
1271
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1272
|
-
Example: [`awslogs-group:aws/batch/job`]
|
1324
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
1325
|
+
Path to tmpfs mount for this step.
|
1326
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
1327
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1328
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1329
|
+
shared_memory: int, optional
|
1330
|
+
Shared memory size (in MiB) required for this step
|
1331
|
+
port: int, optional
|
1332
|
+
Port number to specify in the Kubernetes job object
|
1333
|
+
compute_pool : str, optional, default None
|
1334
|
+
Compute pool to be used for for this step.
|
1335
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
1273
1336
|
"""
|
1274
1337
|
...
|
1275
1338
|
|
1276
1339
|
@typing.overload
|
1277
|
-
def
|
1340
|
+
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]]]:
|
1278
1341
|
"""
|
1279
|
-
Specifies the
|
1342
|
+
Specifies the Conda environment for the step.
|
1280
1343
|
|
1281
1344
|
Information in this decorator will augment any
|
1282
|
-
attributes set in the `@
|
1283
|
-
you can use `@
|
1284
|
-
steps and use `@
|
1345
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1346
|
+
you can use `@conda_base` to set packages required by all
|
1347
|
+
steps and use `@conda` to specify step-specific overrides.
|
1285
1348
|
|
1286
1349
|
Parameters
|
1287
1350
|
----------
|
1288
|
-
packages : Dict[str, str], default
|
1351
|
+
packages : Dict[str, str], default {}
|
1289
1352
|
Packages to use for this step. The key is the name of the package
|
1290
1353
|
and the value is the version to use.
|
1291
|
-
|
1354
|
+
libraries : Dict[str, str], default {}
|
1355
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1356
|
+
python : str, optional, default None
|
1292
1357
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1293
1358
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1359
|
+
disabled : bool, default False
|
1360
|
+
If set to True, disables @conda.
|
1294
1361
|
"""
|
1295
1362
|
...
|
1296
1363
|
|
1297
1364
|
@typing.overload
|
1298
|
-
def
|
1365
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1299
1366
|
...
|
1300
1367
|
|
1301
1368
|
@typing.overload
|
1302
|
-
def
|
1369
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1303
1370
|
...
|
1304
1371
|
|
1305
|
-
def
|
1372
|
+
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):
|
1306
1373
|
"""
|
1307
|
-
Specifies the
|
1374
|
+
Specifies the Conda environment for the step.
|
1308
1375
|
|
1309
1376
|
Information in this decorator will augment any
|
1310
|
-
attributes set in the `@
|
1311
|
-
you can use `@
|
1312
|
-
steps and use `@
|
1377
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1378
|
+
you can use `@conda_base` to set packages required by all
|
1379
|
+
steps and use `@conda` to specify step-specific overrides.
|
1313
1380
|
|
1314
1381
|
Parameters
|
1315
1382
|
----------
|
1316
|
-
packages : Dict[str, str], default
|
1383
|
+
packages : Dict[str, str], default {}
|
1317
1384
|
Packages to use for this step. The key is the name of the package
|
1318
1385
|
and the value is the version to use.
|
1319
|
-
|
1386
|
+
libraries : Dict[str, str], default {}
|
1387
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1388
|
+
python : str, optional, default None
|
1320
1389
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1321
1390
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1391
|
+
disabled : bool, default False
|
1392
|
+
If set to True, disables @conda.
|
1322
1393
|
"""
|
1323
1394
|
...
|
1324
1395
|
|
1325
1396
|
@typing.overload
|
1326
|
-
def
|
1397
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1327
1398
|
"""
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
Parameters
|
1332
|
-
----------
|
1333
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
1334
|
-
List of secret specs, defining how the secrets are to be retrieved
|
1399
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1400
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1335
1401
|
"""
|
1336
1402
|
...
|
1337
1403
|
|
1338
1404
|
@typing.overload
|
1339
|
-
def
|
1405
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1340
1406
|
...
|
1341
1407
|
|
1342
|
-
|
1343
|
-
|
1408
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1409
|
+
"""
|
1410
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1411
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1412
|
+
"""
|
1344
1413
|
...
|
1345
1414
|
|
1346
|
-
def
|
1415
|
+
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]]:
|
1347
1416
|
"""
|
1348
|
-
|
1349
|
-
|
1417
|
+
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.
|
1418
|
+
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.
|
1350
1419
|
|
1351
1420
|
Parameters
|
1352
1421
|
----------
|
1353
|
-
|
1354
|
-
|
1422
|
+
timeout : int
|
1423
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1424
|
+
poke_interval : int
|
1425
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1426
|
+
mode : str
|
1427
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1428
|
+
exponential_backoff : bool
|
1429
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1430
|
+
pool : str
|
1431
|
+
the slot pool this task should run in,
|
1432
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1433
|
+
soft_fail : bool
|
1434
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1435
|
+
name : str
|
1436
|
+
Name of the sensor on Airflow
|
1437
|
+
description : str
|
1438
|
+
Description of sensor in the Airflow UI
|
1439
|
+
external_dag_id : str
|
1440
|
+
The dag_id that contains the task you want to wait for.
|
1441
|
+
external_task_ids : List[str]
|
1442
|
+
The list of task_ids that you want to wait for.
|
1443
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1444
|
+
allowed_states : List[str]
|
1445
|
+
Iterable of allowed states, (Default: ['success'])
|
1446
|
+
failed_states : List[str]
|
1447
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1448
|
+
execution_delta : datetime.timedelta
|
1449
|
+
time difference with the previous execution to look at,
|
1450
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1451
|
+
check_existence: bool
|
1452
|
+
Set to True to check if the external task exists or check if
|
1453
|
+
the DAG to wait for exists. (Default: True)
|
1355
1454
|
"""
|
1356
1455
|
...
|
1357
1456
|
|
1358
1457
|
@typing.overload
|
1359
|
-
def
|
1458
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1360
1459
|
"""
|
1361
|
-
Specifies the
|
1460
|
+
Specifies the PyPI packages for all steps of the flow.
|
1362
1461
|
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1462
|
+
Use `@pypi_base` to set common packages required by all
|
1463
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1464
|
+
Parameters
|
1465
|
+
----------
|
1466
|
+
packages : Dict[str, str], default: {}
|
1467
|
+
Packages to use for this flow. The key is the name of the package
|
1468
|
+
and the value is the version to use.
|
1469
|
+
python : str, optional, default: None
|
1470
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1471
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1472
|
+
"""
|
1473
|
+
...
|
1474
|
+
|
1475
|
+
@typing.overload
|
1476
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1477
|
+
...
|
1478
|
+
|
1479
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1480
|
+
"""
|
1481
|
+
Specifies the PyPI packages for all steps of the flow.
|
1367
1482
|
|
1483
|
+
Use `@pypi_base` to set common packages required by all
|
1484
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1368
1485
|
Parameters
|
1369
1486
|
----------
|
1370
|
-
packages : Dict[str, str], default {}
|
1371
|
-
Packages to use for this
|
1487
|
+
packages : Dict[str, str], default: {}
|
1488
|
+
Packages to use for this flow. The key is the name of the package
|
1372
1489
|
and the value is the version to use.
|
1373
|
-
|
1374
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1375
|
-
python : str, optional, default None
|
1490
|
+
python : str, optional, default: None
|
1376
1491
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1377
1492
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1378
|
-
|
1379
|
-
|
1493
|
+
"""
|
1494
|
+
...
|
1495
|
+
|
1496
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1497
|
+
"""
|
1498
|
+
Specifies what flows belong to the same project.
|
1499
|
+
|
1500
|
+
A project-specific namespace is created for all flows that
|
1501
|
+
use the same `@project(name)`.
|
1502
|
+
|
1503
|
+
Parameters
|
1504
|
+
----------
|
1505
|
+
name : str
|
1506
|
+
Project name. Make sure that the name is unique amongst all
|
1507
|
+
projects that use the same production scheduler. The name may
|
1508
|
+
contain only lowercase alphanumeric characters and underscores.
|
1509
|
+
|
1510
|
+
|
1380
1511
|
"""
|
1381
1512
|
...
|
1382
1513
|
|
1383
1514
|
@typing.overload
|
1384
|
-
def
|
1515
|
+
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]]:
|
1516
|
+
"""
|
1517
|
+
Specifies the event(s) that this flow depends on.
|
1518
|
+
|
1519
|
+
```
|
1520
|
+
@trigger(event='foo')
|
1521
|
+
```
|
1522
|
+
or
|
1523
|
+
```
|
1524
|
+
@trigger(events=['foo', 'bar'])
|
1525
|
+
```
|
1526
|
+
|
1527
|
+
Additionally, you can specify the parameter mappings
|
1528
|
+
to map event payload to Metaflow parameters for the flow.
|
1529
|
+
```
|
1530
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1531
|
+
```
|
1532
|
+
or
|
1533
|
+
```
|
1534
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1535
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1536
|
+
```
|
1537
|
+
|
1538
|
+
'parameters' can also be a list of strings and tuples like so:
|
1539
|
+
```
|
1540
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1541
|
+
```
|
1542
|
+
This is equivalent to:
|
1543
|
+
```
|
1544
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1545
|
+
```
|
1546
|
+
|
1547
|
+
Parameters
|
1548
|
+
----------
|
1549
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1550
|
+
Event dependency for this flow.
|
1551
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1552
|
+
Events dependency for this flow.
|
1553
|
+
options : Dict[str, Any], default {}
|
1554
|
+
Backend-specific configuration for tuning eventing behavior.
|
1555
|
+
|
1556
|
+
|
1557
|
+
"""
|
1385
1558
|
...
|
1386
1559
|
|
1387
1560
|
@typing.overload
|
1388
|
-
def
|
1561
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1389
1562
|
...
|
1390
1563
|
|
1391
|
-
def
|
1564
|
+
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1392
1565
|
"""
|
1393
|
-
Specifies the
|
1566
|
+
Specifies the event(s) that this flow depends on.
|
1567
|
+
|
1568
|
+
```
|
1569
|
+
@trigger(event='foo')
|
1570
|
+
```
|
1571
|
+
or
|
1572
|
+
```
|
1573
|
+
@trigger(events=['foo', 'bar'])
|
1574
|
+
```
|
1575
|
+
|
1576
|
+
Additionally, you can specify the parameter mappings
|
1577
|
+
to map event payload to Metaflow parameters for the flow.
|
1578
|
+
```
|
1579
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1580
|
+
```
|
1581
|
+
or
|
1582
|
+
```
|
1583
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1584
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1585
|
+
```
|
1586
|
+
|
1587
|
+
'parameters' can also be a list of strings and tuples like so:
|
1588
|
+
```
|
1589
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1590
|
+
```
|
1591
|
+
This is equivalent to:
|
1592
|
+
```
|
1593
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1594
|
+
```
|
1595
|
+
|
1596
|
+
Parameters
|
1597
|
+
----------
|
1598
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1599
|
+
Event dependency for this flow.
|
1600
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1601
|
+
Events dependency for this flow.
|
1602
|
+
options : Dict[str, Any], default {}
|
1603
|
+
Backend-specific configuration for tuning eventing behavior.
|
1394
1604
|
|
1395
|
-
Information in this decorator will augment any
|
1396
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1397
|
-
you can use `@conda_base` to set packages required by all
|
1398
|
-
steps and use `@conda` to specify step-specific overrides.
|
1399
1605
|
|
1400
|
-
Parameters
|
1401
|
-
----------
|
1402
|
-
packages : Dict[str, str], default {}
|
1403
|
-
Packages to use for this step. The key is the name of the package
|
1404
|
-
and the value is the version to use.
|
1405
|
-
libraries : Dict[str, str], default {}
|
1406
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1407
|
-
python : str, optional, default None
|
1408
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1409
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1410
|
-
disabled : bool, default False
|
1411
|
-
If set to True, disables @conda.
|
1412
1606
|
"""
|
1413
1607
|
...
|
1414
1608
|
|
@@ -1564,210 +1758,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1564
1758
|
"""
|
1565
1759
|
...
|
1566
1760
|
|
1567
|
-
@typing.overload
|
1568
|
-
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]]:
|
1569
|
-
"""
|
1570
|
-
Specifies the Conda environment for all steps of the flow.
|
1571
|
-
|
1572
|
-
Use `@conda_base` to set common libraries required by all
|
1573
|
-
steps and use `@conda` to specify step-specific additions.
|
1574
|
-
|
1575
|
-
Parameters
|
1576
|
-
----------
|
1577
|
-
packages : Dict[str, str], default {}
|
1578
|
-
Packages to use for this flow. The key is the name of the package
|
1579
|
-
and the value is the version to use.
|
1580
|
-
libraries : Dict[str, str], default {}
|
1581
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1582
|
-
python : str, optional, default None
|
1583
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1584
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1585
|
-
disabled : bool, default False
|
1586
|
-
If set to True, disables Conda.
|
1587
|
-
"""
|
1588
|
-
...
|
1589
|
-
|
1590
|
-
@typing.overload
|
1591
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1592
|
-
...
|
1593
|
-
|
1594
|
-
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):
|
1595
|
-
"""
|
1596
|
-
Specifies the Conda environment for all steps of the flow.
|
1597
|
-
|
1598
|
-
Use `@conda_base` to set common libraries required by all
|
1599
|
-
steps and use `@conda` to specify step-specific additions.
|
1600
|
-
|
1601
|
-
Parameters
|
1602
|
-
----------
|
1603
|
-
packages : Dict[str, str], default {}
|
1604
|
-
Packages to use for this flow. The key is the name of the package
|
1605
|
-
and the value is the version to use.
|
1606
|
-
libraries : Dict[str, str], default {}
|
1607
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1608
|
-
python : str, optional, default None
|
1609
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1610
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1611
|
-
disabled : bool, default False
|
1612
|
-
If set to True, disables Conda.
|
1613
|
-
"""
|
1614
|
-
...
|
1615
|
-
|
1616
|
-
@typing.overload
|
1617
|
-
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]]:
|
1618
|
-
"""
|
1619
|
-
Specifies the event(s) that this flow depends on.
|
1620
|
-
|
1621
|
-
```
|
1622
|
-
@trigger(event='foo')
|
1623
|
-
```
|
1624
|
-
or
|
1625
|
-
```
|
1626
|
-
@trigger(events=['foo', 'bar'])
|
1627
|
-
```
|
1628
|
-
|
1629
|
-
Additionally, you can specify the parameter mappings
|
1630
|
-
to map event payload to Metaflow parameters for the flow.
|
1631
|
-
```
|
1632
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1633
|
-
```
|
1634
|
-
or
|
1635
|
-
```
|
1636
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1637
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1638
|
-
```
|
1639
|
-
|
1640
|
-
'parameters' can also be a list of strings and tuples like so:
|
1641
|
-
```
|
1642
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1643
|
-
```
|
1644
|
-
This is equivalent to:
|
1645
|
-
```
|
1646
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1647
|
-
```
|
1648
|
-
|
1649
|
-
Parameters
|
1650
|
-
----------
|
1651
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1652
|
-
Event dependency for this flow.
|
1653
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1654
|
-
Events dependency for this flow.
|
1655
|
-
options : Dict[str, Any], default {}
|
1656
|
-
Backend-specific configuration for tuning eventing behavior.
|
1657
|
-
|
1658
|
-
|
1659
|
-
"""
|
1660
|
-
...
|
1661
|
-
|
1662
|
-
@typing.overload
|
1663
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1664
|
-
...
|
1665
|
-
|
1666
|
-
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1667
|
-
"""
|
1668
|
-
Specifies the event(s) that this flow depends on.
|
1669
|
-
|
1670
|
-
```
|
1671
|
-
@trigger(event='foo')
|
1672
|
-
```
|
1673
|
-
or
|
1674
|
-
```
|
1675
|
-
@trigger(events=['foo', 'bar'])
|
1676
|
-
```
|
1677
|
-
|
1678
|
-
Additionally, you can specify the parameter mappings
|
1679
|
-
to map event payload to Metaflow parameters for the flow.
|
1680
|
-
```
|
1681
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1682
|
-
```
|
1683
|
-
or
|
1684
|
-
```
|
1685
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1686
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1687
|
-
```
|
1688
|
-
|
1689
|
-
'parameters' can also be a list of strings and tuples like so:
|
1690
|
-
```
|
1691
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1692
|
-
```
|
1693
|
-
This is equivalent to:
|
1694
|
-
```
|
1695
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1696
|
-
```
|
1697
|
-
|
1698
|
-
Parameters
|
1699
|
-
----------
|
1700
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1701
|
-
Event dependency for this flow.
|
1702
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1703
|
-
Events dependency for this flow.
|
1704
|
-
options : Dict[str, Any], default {}
|
1705
|
-
Backend-specific configuration for tuning eventing behavior.
|
1706
|
-
|
1707
|
-
|
1708
|
-
"""
|
1709
|
-
...
|
1710
|
-
|
1711
|
-
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]]:
|
1712
|
-
"""
|
1713
|
-
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.
|
1714
|
-
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.
|
1715
|
-
|
1716
|
-
Parameters
|
1717
|
-
----------
|
1718
|
-
timeout : int
|
1719
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1720
|
-
poke_interval : int
|
1721
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1722
|
-
mode : str
|
1723
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1724
|
-
exponential_backoff : bool
|
1725
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1726
|
-
pool : str
|
1727
|
-
the slot pool this task should run in,
|
1728
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1729
|
-
soft_fail : bool
|
1730
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1731
|
-
name : str
|
1732
|
-
Name of the sensor on Airflow
|
1733
|
-
description : str
|
1734
|
-
Description of sensor in the Airflow UI
|
1735
|
-
external_dag_id : str
|
1736
|
-
The dag_id that contains the task you want to wait for.
|
1737
|
-
external_task_ids : List[str]
|
1738
|
-
The list of task_ids that you want to wait for.
|
1739
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1740
|
-
allowed_states : List[str]
|
1741
|
-
Iterable of allowed states, (Default: ['success'])
|
1742
|
-
failed_states : List[str]
|
1743
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1744
|
-
execution_delta : datetime.timedelta
|
1745
|
-
time difference with the previous execution to look at,
|
1746
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1747
|
-
check_existence: bool
|
1748
|
-
Set to True to check if the external task exists or check if
|
1749
|
-
the DAG to wait for exists. (Default: True)
|
1750
|
-
"""
|
1751
|
-
...
|
1752
|
-
|
1753
|
-
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1754
|
-
"""
|
1755
|
-
Specifies what flows belong to the same project.
|
1756
|
-
|
1757
|
-
A project-specific namespace is created for all flows that
|
1758
|
-
use the same `@project(name)`.
|
1759
|
-
|
1760
|
-
Parameters
|
1761
|
-
----------
|
1762
|
-
name : str
|
1763
|
-
Project name. Make sure that the name is unique amongst all
|
1764
|
-
projects that use the same production scheduler. The name may
|
1765
|
-
contain only lowercase alphanumeric characters and underscores.
|
1766
|
-
|
1767
|
-
|
1768
|
-
"""
|
1769
|
-
...
|
1770
|
-
|
1771
1761
|
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]]:
|
1772
1762
|
"""
|
1773
1763
|
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)
|
@@ -1811,41 +1801,51 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1811
1801
|
...
|
1812
1802
|
|
1813
1803
|
@typing.overload
|
1814
|
-
def
|
1804
|
+
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]]:
|
1815
1805
|
"""
|
1816
|
-
Specifies the
|
1806
|
+
Specifies the Conda environment for all steps of the flow.
|
1807
|
+
|
1808
|
+
Use `@conda_base` to set common libraries required by all
|
1809
|
+
steps and use `@conda` to specify step-specific additions.
|
1817
1810
|
|
1818
|
-
Use `@pypi_base` to set common packages required by all
|
1819
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1820
1811
|
Parameters
|
1821
1812
|
----------
|
1822
|
-
packages : Dict[str, str], default
|
1813
|
+
packages : Dict[str, str], default {}
|
1823
1814
|
Packages to use for this flow. The key is the name of the package
|
1824
1815
|
and the value is the version to use.
|
1825
|
-
|
1816
|
+
libraries : Dict[str, str], default {}
|
1817
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1818
|
+
python : str, optional, default None
|
1826
1819
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1827
1820
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1821
|
+
disabled : bool, default False
|
1822
|
+
If set to True, disables Conda.
|
1828
1823
|
"""
|
1829
1824
|
...
|
1830
1825
|
|
1831
1826
|
@typing.overload
|
1832
|
-
def
|
1827
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1833
1828
|
...
|
1834
1829
|
|
1835
|
-
def
|
1830
|
+
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):
|
1836
1831
|
"""
|
1837
|
-
Specifies the
|
1832
|
+
Specifies the Conda environment for all steps of the flow.
|
1833
|
+
|
1834
|
+
Use `@conda_base` to set common libraries required by all
|
1835
|
+
steps and use `@conda` to specify step-specific additions.
|
1838
1836
|
|
1839
|
-
Use `@pypi_base` to set common packages required by all
|
1840
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1841
1837
|
Parameters
|
1842
1838
|
----------
|
1843
|
-
packages : Dict[str, str], default
|
1839
|
+
packages : Dict[str, str], default {}
|
1844
1840
|
Packages to use for this flow. The key is the name of the package
|
1845
1841
|
and the value is the version to use.
|
1846
|
-
|
1842
|
+
libraries : Dict[str, str], default {}
|
1843
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1844
|
+
python : str, optional, default None
|
1847
1845
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1848
1846
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1847
|
+
disabled : bool, default False
|
1848
|
+
If set to True, disables Conda.
|
1849
1849
|
"""
|
1850
1850
|
...
|
1851
1851
|
|