metaflow-stubs 2.12.23__py2.py3-none-any.whl → 2.12.24__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 +615 -615
- 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 +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +5 -5
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata/metadata.pyi +2 -2
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +6 -6
- 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 +3 -3
- metaflow-stubs/plugins/airflow/airflow_cli.pyi +3 -3
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +4 -4
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +4 -4
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +6 -4
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +7 -7
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +7 -7
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
- 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 +3 -3
- 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 +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +3 -3
- 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 +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +3 -3
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/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/kube_utils.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 +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/tag_cli.pyi +5 -5
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/procpoll.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/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 +2 -2
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.12.23.dist-info → metaflow_stubs-2.12.24.dist-info}/METADATA +2 -2
- metaflow_stubs-2.12.24.dist-info/RECORD +152 -0
- metaflow_stubs-2.12.23.dist-info/RECORD +0 -152
- {metaflow_stubs-2.12.23.dist-info → metaflow_stubs-2.12.24.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.12.23.dist-info → metaflow_stubs-2.12.24.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-10-
|
3
|
+
# MF version: 2.12.24 #
|
4
|
+
# Generated on 2024-10-04T11:37:46.949506 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import metaflow.
|
12
|
-
import metaflow.events
|
11
|
+
import metaflow.metaflow_current
|
13
12
|
import metaflow._vendor.click.types
|
14
|
-
import io
|
15
|
-
import datetime
|
16
|
-
import metaflow.parameters
|
17
|
-
import metaflow.runner.metaflow_runner
|
18
13
|
import metaflow.datastore.inputs
|
19
|
-
import metaflow.metaflow_current
|
20
14
|
import metaflow.client.core
|
21
|
-
import metaflow.flowspec
|
22
15
|
import typing
|
16
|
+
import metaflow.events
|
17
|
+
import metaflow.parameters
|
18
|
+
import metaflow.flowspec
|
19
|
+
import metaflow.plugins.datatools.s3.s3
|
20
|
+
import io
|
21
|
+
import datetime
|
22
|
+
import metaflow.runner.metaflow_runner
|
23
23
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
24
24
|
StepFlag = typing.NewType("StepFlag", bool)
|
25
25
|
|
@@ -855,149 +855,79 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
855
855
|
...
|
856
856
|
|
857
857
|
@typing.overload
|
858
|
-
def
|
858
|
+
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]]]:
|
859
859
|
"""
|
860
|
-
Specifies
|
860
|
+
Specifies the resources needed when executing this step.
|
861
|
+
|
862
|
+
Use `@resources` to specify the resource requirements
|
863
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
864
|
+
|
865
|
+
You can choose the compute layer on the command line by executing e.g.
|
866
|
+
```
|
867
|
+
python myflow.py run --with batch
|
868
|
+
```
|
869
|
+
or
|
870
|
+
```
|
871
|
+
python myflow.py run --with kubernetes
|
872
|
+
```
|
873
|
+
which executes the flow on the desired system using the
|
874
|
+
requirements specified in `@resources`.
|
861
875
|
|
862
876
|
Parameters
|
863
877
|
----------
|
864
878
|
cpu : int, default 1
|
865
|
-
Number of CPUs required for this step.
|
866
|
-
also present, the maximum value from all decorators is used.
|
879
|
+
Number of CPUs required for this step.
|
867
880
|
gpu : int, default 0
|
868
|
-
Number of GPUs required for this step.
|
869
|
-
|
881
|
+
Number of GPUs required for this step.
|
882
|
+
disk : int, optional, default None
|
883
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
870
884
|
memory : int, default 4096
|
871
|
-
Memory size (in MB) required for this step.
|
872
|
-
`@resources` is also present, the maximum value from all decorators is
|
873
|
-
used.
|
874
|
-
image : str, optional, default None
|
875
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
876
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
877
|
-
not, a default Docker image mapping to the current version of Python is used.
|
878
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
879
|
-
AWS Batch Job Queue to submit the job to.
|
880
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
881
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
882
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
883
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
884
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
885
|
+
Memory size (in MB) required for this step.
|
885
886
|
shared_memory : int, optional, default None
|
886
887
|
The value for the size (in MiB) of the /dev/shm volume for this step.
|
887
888
|
This parameter maps to the `--shm-size` option in Docker.
|
888
|
-
max_swap : int, optional, default None
|
889
|
-
The total amount of swap memory (in MiB) a container can use for this
|
890
|
-
step. This parameter is translated to the `--memory-swap` option in
|
891
|
-
Docker where the value is the sum of the container memory plus the
|
892
|
-
`max_swap` value.
|
893
|
-
swappiness : int, optional, default None
|
894
|
-
This allows you to tune memory swappiness behavior for this step.
|
895
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
896
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
897
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
898
|
-
use_tmpfs : bool, default False
|
899
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
900
|
-
not available on Fargate compute environments
|
901
|
-
tmpfs_tempdir : bool, default True
|
902
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
903
|
-
tmpfs_size : int, optional, default None
|
904
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
905
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
906
|
-
memory allocated for this step.
|
907
|
-
tmpfs_path : str, optional, default None
|
908
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
909
|
-
inferentia : int, default 0
|
910
|
-
Number of Inferentia chips required for this step.
|
911
|
-
trainium : int, default None
|
912
|
-
Alias for inferentia. Use only one of the two.
|
913
|
-
efa : int, default 0
|
914
|
-
Number of elastic fabric adapter network devices to attach to container
|
915
|
-
ephemeral_storage : int, default None
|
916
|
-
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
917
|
-
This is only relevant for Fargate compute environments
|
918
|
-
log_driver: str, optional, default None
|
919
|
-
The log driver to use for the Amazon ECS container.
|
920
|
-
log_options: List[str], optional, default None
|
921
|
-
List of strings containing options for the chosen log driver. The configurable values
|
922
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
923
|
-
Example: [`awslogs-group:aws/batch/job`]
|
924
889
|
"""
|
925
890
|
...
|
926
891
|
|
927
892
|
@typing.overload
|
928
|
-
def
|
893
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
929
894
|
...
|
930
895
|
|
931
896
|
@typing.overload
|
932
|
-
def
|
897
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
933
898
|
...
|
934
899
|
|
935
|
-
def
|
900
|
+
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):
|
936
901
|
"""
|
937
|
-
Specifies
|
902
|
+
Specifies the resources needed when executing this step.
|
903
|
+
|
904
|
+
Use `@resources` to specify the resource requirements
|
905
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
906
|
+
|
907
|
+
You can choose the compute layer on the command line by executing e.g.
|
908
|
+
```
|
909
|
+
python myflow.py run --with batch
|
910
|
+
```
|
911
|
+
or
|
912
|
+
```
|
913
|
+
python myflow.py run --with kubernetes
|
914
|
+
```
|
915
|
+
which executes the flow on the desired system using the
|
916
|
+
requirements specified in `@resources`.
|
938
917
|
|
939
918
|
Parameters
|
940
919
|
----------
|
941
920
|
cpu : int, default 1
|
942
|
-
Number of CPUs required for this step.
|
943
|
-
also present, the maximum value from all decorators is used.
|
921
|
+
Number of CPUs required for this step.
|
944
922
|
gpu : int, default 0
|
945
|
-
Number of GPUs required for this step.
|
946
|
-
|
923
|
+
Number of GPUs required for this step.
|
924
|
+
disk : int, optional, default None
|
925
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
947
926
|
memory : int, default 4096
|
948
|
-
Memory size (in MB) required for this step.
|
949
|
-
`@resources` is also present, the maximum value from all decorators is
|
950
|
-
used.
|
951
|
-
image : str, optional, default None
|
952
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
953
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
954
|
-
not, a default Docker image mapping to the current version of Python is used.
|
955
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
956
|
-
AWS Batch Job Queue to submit the job to.
|
957
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
958
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
959
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
960
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
961
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
927
|
+
Memory size (in MB) required for this step.
|
962
928
|
shared_memory : int, optional, default None
|
963
929
|
The value for the size (in MiB) of the /dev/shm volume for this step.
|
964
930
|
This parameter maps to the `--shm-size` option in Docker.
|
965
|
-
max_swap : int, optional, default None
|
966
|
-
The total amount of swap memory (in MiB) a container can use for this
|
967
|
-
step. This parameter is translated to the `--memory-swap` option in
|
968
|
-
Docker where the value is the sum of the container memory plus the
|
969
|
-
`max_swap` value.
|
970
|
-
swappiness : int, optional, default None
|
971
|
-
This allows you to tune memory swappiness behavior for this step.
|
972
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
973
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
974
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
975
|
-
use_tmpfs : bool, default False
|
976
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
977
|
-
not available on Fargate compute environments
|
978
|
-
tmpfs_tempdir : bool, default True
|
979
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
980
|
-
tmpfs_size : int, optional, default None
|
981
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
982
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
983
|
-
memory allocated for this step.
|
984
|
-
tmpfs_path : str, optional, default None
|
985
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
986
|
-
inferentia : int, default 0
|
987
|
-
Number of Inferentia chips required for this step.
|
988
|
-
trainium : int, default None
|
989
|
-
Alias for inferentia. Use only one of the two.
|
990
|
-
efa : int, default 0
|
991
|
-
Number of elastic fabric adapter network devices to attach to container
|
992
|
-
ephemeral_storage : int, default None
|
993
|
-
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
994
|
-
This is only relevant for Fargate compute environments
|
995
|
-
log_driver: str, optional, default None
|
996
|
-
The log driver to use for the Amazon ECS container.
|
997
|
-
log_options: List[str], optional, default None
|
998
|
-
List of strings containing options for the chosen log driver. The configurable values
|
999
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1000
|
-
Example: [`awslogs-group:aws/batch/job`]
|
1001
931
|
"""
|
1002
932
|
...
|
1003
933
|
|
@@ -1059,454 +989,405 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
1059
989
|
...
|
1060
990
|
|
1061
991
|
@typing.overload
|
1062
|
-
def
|
992
|
+
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]]]:
|
1063
993
|
"""
|
1064
|
-
Specifies
|
1065
|
-
|
1066
|
-
Information in this decorator will augment any
|
1067
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1068
|
-
you can use `@pypi_base` to set packages required by all
|
1069
|
-
steps and use `@pypi` to specify step-specific overrides.
|
994
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1070
995
|
|
1071
996
|
Parameters
|
1072
997
|
----------
|
1073
|
-
|
1074
|
-
|
1075
|
-
and the value is the version to use.
|
1076
|
-
python : str, optional, default: None
|
1077
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1078
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
998
|
+
vars : Dict[str, str], default {}
|
999
|
+
Dictionary of environment variables to set.
|
1079
1000
|
"""
|
1080
1001
|
...
|
1081
1002
|
|
1082
1003
|
@typing.overload
|
1083
|
-
def
|
1004
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1084
1005
|
...
|
1085
1006
|
|
1086
1007
|
@typing.overload
|
1087
|
-
def
|
1008
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1088
1009
|
...
|
1089
1010
|
|
1090
|
-
def
|
1011
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1091
1012
|
"""
|
1092
|
-
Specifies
|
1093
|
-
|
1094
|
-
Information in this decorator will augment any
|
1095
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1096
|
-
you can use `@pypi_base` to set packages required by all
|
1097
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1013
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1098
1014
|
|
1099
1015
|
Parameters
|
1100
1016
|
----------
|
1101
|
-
|
1102
|
-
|
1103
|
-
and the value is the version to use.
|
1104
|
-
python : str, optional, default: None
|
1105
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1106
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1017
|
+
vars : Dict[str, str], default {}
|
1018
|
+
Dictionary of environment variables to set.
|
1107
1019
|
"""
|
1108
1020
|
...
|
1109
1021
|
|
1110
1022
|
@typing.overload
|
1111
|
-
def
|
1023
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1112
1024
|
"""
|
1113
|
-
|
1114
|
-
|
1115
|
-
Parameters
|
1116
|
-
----------
|
1117
|
-
vars : Dict[str, str], default {}
|
1118
|
-
Dictionary of environment variables to set.
|
1025
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1026
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1119
1027
|
"""
|
1120
1028
|
...
|
1121
1029
|
|
1122
1030
|
@typing.overload
|
1123
|
-
def
|
1031
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1124
1032
|
...
|
1125
1033
|
|
1126
|
-
|
1127
|
-
|
1034
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1035
|
+
"""
|
1036
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1037
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1038
|
+
"""
|
1128
1039
|
...
|
1129
1040
|
|
1130
|
-
|
1041
|
+
@typing.overload
|
1042
|
+
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
1043
|
"""
|
1132
|
-
Specifies
|
1044
|
+
Specifies that the step will success under all circumstances.
|
1045
|
+
|
1046
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1047
|
+
contains the exception raised. You can use it to detect the presence
|
1048
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1049
|
+
are missing.
|
1133
1050
|
|
1134
1051
|
Parameters
|
1135
1052
|
----------
|
1136
|
-
|
1137
|
-
|
1053
|
+
var : str, optional, default None
|
1054
|
+
Name of the artifact in which to store the caught exception.
|
1055
|
+
If not specified, the exception is not stored.
|
1056
|
+
print_exception : bool, default True
|
1057
|
+
Determines whether or not the exception is printed to
|
1058
|
+
stdout when caught.
|
1138
1059
|
"""
|
1139
1060
|
...
|
1140
1061
|
|
1141
1062
|
@typing.overload
|
1142
|
-
def
|
1143
|
-
"""
|
1144
|
-
Specifies the resources needed when executing this step.
|
1145
|
-
|
1146
|
-
Use `@resources` to specify the resource requirements
|
1147
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1148
|
-
|
1149
|
-
You can choose the compute layer on the command line by executing e.g.
|
1150
|
-
```
|
1151
|
-
python myflow.py run --with batch
|
1152
|
-
```
|
1153
|
-
or
|
1154
|
-
```
|
1155
|
-
python myflow.py run --with kubernetes
|
1156
|
-
```
|
1157
|
-
which executes the flow on the desired system using the
|
1158
|
-
requirements specified in `@resources`.
|
1159
|
-
|
1160
|
-
Parameters
|
1161
|
-
----------
|
1162
|
-
cpu : int, default 1
|
1163
|
-
Number of CPUs required for this step.
|
1164
|
-
gpu : int, default 0
|
1165
|
-
Number of GPUs required for this step.
|
1166
|
-
disk : int, optional, default None
|
1167
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1168
|
-
memory : int, default 4096
|
1169
|
-
Memory size (in MB) required for this step.
|
1170
|
-
shared_memory : int, optional, default None
|
1171
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1172
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1173
|
-
"""
|
1063
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1174
1064
|
...
|
1175
1065
|
|
1176
1066
|
@typing.overload
|
1177
|
-
def
|
1067
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1178
1068
|
...
|
1179
1069
|
|
1180
|
-
|
1181
|
-
|
1070
|
+
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):
|
1071
|
+
"""
|
1072
|
+
Specifies that the step will success under all circumstances.
|
1073
|
+
|
1074
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1075
|
+
contains the exception raised. You can use it to detect the presence
|
1076
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1077
|
+
are missing.
|
1078
|
+
|
1079
|
+
Parameters
|
1080
|
+
----------
|
1081
|
+
var : str, optional, default None
|
1082
|
+
Name of the artifact in which to store the caught exception.
|
1083
|
+
If not specified, the exception is not stored.
|
1084
|
+
print_exception : bool, default True
|
1085
|
+
Determines whether or not the exception is printed to
|
1086
|
+
stdout when caught.
|
1087
|
+
"""
|
1182
1088
|
...
|
1183
1089
|
|
1184
|
-
|
1090
|
+
@typing.overload
|
1091
|
+
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]]]:
|
1185
1092
|
"""
|
1186
|
-
|
1187
|
-
|
1188
|
-
Use `@resources` to specify the resource requirements
|
1189
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1093
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1190
1094
|
|
1191
|
-
|
1192
|
-
```
|
1193
|
-
python myflow.py run --with batch
|
1194
|
-
```
|
1195
|
-
or
|
1196
|
-
```
|
1197
|
-
python myflow.py run --with kubernetes
|
1198
|
-
```
|
1199
|
-
which executes the flow on the desired system using the
|
1200
|
-
requirements specified in `@resources`.
|
1095
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1201
1096
|
|
1202
1097
|
Parameters
|
1203
1098
|
----------
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1099
|
+
type : str, default 'default'
|
1100
|
+
Card type.
|
1101
|
+
id : str, optional, default None
|
1102
|
+
If multiple cards are present, use this id to identify this card.
|
1103
|
+
options : Dict[str, Any], default {}
|
1104
|
+
Options passed to the card. The contents depend on the card type.
|
1105
|
+
timeout : int, default 45
|
1106
|
+
Interrupt reporting if it takes more than this many seconds.
|
1107
|
+
|
1108
|
+
|
1215
1109
|
"""
|
1216
1110
|
...
|
1217
1111
|
|
1218
|
-
|
1112
|
+
@typing.overload
|
1113
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1114
|
+
...
|
1115
|
+
|
1116
|
+
@typing.overload
|
1117
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1118
|
+
...
|
1119
|
+
|
1120
|
+
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):
|
1219
1121
|
"""
|
1220
|
-
|
1122
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1123
|
+
|
1124
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1221
1125
|
|
1222
1126
|
Parameters
|
1223
1127
|
----------
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
used.
|
1235
|
-
image : str, optional, default None
|
1236
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
1237
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1238
|
-
not, a default Docker image mapping to the current version of Python is used.
|
1239
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1240
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1241
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1242
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
1243
|
-
secrets : List[str], optional, default None
|
1244
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1245
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1246
|
-
in Metaflow configuration.
|
1247
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
1248
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
1249
|
-
Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
|
1250
|
-
or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
|
1251
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1252
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
1253
|
-
gpu : int, optional, default None
|
1254
|
-
Number of GPUs required for this step. A value of zero implies that
|
1255
|
-
the scheduled node should not have GPUs.
|
1256
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1257
|
-
The vendor of the GPUs to be used for this step.
|
1258
|
-
tolerations : List[str], default []
|
1259
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1260
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1261
|
-
use_tmpfs : bool, default False
|
1262
|
-
This enables an explicit tmpfs mount for this step.
|
1263
|
-
tmpfs_tempdir : bool, default True
|
1264
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1265
|
-
tmpfs_size : int, optional, default: None
|
1266
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1267
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1268
|
-
memory allocated for this step.
|
1269
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
1270
|
-
Path to tmpfs mount for this step.
|
1271
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
1272
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1273
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1274
|
-
shared_memory: int, optional
|
1275
|
-
Shared memory size (in MiB) required for this step
|
1276
|
-
port: int, optional
|
1277
|
-
Port number to specify in the Kubernetes job object
|
1278
|
-
compute_pool : str, optional, default None
|
1279
|
-
Compute pool to be used for for this step.
|
1280
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
1128
|
+
type : str, default 'default'
|
1129
|
+
Card type.
|
1130
|
+
id : str, optional, default None
|
1131
|
+
If multiple cards are present, use this id to identify this card.
|
1132
|
+
options : Dict[str, Any], default {}
|
1133
|
+
Options passed to the card. The contents depend on the card type.
|
1134
|
+
timeout : int, default 45
|
1135
|
+
Interrupt reporting if it takes more than this many seconds.
|
1136
|
+
|
1137
|
+
|
1281
1138
|
"""
|
1282
1139
|
...
|
1283
1140
|
|
1284
1141
|
@typing.overload
|
1285
|
-
def
|
1142
|
+
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]]]:
|
1286
1143
|
"""
|
1287
|
-
Specifies the
|
1144
|
+
Specifies the PyPI packages for the step.
|
1288
1145
|
|
1289
1146
|
Information in this decorator will augment any
|
1290
|
-
attributes set in the `@
|
1291
|
-
you can use `@
|
1292
|
-
steps and use `@
|
1147
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1148
|
+
you can use `@pypi_base` to set packages required by all
|
1149
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1293
1150
|
|
1294
1151
|
Parameters
|
1295
1152
|
----------
|
1296
|
-
packages : Dict[str, str], default {}
|
1153
|
+
packages : Dict[str, str], default: {}
|
1297
1154
|
Packages to use for this step. The key is the name of the package
|
1298
1155
|
and the value is the version to use.
|
1299
|
-
|
1300
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1301
|
-
python : str, optional, default None
|
1156
|
+
python : str, optional, default: None
|
1302
1157
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1303
1158
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1304
|
-
disabled : bool, default False
|
1305
|
-
If set to True, disables @conda.
|
1306
1159
|
"""
|
1307
1160
|
...
|
1308
1161
|
|
1309
1162
|
@typing.overload
|
1310
|
-
def
|
1163
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1311
1164
|
...
|
1312
1165
|
|
1313
1166
|
@typing.overload
|
1314
|
-
def
|
1167
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1315
1168
|
...
|
1316
1169
|
|
1317
|
-
def
|
1170
|
+
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):
|
1318
1171
|
"""
|
1319
|
-
Specifies the
|
1172
|
+
Specifies the PyPI packages for the step.
|
1320
1173
|
|
1321
1174
|
Information in this decorator will augment any
|
1322
|
-
attributes set in the `@
|
1323
|
-
you can use `@
|
1324
|
-
steps and use `@
|
1175
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1176
|
+
you can use `@pypi_base` to set packages required by all
|
1177
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1325
1178
|
|
1326
1179
|
Parameters
|
1327
1180
|
----------
|
1328
|
-
packages : Dict[str, str], default {}
|
1181
|
+
packages : Dict[str, str], default: {}
|
1329
1182
|
Packages to use for this step. The key is the name of the package
|
1330
1183
|
and the value is the version to use.
|
1331
|
-
|
1332
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1333
|
-
python : str, optional, default None
|
1184
|
+
python : str, optional, default: None
|
1334
1185
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1335
1186
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1336
|
-
disabled : bool, default False
|
1337
|
-
If set to True, disables @conda.
|
1338
|
-
"""
|
1339
|
-
...
|
1340
|
-
|
1341
|
-
@typing.overload
|
1342
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1343
|
-
"""
|
1344
|
-
Decorator prototype for all step decorators. This function gets specialized
|
1345
|
-
and imported for all decorators types by _import_plugin_decorators().
|
1346
|
-
"""
|
1347
|
-
...
|
1348
|
-
|
1349
|
-
@typing.overload
|
1350
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1351
|
-
...
|
1352
|
-
|
1353
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1354
|
-
"""
|
1355
|
-
Decorator prototype for all step decorators. This function gets specialized
|
1356
|
-
and imported for all decorators types by _import_plugin_decorators().
|
1357
1187
|
"""
|
1358
1188
|
...
|
1359
1189
|
|
1360
1190
|
@typing.overload
|
1361
|
-
def
|
1191
|
+
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]]]:
|
1362
1192
|
"""
|
1363
|
-
Specifies
|
1364
|
-
to a step needs to be retried.
|
1365
|
-
|
1366
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1367
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1368
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1369
|
-
|
1370
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1371
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1372
|
-
ensuring that the flow execution can continue.
|
1193
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
1373
1194
|
|
1374
1195
|
Parameters
|
1375
1196
|
----------
|
1376
|
-
|
1377
|
-
Number of
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1197
|
+
cpu : int, default 1
|
1198
|
+
Number of CPUs required for this step. If `@resources` is
|
1199
|
+
also present, the maximum value from all decorators is used.
|
1200
|
+
gpu : int, default 0
|
1201
|
+
Number of GPUs required for this step. If `@resources` is
|
1202
|
+
also present, the maximum value from all decorators is used.
|
1203
|
+
memory : int, default 4096
|
1204
|
+
Memory size (in MB) required for this step. If
|
1205
|
+
`@resources` is also present, the maximum value from all decorators is
|
1206
|
+
used.
|
1207
|
+
image : str, optional, default None
|
1208
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
1209
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
1210
|
+
not, a default Docker image mapping to the current version of Python is used.
|
1211
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
1212
|
+
AWS Batch Job Queue to submit the job to.
|
1213
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
1214
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
1215
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
1216
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
1217
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
1218
|
+
shared_memory : int, optional, default None
|
1219
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1220
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1221
|
+
max_swap : int, optional, default None
|
1222
|
+
The total amount of swap memory (in MiB) a container can use for this
|
1223
|
+
step. This parameter is translated to the `--memory-swap` option in
|
1224
|
+
Docker where the value is the sum of the container memory plus the
|
1225
|
+
`max_swap` value.
|
1226
|
+
swappiness : int, optional, default None
|
1227
|
+
This allows you to tune memory swappiness behavior for this step.
|
1228
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
1229
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
1230
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
1231
|
+
use_tmpfs : bool, default False
|
1232
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
1233
|
+
not available on Fargate compute environments
|
1234
|
+
tmpfs_tempdir : bool, default True
|
1235
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1236
|
+
tmpfs_size : int, optional, default None
|
1237
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
1238
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1239
|
+
memory allocated for this step.
|
1240
|
+
tmpfs_path : str, optional, default None
|
1241
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1242
|
+
inferentia : int, default 0
|
1243
|
+
Number of Inferentia chips required for this step.
|
1244
|
+
trainium : int, default None
|
1245
|
+
Alias for inferentia. Use only one of the two.
|
1246
|
+
efa : int, default 0
|
1247
|
+
Number of elastic fabric adapter network devices to attach to container
|
1248
|
+
ephemeral_storage : int, default None
|
1249
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
1250
|
+
This is only relevant for Fargate compute environments
|
1251
|
+
log_driver: str, optional, default None
|
1252
|
+
The log driver to use for the Amazon ECS container.
|
1253
|
+
log_options: List[str], optional, default None
|
1254
|
+
List of strings containing options for the chosen log driver. The configurable values
|
1255
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1256
|
+
Example: [`awslogs-group:aws/batch/job`]
|
1431
1257
|
"""
|
1432
1258
|
...
|
1433
1259
|
|
1434
1260
|
@typing.overload
|
1435
|
-
def
|
1261
|
+
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1436
1262
|
...
|
1437
1263
|
|
1438
1264
|
@typing.overload
|
1439
|
-
def
|
1265
|
+
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1440
1266
|
...
|
1441
1267
|
|
1442
|
-
def
|
1268
|
+
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):
|
1443
1269
|
"""
|
1444
|
-
Specifies that
|
1445
|
-
|
1446
|
-
The decorator will create an optional artifact, specified by `var`, which
|
1447
|
-
contains the exception raised. You can use it to detect the presence
|
1448
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1449
|
-
are missing.
|
1270
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
1450
1271
|
|
1451
1272
|
Parameters
|
1452
1273
|
----------
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1274
|
+
cpu : int, default 1
|
1275
|
+
Number of CPUs required for this step. If `@resources` is
|
1276
|
+
also present, the maximum value from all decorators is used.
|
1277
|
+
gpu : int, default 0
|
1278
|
+
Number of GPUs required for this step. If `@resources` is
|
1279
|
+
also present, the maximum value from all decorators is used.
|
1280
|
+
memory : int, default 4096
|
1281
|
+
Memory size (in MB) required for this step. If
|
1282
|
+
`@resources` is also present, the maximum value from all decorators is
|
1283
|
+
used.
|
1284
|
+
image : str, optional, default None
|
1285
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
1286
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
1287
|
+
not, a default Docker image mapping to the current version of Python is used.
|
1288
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
1289
|
+
AWS Batch Job Queue to submit the job to.
|
1290
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
1291
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
1292
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
1293
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
1294
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
1295
|
+
shared_memory : int, optional, default None
|
1296
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1297
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1298
|
+
max_swap : int, optional, default None
|
1299
|
+
The total amount of swap memory (in MiB) a container can use for this
|
1300
|
+
step. This parameter is translated to the `--memory-swap` option in
|
1301
|
+
Docker where the value is the sum of the container memory plus the
|
1302
|
+
`max_swap` value.
|
1303
|
+
swappiness : int, optional, default None
|
1304
|
+
This allows you to tune memory swappiness behavior for this step.
|
1305
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
1306
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
1307
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
1308
|
+
use_tmpfs : bool, default False
|
1309
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
1310
|
+
not available on Fargate compute environments
|
1311
|
+
tmpfs_tempdir : bool, default True
|
1312
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1313
|
+
tmpfs_size : int, optional, default None
|
1314
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
1315
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1316
|
+
memory allocated for this step.
|
1317
|
+
tmpfs_path : str, optional, default None
|
1318
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1319
|
+
inferentia : int, default 0
|
1320
|
+
Number of Inferentia chips required for this step.
|
1321
|
+
trainium : int, default None
|
1322
|
+
Alias for inferentia. Use only one of the two.
|
1323
|
+
efa : int, default 0
|
1324
|
+
Number of elastic fabric adapter network devices to attach to container
|
1325
|
+
ephemeral_storage : int, default None
|
1326
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
1327
|
+
This is only relevant for Fargate compute environments
|
1328
|
+
log_driver: str, optional, default None
|
1329
|
+
The log driver to use for the Amazon ECS container.
|
1330
|
+
log_options: List[str], optional, default None
|
1331
|
+
List of strings containing options for the chosen log driver. The configurable values
|
1332
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1333
|
+
Example: [`awslogs-group:aws/batch/job`]
|
1459
1334
|
"""
|
1460
1335
|
...
|
1461
1336
|
|
1462
1337
|
@typing.overload
|
1463
|
-
def
|
1338
|
+
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]]]:
|
1464
1339
|
"""
|
1465
|
-
|
1340
|
+
Specifies the Conda environment for the step.
|
1466
1341
|
|
1467
|
-
|
1342
|
+
Information in this decorator will augment any
|
1343
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1344
|
+
you can use `@conda_base` to set packages required by all
|
1345
|
+
steps and use `@conda` to specify step-specific overrides.
|
1468
1346
|
|
1469
1347
|
Parameters
|
1470
1348
|
----------
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1349
|
+
packages : Dict[str, str], default {}
|
1350
|
+
Packages to use for this step. The key is the name of the package
|
1351
|
+
and the value is the version to use.
|
1352
|
+
libraries : Dict[str, str], default {}
|
1353
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1354
|
+
python : str, optional, default None
|
1355
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1356
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1357
|
+
disabled : bool, default False
|
1358
|
+
If set to True, disables @conda.
|
1481
1359
|
"""
|
1482
1360
|
...
|
1483
1361
|
|
1484
1362
|
@typing.overload
|
1485
|
-
def
|
1363
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1486
1364
|
...
|
1487
1365
|
|
1488
1366
|
@typing.overload
|
1489
|
-
def
|
1367
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1490
1368
|
...
|
1491
1369
|
|
1492
|
-
def
|
1370
|
+
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):
|
1493
1371
|
"""
|
1494
|
-
|
1372
|
+
Specifies the Conda environment for the step.
|
1495
1373
|
|
1496
|
-
|
1374
|
+
Information in this decorator will augment any
|
1375
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1376
|
+
you can use `@conda_base` to set packages required by all
|
1377
|
+
steps and use `@conda` to specify step-specific overrides.
|
1497
1378
|
|
1498
1379
|
Parameters
|
1499
1380
|
----------
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1381
|
+
packages : Dict[str, str], default {}
|
1382
|
+
Packages to use for this step. The key is the name of the package
|
1383
|
+
and the value is the version to use.
|
1384
|
+
libraries : Dict[str, str], default {}
|
1385
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1386
|
+
python : str, optional, default None
|
1387
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1388
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1389
|
+
disabled : bool, default False
|
1390
|
+
If set to True, disables @conda.
|
1510
1391
|
"""
|
1511
1392
|
...
|
1512
1393
|
|
@@ -1543,197 +1424,122 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
1543
1424
|
"""
|
1544
1425
|
...
|
1545
1426
|
|
1546
|
-
|
1547
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1548
|
-
"""
|
1549
|
-
Specifies the PyPI packages for all steps of the flow.
|
1550
|
-
|
1551
|
-
Use `@pypi_base` to set common packages required by all
|
1552
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1553
|
-
Parameters
|
1554
|
-
----------
|
1555
|
-
packages : Dict[str, str], default: {}
|
1556
|
-
Packages to use for this flow. The key is the name of the package
|
1557
|
-
and the value is the version to use.
|
1558
|
-
python : str, optional, default: None
|
1559
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1560
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1561
|
-
"""
|
1562
|
-
...
|
1563
|
-
|
1564
|
-
@typing.overload
|
1565
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1566
|
-
...
|
1567
|
-
|
1568
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1569
|
-
"""
|
1570
|
-
Specifies the PyPI packages for all steps of the flow.
|
1571
|
-
|
1572
|
-
Use `@pypi_base` to set common packages required by all
|
1573
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1574
|
-
Parameters
|
1575
|
-
----------
|
1576
|
-
packages : Dict[str, str], default: {}
|
1577
|
-
Packages to use for this flow. The key is the name of the package
|
1578
|
-
and the value is the version to use.
|
1579
|
-
python : str, optional, default: None
|
1580
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1581
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1582
|
-
"""
|
1583
|
-
...
|
1584
|
-
|
1585
|
-
@typing.overload
|
1586
|
-
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]]:
|
1587
|
-
"""
|
1588
|
-
Specifies the event(s) that this flow depends on.
|
1589
|
-
|
1590
|
-
```
|
1591
|
-
@trigger(event='foo')
|
1592
|
-
```
|
1593
|
-
or
|
1594
|
-
```
|
1595
|
-
@trigger(events=['foo', 'bar'])
|
1596
|
-
```
|
1597
|
-
|
1598
|
-
Additionally, you can specify the parameter mappings
|
1599
|
-
to map event payload to Metaflow parameters for the flow.
|
1600
|
-
```
|
1601
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1602
|
-
```
|
1603
|
-
or
|
1604
|
-
```
|
1605
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1606
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1607
|
-
```
|
1608
|
-
|
1609
|
-
'parameters' can also be a list of strings and tuples like so:
|
1610
|
-
```
|
1611
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1612
|
-
```
|
1613
|
-
This is equivalent to:
|
1614
|
-
```
|
1615
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1616
|
-
```
|
1617
|
-
|
1618
|
-
Parameters
|
1619
|
-
----------
|
1620
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1621
|
-
Event dependency for this flow.
|
1622
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1623
|
-
Events dependency for this flow.
|
1624
|
-
options : Dict[str, Any], default {}
|
1625
|
-
Backend-specific configuration for tuning eventing behavior.
|
1626
|
-
|
1627
|
-
|
1628
|
-
"""
|
1629
|
-
...
|
1630
|
-
|
1631
|
-
@typing.overload
|
1632
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1633
|
-
...
|
1634
|
-
|
1635
|
-
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] = {}):
|
1636
|
-
"""
|
1637
|
-
Specifies the event(s) that this flow depends on.
|
1638
|
-
|
1639
|
-
```
|
1640
|
-
@trigger(event='foo')
|
1641
|
-
```
|
1642
|
-
or
|
1643
|
-
```
|
1644
|
-
@trigger(events=['foo', 'bar'])
|
1645
|
-
```
|
1646
|
-
|
1647
|
-
Additionally, you can specify the parameter mappings
|
1648
|
-
to map event payload to Metaflow parameters for the flow.
|
1649
|
-
```
|
1650
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1651
|
-
```
|
1652
|
-
or
|
1653
|
-
```
|
1654
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1655
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1656
|
-
```
|
1657
|
-
|
1658
|
-
'parameters' can also be a list of strings and tuples like so:
|
1659
|
-
```
|
1660
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1661
|
-
```
|
1662
|
-
This is equivalent to:
|
1663
|
-
```
|
1664
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1665
|
-
```
|
1666
|
-
|
1667
|
-
Parameters
|
1668
|
-
----------
|
1669
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1670
|
-
Event dependency for this flow.
|
1671
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1672
|
-
Events dependency for this flow.
|
1673
|
-
options : Dict[str, Any], default {}
|
1674
|
-
Backend-specific configuration for tuning eventing behavior.
|
1675
|
-
|
1676
|
-
|
1677
|
-
"""
|
1678
|
-
...
|
1679
|
-
|
1680
|
-
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]]:
|
1427
|
+
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, node_selector: typing.Union[typing.Dict[str, str], str, None] = 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]]]:
|
1681
1428
|
"""
|
1682
|
-
|
1683
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1684
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1685
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1686
|
-
starts only after all sensors finish.
|
1429
|
+
Specifies that this step should execute on Kubernetes.
|
1687
1430
|
|
1688
1431
|
Parameters
|
1689
1432
|
----------
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
the
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1433
|
+
cpu : int, default 1
|
1434
|
+
Number of CPUs required for this step. If `@resources` is
|
1435
|
+
also present, the maximum value from all decorators is used.
|
1436
|
+
memory : int, default 4096
|
1437
|
+
Memory size (in MB) required for this step. If
|
1438
|
+
`@resources` is also present, the maximum value from all decorators is
|
1439
|
+
used.
|
1440
|
+
disk : int, default 10240
|
1441
|
+
Disk size (in MB) required for this step. If
|
1442
|
+
`@resources` is also present, the maximum value from all decorators is
|
1443
|
+
used.
|
1444
|
+
image : str, optional, default None
|
1445
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
1446
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1447
|
+
not, a default Docker image mapping to the current version of Python is used.
|
1448
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1449
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1450
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1451
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
1452
|
+
secrets : List[str], optional, default None
|
1453
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1454
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1455
|
+
in Metaflow configuration.
|
1456
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
1457
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
1458
|
+
Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
|
1459
|
+
or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
|
1460
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1461
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
1462
|
+
gpu : int, optional, default None
|
1463
|
+
Number of GPUs required for this step. A value of zero implies that
|
1464
|
+
the scheduled node should not have GPUs.
|
1465
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1466
|
+
The vendor of the GPUs to be used for this step.
|
1467
|
+
tolerations : List[str], default []
|
1468
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1469
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1470
|
+
use_tmpfs : bool, default False
|
1471
|
+
This enables an explicit tmpfs mount for this step.
|
1472
|
+
tmpfs_tempdir : bool, default True
|
1473
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1474
|
+
tmpfs_size : int, optional, default: None
|
1475
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
1476
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1477
|
+
memory allocated for this step.
|
1478
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
1479
|
+
Path to tmpfs mount for this step.
|
1480
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
1481
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1482
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1483
|
+
shared_memory: int, optional
|
1484
|
+
Shared memory size (in MiB) required for this step
|
1485
|
+
port: int, optional
|
1486
|
+
Port number to specify in the Kubernetes job object
|
1487
|
+
compute_pool : str, optional, default None
|
1488
|
+
Compute pool to be used for for this step.
|
1489
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
1719
1490
|
"""
|
1720
1491
|
...
|
1721
1492
|
|
1722
|
-
|
1493
|
+
@typing.overload
|
1494
|
+
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]]]:
|
1723
1495
|
"""
|
1724
|
-
Specifies
|
1496
|
+
Specifies the number of times the task corresponding
|
1497
|
+
to a step needs to be retried.
|
1725
1498
|
|
1726
|
-
|
1727
|
-
|
1499
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1500
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1501
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1502
|
+
|
1503
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1504
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1505
|
+
ensuring that the flow execution can continue.
|
1728
1506
|
|
1729
1507
|
Parameters
|
1730
1508
|
----------
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1509
|
+
times : int, default 3
|
1510
|
+
Number of times to retry this task.
|
1511
|
+
minutes_between_retries : int, default 2
|
1512
|
+
Number of minutes between retries.
|
1513
|
+
"""
|
1514
|
+
...
|
1515
|
+
|
1516
|
+
@typing.overload
|
1517
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1518
|
+
...
|
1519
|
+
|
1520
|
+
@typing.overload
|
1521
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1522
|
+
...
|
1523
|
+
|
1524
|
+
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):
|
1525
|
+
"""
|
1526
|
+
Specifies the number of times the task corresponding
|
1527
|
+
to a step needs to be retried.
|
1528
|
+
|
1529
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1530
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1531
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1735
1532
|
|
1533
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1534
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1535
|
+
ensuring that the flow execution can continue.
|
1736
1536
|
|
1537
|
+
Parameters
|
1538
|
+
----------
|
1539
|
+
times : int, default 3
|
1540
|
+
Number of times to retry this task.
|
1541
|
+
minutes_between_retries : int, default 2
|
1542
|
+
Number of minutes between retries.
|
1737
1543
|
"""
|
1738
1544
|
...
|
1739
1545
|
|
@@ -1828,6 +1634,87 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
1828
1634
|
"""
|
1829
1635
|
...
|
1830
1636
|
|
1637
|
+
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]]:
|
1638
|
+
"""
|
1639
|
+
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)
|
1640
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1641
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1642
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1643
|
+
starts only after all sensors finish.
|
1644
|
+
|
1645
|
+
Parameters
|
1646
|
+
----------
|
1647
|
+
timeout : int
|
1648
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1649
|
+
poke_interval : int
|
1650
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1651
|
+
mode : str
|
1652
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1653
|
+
exponential_backoff : bool
|
1654
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1655
|
+
pool : str
|
1656
|
+
the slot pool this task should run in,
|
1657
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1658
|
+
soft_fail : bool
|
1659
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1660
|
+
name : str
|
1661
|
+
Name of the sensor on Airflow
|
1662
|
+
description : str
|
1663
|
+
Description of sensor in the Airflow UI
|
1664
|
+
bucket_key : Union[str, List[str]]
|
1665
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1666
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1667
|
+
bucket_name : str
|
1668
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1669
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1670
|
+
wildcard_match : bool
|
1671
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1672
|
+
aws_conn_id : str
|
1673
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1674
|
+
verify : bool
|
1675
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1676
|
+
"""
|
1677
|
+
...
|
1678
|
+
|
1679
|
+
@typing.overload
|
1680
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1681
|
+
"""
|
1682
|
+
Specifies the PyPI packages for all steps of the flow.
|
1683
|
+
|
1684
|
+
Use `@pypi_base` to set common packages required by all
|
1685
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1686
|
+
Parameters
|
1687
|
+
----------
|
1688
|
+
packages : Dict[str, str], default: {}
|
1689
|
+
Packages to use for this flow. The key is the name of the package
|
1690
|
+
and the value is the version to use.
|
1691
|
+
python : str, optional, default: None
|
1692
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1693
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1694
|
+
"""
|
1695
|
+
...
|
1696
|
+
|
1697
|
+
@typing.overload
|
1698
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1699
|
+
...
|
1700
|
+
|
1701
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1702
|
+
"""
|
1703
|
+
Specifies the PyPI packages for all steps of the flow.
|
1704
|
+
|
1705
|
+
Use `@pypi_base` to set common packages required by all
|
1706
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1707
|
+
Parameters
|
1708
|
+
----------
|
1709
|
+
packages : Dict[str, str], default: {}
|
1710
|
+
Packages to use for this flow. The key is the name of the package
|
1711
|
+
and the value is the version to use.
|
1712
|
+
python : str, optional, default: None
|
1713
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1714
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1715
|
+
"""
|
1716
|
+
...
|
1717
|
+
|
1831
1718
|
@typing.overload
|
1832
1719
|
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1833
1720
|
"""
|
@@ -1980,6 +1867,119 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1980
1867
|
"""
|
1981
1868
|
...
|
1982
1869
|
|
1870
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1871
|
+
"""
|
1872
|
+
Specifies what flows belong to the same project.
|
1873
|
+
|
1874
|
+
A project-specific namespace is created for all flows that
|
1875
|
+
use the same `@project(name)`.
|
1876
|
+
|
1877
|
+
Parameters
|
1878
|
+
----------
|
1879
|
+
name : str
|
1880
|
+
Project name. Make sure that the name is unique amongst all
|
1881
|
+
projects that use the same production scheduler. The name may
|
1882
|
+
contain only lowercase alphanumeric characters and underscores.
|
1883
|
+
|
1884
|
+
|
1885
|
+
"""
|
1886
|
+
...
|
1887
|
+
|
1888
|
+
@typing.overload
|
1889
|
+
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]]:
|
1890
|
+
"""
|
1891
|
+
Specifies the event(s) that this flow depends on.
|
1892
|
+
|
1893
|
+
```
|
1894
|
+
@trigger(event='foo')
|
1895
|
+
```
|
1896
|
+
or
|
1897
|
+
```
|
1898
|
+
@trigger(events=['foo', 'bar'])
|
1899
|
+
```
|
1900
|
+
|
1901
|
+
Additionally, you can specify the parameter mappings
|
1902
|
+
to map event payload to Metaflow parameters for the flow.
|
1903
|
+
```
|
1904
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1905
|
+
```
|
1906
|
+
or
|
1907
|
+
```
|
1908
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1909
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1910
|
+
```
|
1911
|
+
|
1912
|
+
'parameters' can also be a list of strings and tuples like so:
|
1913
|
+
```
|
1914
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1915
|
+
```
|
1916
|
+
This is equivalent to:
|
1917
|
+
```
|
1918
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1919
|
+
```
|
1920
|
+
|
1921
|
+
Parameters
|
1922
|
+
----------
|
1923
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1924
|
+
Event dependency for this flow.
|
1925
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1926
|
+
Events dependency for this flow.
|
1927
|
+
options : Dict[str, Any], default {}
|
1928
|
+
Backend-specific configuration for tuning eventing behavior.
|
1929
|
+
|
1930
|
+
|
1931
|
+
"""
|
1932
|
+
...
|
1933
|
+
|
1934
|
+
@typing.overload
|
1935
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1936
|
+
...
|
1937
|
+
|
1938
|
+
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] = {}):
|
1939
|
+
"""
|
1940
|
+
Specifies the event(s) that this flow depends on.
|
1941
|
+
|
1942
|
+
```
|
1943
|
+
@trigger(event='foo')
|
1944
|
+
```
|
1945
|
+
or
|
1946
|
+
```
|
1947
|
+
@trigger(events=['foo', 'bar'])
|
1948
|
+
```
|
1949
|
+
|
1950
|
+
Additionally, you can specify the parameter mappings
|
1951
|
+
to map event payload to Metaflow parameters for the flow.
|
1952
|
+
```
|
1953
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1954
|
+
```
|
1955
|
+
or
|
1956
|
+
```
|
1957
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1958
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1959
|
+
```
|
1960
|
+
|
1961
|
+
'parameters' can also be a list of strings and tuples like so:
|
1962
|
+
```
|
1963
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1964
|
+
```
|
1965
|
+
This is equivalent to:
|
1966
|
+
```
|
1967
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1968
|
+
```
|
1969
|
+
|
1970
|
+
Parameters
|
1971
|
+
----------
|
1972
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1973
|
+
Event dependency for this flow.
|
1974
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1975
|
+
Events dependency for this flow.
|
1976
|
+
options : Dict[str, Any], default {}
|
1977
|
+
Backend-specific configuration for tuning eventing behavior.
|
1978
|
+
|
1979
|
+
|
1980
|
+
"""
|
1981
|
+
...
|
1982
|
+
|
1983
1983
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1984
1984
|
"""
|
1985
1985
|
Switch namespace to the one provided.
|