ob-metaflow-stubs 2.11.4.9__py2.py3-none-any.whl → 2.11.9.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metaflow-stubs/__init__.pyi +577 -553
- metaflow-stubs/cards.pyi +5 -5
- metaflow-stubs/cli.pyi +3 -3
- metaflow-stubs/client/__init__.pyi +3 -3
- metaflow-stubs/client/core.pyi +4 -4
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/clone_util.pyi +31 -0
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +5 -5
- metaflow-stubs/metadata/metadata.pyi +3 -3
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +4 -2
- metaflow-stubs/metaflow_current.pyi +4 -4
- metaflow-stubs/mflog/mflog.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow.pyi +3 -3
- metaflow-stubs/plugins/airflow/airflow_cli.pyi +4 -4
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +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 +5 -5
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +4 -4
- metaflow-stubs/plugins/aws/batch/batch_cli.pyi +4 -4
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +3 -3
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +4 -4
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +5 -5
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_cli.pyi +3 -3
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +4 -4
- metaflow-stubs/plugins/datatools/__init__.pyi +4 -4
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
- 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 +4 -4
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +4 -4
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +3 -3
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/tag_cli.pyi +4 -4
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/procpoll.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- {ob_metaflow_stubs-2.11.4.9.dist-info → ob_metaflow_stubs-2.11.9.1.dist-info}/METADATA +2 -2
- ob_metaflow_stubs-2.11.9.1.dist-info/RECORD +133 -0
- {ob_metaflow_stubs-2.11.4.9.dist-info → ob_metaflow_stubs-2.11.9.1.dist-info}/WHEEL +1 -1
- ob_metaflow_stubs-2.11.4.9.dist-info/RECORD +0 -132
- {ob_metaflow_stubs-2.11.4.9.dist-info → ob_metaflow_stubs-2.11.9.1.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.11.
|
4
|
-
# Generated on 2024-03-
|
3
|
+
# MF version: 2.11.9.1 #
|
4
|
+
# Generated on 2024-03-30T09:14:00.953272 #
|
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.parameters
|
11
12
|
import metaflow.datastore.inputs
|
12
|
-
import metaflow.events
|
13
|
-
import metaflow._vendor.click.types
|
14
13
|
import metaflow.client.core
|
15
|
-
import metaflow.
|
14
|
+
import metaflow.events
|
16
15
|
import metaflow.plugins.datatools.s3.s3
|
17
16
|
import io
|
18
17
|
import datetime
|
19
18
|
import typing
|
19
|
+
import metaflow._vendor.click.types
|
20
20
|
import metaflow.metaflow_current
|
21
21
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
22
22
|
StepFlag = typing.NewType("StepFlag", bool)
|
@@ -726,66 +726,132 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
726
726
|
...
|
727
727
|
|
728
728
|
@typing.overload
|
729
|
-
def
|
729
|
+
def resources(*, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
730
730
|
"""
|
731
|
-
Specifies
|
732
|
-
|
731
|
+
Specifies the resources needed when executing this step.
|
732
|
+
|
733
|
+
Use `@resources` to specify the resource requirements
|
734
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
735
|
+
|
736
|
+
You can choose the compute layer on the command line by executing e.g.
|
737
|
+
```
|
738
|
+
python myflow.py run --with batch
|
739
|
+
```
|
740
|
+
or
|
741
|
+
```
|
742
|
+
python myflow.py run --with kubernetes
|
743
|
+
```
|
744
|
+
which executes the flow on the desired system using the
|
745
|
+
requirements specified in `@resources`.
|
733
746
|
|
734
747
|
Parameters
|
735
748
|
----------
|
736
|
-
|
737
|
-
|
749
|
+
cpu : int, default 1
|
750
|
+
Number of CPUs required for this step.
|
751
|
+
gpu : int, default 0
|
752
|
+
Number of GPUs required for this step.
|
753
|
+
disk : int, optional, default None
|
754
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
755
|
+
memory : int, default 4096
|
756
|
+
Memory size (in MB) required for this step.
|
757
|
+
shared_memory : int, optional, default None
|
758
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
759
|
+
This parameter maps to the `--shm-size` option in Docker.
|
738
760
|
"""
|
739
761
|
...
|
740
762
|
|
741
763
|
@typing.overload
|
742
|
-
def
|
764
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
743
765
|
...
|
744
766
|
|
745
767
|
@typing.overload
|
746
|
-
def
|
768
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
747
769
|
...
|
748
770
|
|
749
|
-
def
|
771
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
750
772
|
"""
|
751
|
-
Specifies
|
752
|
-
|
773
|
+
Specifies the resources needed when executing this step.
|
774
|
+
|
775
|
+
Use `@resources` to specify the resource requirements
|
776
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
777
|
+
|
778
|
+
You can choose the compute layer on the command line by executing e.g.
|
779
|
+
```
|
780
|
+
python myflow.py run --with batch
|
781
|
+
```
|
782
|
+
or
|
783
|
+
```
|
784
|
+
python myflow.py run --with kubernetes
|
785
|
+
```
|
786
|
+
which executes the flow on the desired system using the
|
787
|
+
requirements specified in `@resources`.
|
753
788
|
|
754
789
|
Parameters
|
755
790
|
----------
|
756
|
-
|
757
|
-
|
791
|
+
cpu : int, default 1
|
792
|
+
Number of CPUs required for this step.
|
793
|
+
gpu : int, default 0
|
794
|
+
Number of GPUs required for this step.
|
795
|
+
disk : int, optional, default None
|
796
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
797
|
+
memory : int, default 4096
|
798
|
+
Memory size (in MB) required for this step.
|
799
|
+
shared_memory : int, optional, default None
|
800
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
801
|
+
This parameter maps to the `--shm-size` option in Docker.
|
758
802
|
"""
|
759
803
|
...
|
760
804
|
|
761
805
|
@typing.overload
|
762
|
-
def
|
806
|
+
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]]]:
|
763
807
|
"""
|
764
|
-
Specifies
|
808
|
+
Specifies the number of times the task corresponding
|
809
|
+
to a step needs to be retried.
|
810
|
+
|
811
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
812
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
813
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
814
|
+
|
815
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
816
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
817
|
+
ensuring that the flow execution can continue.
|
765
818
|
|
766
819
|
Parameters
|
767
820
|
----------
|
768
|
-
|
769
|
-
|
821
|
+
times : int, default 3
|
822
|
+
Number of times to retry this task.
|
823
|
+
minutes_between_retries : int, default 2
|
824
|
+
Number of minutes between retries.
|
770
825
|
"""
|
771
826
|
...
|
772
827
|
|
773
828
|
@typing.overload
|
774
|
-
def
|
829
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
775
830
|
...
|
776
831
|
|
777
832
|
@typing.overload
|
778
|
-
def
|
833
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
779
834
|
...
|
780
835
|
|
781
|
-
def
|
836
|
+
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):
|
782
837
|
"""
|
783
|
-
Specifies
|
838
|
+
Specifies the number of times the task corresponding
|
839
|
+
to a step needs to be retried.
|
840
|
+
|
841
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
842
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
843
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
844
|
+
|
845
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
846
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
847
|
+
ensuring that the flow execution can continue.
|
784
848
|
|
785
849
|
Parameters
|
786
850
|
----------
|
787
|
-
|
788
|
-
|
851
|
+
times : int, default 3
|
852
|
+
Number of times to retry this task.
|
853
|
+
minutes_between_retries : int, default 2
|
854
|
+
Number of minutes between retries.
|
789
855
|
"""
|
790
856
|
...
|
791
857
|
|
@@ -846,6 +912,153 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
846
912
|
"""
|
847
913
|
...
|
848
914
|
|
915
|
+
@typing.overload
|
916
|
+
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]]]:
|
917
|
+
"""
|
918
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
919
|
+
|
920
|
+
Parameters
|
921
|
+
----------
|
922
|
+
cpu : int, default 1
|
923
|
+
Number of CPUs required for this step. If `@resources` is
|
924
|
+
also present, the maximum value from all decorators is used.
|
925
|
+
gpu : int, default 0
|
926
|
+
Number of GPUs required for this step. If `@resources` is
|
927
|
+
also present, the maximum value from all decorators is used.
|
928
|
+
memory : int, default 4096
|
929
|
+
Memory size (in MB) required for this step. If
|
930
|
+
`@resources` is also present, the maximum value from all decorators is
|
931
|
+
used.
|
932
|
+
image : str, optional, default None
|
933
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
934
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
935
|
+
not, a default Docker image mapping to the current version of Python is used.
|
936
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
937
|
+
AWS Batch Job Queue to submit the job to.
|
938
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
939
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
940
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
941
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
942
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
943
|
+
shared_memory : int, optional, default None
|
944
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
945
|
+
This parameter maps to the `--shm-size` option in Docker.
|
946
|
+
max_swap : int, optional, default None
|
947
|
+
The total amount of swap memory (in MiB) a container can use for this
|
948
|
+
step. This parameter is translated to the `--memory-swap` option in
|
949
|
+
Docker where the value is the sum of the container memory plus the
|
950
|
+
`max_swap` value.
|
951
|
+
swappiness : int, optional, default None
|
952
|
+
This allows you to tune memory swappiness behavior for this step.
|
953
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
954
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
955
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
956
|
+
use_tmpfs : bool, default False
|
957
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
958
|
+
not available on Fargate compute environments
|
959
|
+
tmpfs_tempdir : bool, default True
|
960
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
961
|
+
tmpfs_size : int, optional, default None
|
962
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
963
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
964
|
+
memory allocated for this step.
|
965
|
+
tmpfs_path : str, optional, default None
|
966
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
967
|
+
inferentia : int, default 0
|
968
|
+
Number of Inferentia chips required for this step.
|
969
|
+
trainium : int, default None
|
970
|
+
Alias for inferentia. Use only one of the two.
|
971
|
+
efa : int, default 0
|
972
|
+
Number of elastic fabric adapter network devices to attach to container
|
973
|
+
ephemeral_storage: int, default None
|
974
|
+
The total amount, in GiB, of ephemeral storage to set for the task (21-200)
|
975
|
+
This is only relevant for Fargate compute environments
|
976
|
+
log_driver: str, optional, default None
|
977
|
+
The log driver to use for the Amazon ECS container.
|
978
|
+
log_options: List[str], optional, default None
|
979
|
+
List of strings containing options for the chosen log driver. The configurable values
|
980
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
981
|
+
Example usage: ["awslogs-group:aws/batch/job"]
|
982
|
+
"""
|
983
|
+
...
|
984
|
+
|
985
|
+
@typing.overload
|
986
|
+
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
987
|
+
...
|
988
|
+
|
989
|
+
@typing.overload
|
990
|
+
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
991
|
+
...
|
992
|
+
|
993
|
+
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):
|
994
|
+
"""
|
995
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
996
|
+
|
997
|
+
Parameters
|
998
|
+
----------
|
999
|
+
cpu : int, default 1
|
1000
|
+
Number of CPUs required for this step. If `@resources` is
|
1001
|
+
also present, the maximum value from all decorators is used.
|
1002
|
+
gpu : int, default 0
|
1003
|
+
Number of GPUs required for this step. If `@resources` is
|
1004
|
+
also present, the maximum value from all decorators is used.
|
1005
|
+
memory : int, default 4096
|
1006
|
+
Memory size (in MB) required for this step. If
|
1007
|
+
`@resources` is also present, the maximum value from all decorators is
|
1008
|
+
used.
|
1009
|
+
image : str, optional, default None
|
1010
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
1011
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
1012
|
+
not, a default Docker image mapping to the current version of Python is used.
|
1013
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
1014
|
+
AWS Batch Job Queue to submit the job to.
|
1015
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
1016
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
1017
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
1018
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
1019
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
1020
|
+
shared_memory : int, optional, default None
|
1021
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1022
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1023
|
+
max_swap : int, optional, default None
|
1024
|
+
The total amount of swap memory (in MiB) a container can use for this
|
1025
|
+
step. This parameter is translated to the `--memory-swap` option in
|
1026
|
+
Docker where the value is the sum of the container memory plus the
|
1027
|
+
`max_swap` value.
|
1028
|
+
swappiness : int, optional, default None
|
1029
|
+
This allows you to tune memory swappiness behavior for this step.
|
1030
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
1031
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
1032
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
1033
|
+
use_tmpfs : bool, default False
|
1034
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
1035
|
+
not available on Fargate compute environments
|
1036
|
+
tmpfs_tempdir : bool, default True
|
1037
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1038
|
+
tmpfs_size : int, optional, default None
|
1039
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
1040
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1041
|
+
memory allocated for this step.
|
1042
|
+
tmpfs_path : str, optional, default None
|
1043
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1044
|
+
inferentia : int, default 0
|
1045
|
+
Number of Inferentia chips required for this step.
|
1046
|
+
trainium : int, default None
|
1047
|
+
Alias for inferentia. Use only one of the two.
|
1048
|
+
efa : int, default 0
|
1049
|
+
Number of elastic fabric adapter network devices to attach to container
|
1050
|
+
ephemeral_storage: int, default None
|
1051
|
+
The total amount, in GiB, of ephemeral storage to set for the task (21-200)
|
1052
|
+
This is only relevant for Fargate compute environments
|
1053
|
+
log_driver: str, optional, default None
|
1054
|
+
The log driver to use for the Amazon ECS container.
|
1055
|
+
log_options: List[str], optional, default None
|
1056
|
+
List of strings containing options for the chosen log driver. The configurable values
|
1057
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1058
|
+
Example usage: ["awslogs-group:aws/batch/job"]
|
1059
|
+
"""
|
1060
|
+
...
|
1061
|
+
|
849
1062
|
@typing.overload
|
850
1063
|
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]]]:
|
851
1064
|
"""
|
@@ -898,161 +1111,84 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
898
1111
|
...
|
899
1112
|
|
900
1113
|
@typing.overload
|
901
|
-
def
|
1114
|
+
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]]]:
|
902
1115
|
"""
|
903
|
-
Specifies the
|
904
|
-
to a step needs to be retried.
|
905
|
-
|
906
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
907
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
908
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1116
|
+
Specifies that the step will success under all circumstances.
|
909
1117
|
|
910
|
-
|
911
|
-
|
912
|
-
|
1118
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1119
|
+
contains the exception raised. You can use it to detect the presence
|
1120
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1121
|
+
are missing.
|
913
1122
|
|
914
1123
|
Parameters
|
915
1124
|
----------
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
@typing.overload
|
924
|
-
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
925
|
-
...
|
926
|
-
|
927
|
-
@typing.overload
|
928
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
929
|
-
...
|
930
|
-
|
931
|
-
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):
|
932
|
-
"""
|
933
|
-
Specifies the number of times the task corresponding
|
934
|
-
to a step needs to be retried.
|
935
|
-
|
936
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
937
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
938
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
939
|
-
|
940
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
941
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
942
|
-
ensuring that the flow execution can continue.
|
943
|
-
|
944
|
-
Parameters
|
945
|
-
----------
|
946
|
-
times : int, default 3
|
947
|
-
Number of times to retry this task.
|
948
|
-
minutes_between_retries : int, default 2
|
949
|
-
Number of minutes between retries.
|
950
|
-
"""
|
951
|
-
...
|
952
|
-
|
953
|
-
@typing.overload
|
954
|
-
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]]]:
|
955
|
-
"""
|
956
|
-
Specifies the Conda environment for the step.
|
957
|
-
|
958
|
-
Information in this decorator will augment any
|
959
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
960
|
-
you can use `@conda_base` to set packages required by all
|
961
|
-
steps and use `@conda` to specify step-specific overrides.
|
962
|
-
|
963
|
-
Parameters
|
964
|
-
----------
|
965
|
-
packages : Dict[str, str], default {}
|
966
|
-
Packages to use for this step. The key is the name of the package
|
967
|
-
and the value is the version to use.
|
968
|
-
libraries : Dict[str, str], default {}
|
969
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
970
|
-
python : str, optional, default None
|
971
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
972
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
973
|
-
disabled : bool, default False
|
974
|
-
If set to True, disables @conda.
|
1125
|
+
var : str, optional, default None
|
1126
|
+
Name of the artifact in which to store the caught exception.
|
1127
|
+
If not specified, the exception is not stored.
|
1128
|
+
print_exception : bool, default True
|
1129
|
+
Determines whether or not the exception is printed to
|
1130
|
+
stdout when caught.
|
975
1131
|
"""
|
976
1132
|
...
|
977
1133
|
|
978
1134
|
@typing.overload
|
979
|
-
def
|
1135
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
980
1136
|
...
|
981
1137
|
|
982
1138
|
@typing.overload
|
983
|
-
def
|
1139
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
984
1140
|
...
|
985
1141
|
|
986
|
-
def
|
1142
|
+
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):
|
987
1143
|
"""
|
988
|
-
Specifies the
|
1144
|
+
Specifies that the step will success under all circumstances.
|
989
1145
|
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
1146
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1147
|
+
contains the exception raised. You can use it to detect the presence
|
1148
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1149
|
+
are missing.
|
994
1150
|
|
995
1151
|
Parameters
|
996
1152
|
----------
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1004
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1005
|
-
disabled : bool, default False
|
1006
|
-
If set to True, disables @conda.
|
1153
|
+
var : str, optional, default None
|
1154
|
+
Name of the artifact in which to store the caught exception.
|
1155
|
+
If not specified, the exception is not stored.
|
1156
|
+
print_exception : bool, default True
|
1157
|
+
Determines whether or not the exception is printed to
|
1158
|
+
stdout when caught.
|
1007
1159
|
"""
|
1008
1160
|
...
|
1009
1161
|
|
1010
1162
|
@typing.overload
|
1011
|
-
def
|
1163
|
+
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]]]:
|
1012
1164
|
"""
|
1013
|
-
Specifies
|
1014
|
-
|
1015
|
-
Information in this decorator will augment any
|
1016
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1017
|
-
you can use `@pypi_base` to set packages required by all
|
1018
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1165
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1166
|
+
the execution of a step.
|
1019
1167
|
|
1020
1168
|
Parameters
|
1021
1169
|
----------
|
1022
|
-
|
1023
|
-
|
1024
|
-
and the value is the version to use.
|
1025
|
-
python : str, optional, default: None
|
1026
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1027
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1170
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1171
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1028
1172
|
"""
|
1029
1173
|
...
|
1030
1174
|
|
1031
1175
|
@typing.overload
|
1032
|
-
def
|
1176
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1033
1177
|
...
|
1034
1178
|
|
1035
1179
|
@typing.overload
|
1036
|
-
def
|
1180
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1037
1181
|
...
|
1038
1182
|
|
1039
|
-
def
|
1183
|
+
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]]] = []):
|
1040
1184
|
"""
|
1041
|
-
Specifies
|
1042
|
-
|
1043
|
-
Information in this decorator will augment any
|
1044
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1045
|
-
you can use `@pypi_base` to set packages required by all
|
1046
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1185
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1186
|
+
the execution of a step.
|
1047
1187
|
|
1048
1188
|
Parameters
|
1049
1189
|
----------
|
1050
|
-
|
1051
|
-
|
1052
|
-
and the value is the version to use.
|
1053
|
-
python : str, optional, default: None
|
1054
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1055
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1190
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1191
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1056
1192
|
"""
|
1057
1193
|
...
|
1058
1194
|
|
@@ -1116,293 +1252,139 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
1116
1252
|
...
|
1117
1253
|
|
1118
1254
|
@typing.overload
|
1119
|
-
def
|
1255
|
+
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]]]:
|
1120
1256
|
"""
|
1121
|
-
Specifies
|
1257
|
+
Specifies the PyPI packages for the step.
|
1122
1258
|
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1259
|
+
Information in this decorator will augment any
|
1260
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1261
|
+
you can use `@pypi_base` to set packages required by all
|
1262
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1127
1263
|
|
1128
1264
|
Parameters
|
1129
1265
|
----------
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1266
|
+
packages : Dict[str, str], default: {}
|
1267
|
+
Packages to use for this step. The key is the name of the package
|
1268
|
+
and the value is the version to use.
|
1269
|
+
python : str, optional, default: None
|
1270
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1271
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1136
1272
|
"""
|
1137
1273
|
...
|
1138
1274
|
|
1139
1275
|
@typing.overload
|
1140
|
-
def
|
1276
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1141
1277
|
...
|
1142
1278
|
|
1143
1279
|
@typing.overload
|
1144
|
-
def
|
1280
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1145
1281
|
...
|
1146
1282
|
|
1147
|
-
def
|
1283
|
+
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):
|
1148
1284
|
"""
|
1149
|
-
Specifies
|
1285
|
+
Specifies the PyPI packages for the step.
|
1150
1286
|
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1287
|
+
Information in this decorator will augment any
|
1288
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1289
|
+
you can use `@pypi_base` to set packages required by all
|
1290
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1155
1291
|
|
1156
1292
|
Parameters
|
1157
1293
|
----------
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1294
|
+
packages : Dict[str, str], default: {}
|
1295
|
+
Packages to use for this step. The key is the name of the package
|
1296
|
+
and the value is the version to use.
|
1297
|
+
python : str, optional, default: None
|
1298
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1299
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1164
1300
|
"""
|
1165
1301
|
...
|
1166
1302
|
|
1167
1303
|
@typing.overload
|
1168
|
-
def
|
1304
|
+
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]]]:
|
1169
1305
|
"""
|
1170
|
-
Specifies the
|
1171
|
-
|
1172
|
-
Use `@resources` to specify the resource requirements
|
1173
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1306
|
+
Specifies the Conda environment for the step.
|
1174
1307
|
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
or
|
1180
|
-
```
|
1181
|
-
python myflow.py run --with kubernetes
|
1182
|
-
```
|
1183
|
-
which executes the flow on the desired system using the
|
1184
|
-
requirements specified in `@resources`.
|
1308
|
+
Information in this decorator will augment any
|
1309
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1310
|
+
you can use `@conda_base` to set packages required by all
|
1311
|
+
steps and use `@conda` to specify step-specific overrides.
|
1185
1312
|
|
1186
1313
|
Parameters
|
1187
1314
|
----------
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1315
|
+
packages : Dict[str, str], default {}
|
1316
|
+
Packages to use for this step. The key is the name of the package
|
1317
|
+
and the value is the version to use.
|
1318
|
+
libraries : Dict[str, str], default {}
|
1319
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1320
|
+
python : str, optional, default None
|
1321
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1322
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1323
|
+
disabled : bool, default False
|
1324
|
+
If set to True, disables @conda.
|
1199
1325
|
"""
|
1200
1326
|
...
|
1201
1327
|
|
1202
1328
|
@typing.overload
|
1203
|
-
def
|
1329
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1204
1330
|
...
|
1205
1331
|
|
1206
1332
|
@typing.overload
|
1207
|
-
def
|
1333
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1208
1334
|
...
|
1209
1335
|
|
1210
|
-
def
|
1336
|
+
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):
|
1211
1337
|
"""
|
1212
|
-
Specifies the
|
1213
|
-
|
1214
|
-
Use `@resources` to specify the resource requirements
|
1215
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1338
|
+
Specifies the Conda environment for the step.
|
1216
1339
|
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
or
|
1222
|
-
```
|
1223
|
-
python myflow.py run --with kubernetes
|
1224
|
-
```
|
1225
|
-
which executes the flow on the desired system using the
|
1226
|
-
requirements specified in `@resources`.
|
1340
|
+
Information in this decorator will augment any
|
1341
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1342
|
+
you can use `@conda_base` to set packages required by all
|
1343
|
+
steps and use `@conda` to specify step-specific overrides.
|
1227
1344
|
|
1228
1345
|
Parameters
|
1229
1346
|
----------
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1347
|
+
packages : Dict[str, str], default {}
|
1348
|
+
Packages to use for this step. The key is the name of the package
|
1349
|
+
and the value is the version to use.
|
1350
|
+
libraries : Dict[str, str], default {}
|
1351
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1352
|
+
python : str, optional, default None
|
1353
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1354
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1355
|
+
disabled : bool, default False
|
1356
|
+
If set to True, disables @conda.
|
1241
1357
|
"""
|
1242
1358
|
...
|
1243
1359
|
|
1244
1360
|
@typing.overload
|
1245
|
-
def
|
1361
|
+
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]]]:
|
1246
1362
|
"""
|
1247
|
-
Specifies
|
1363
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1248
1364
|
|
1249
1365
|
Parameters
|
1250
1366
|
----------
|
1251
|
-
|
1252
|
-
|
1253
|
-
also present, the maximum value from all decorators is used.
|
1254
|
-
gpu : int, default 0
|
1255
|
-
Number of GPUs required for this step. If `@resources` is
|
1256
|
-
also present, the maximum value from all decorators is used.
|
1257
|
-
memory : int, default 4096
|
1258
|
-
Memory size (in MB) required for this step. If
|
1259
|
-
`@resources` is also present, the maximum value from all decorators is
|
1260
|
-
used.
|
1261
|
-
image : str, optional, default None
|
1262
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
1263
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
1264
|
-
not, a default Docker image mapping to the current version of Python is used.
|
1265
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
1266
|
-
AWS Batch Job Queue to submit the job to.
|
1267
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
1268
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
1269
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
1270
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
1271
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
1272
|
-
shared_memory : int, optional, default None
|
1273
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1274
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1275
|
-
max_swap : int, optional, default None
|
1276
|
-
The total amount of swap memory (in MiB) a container can use for this
|
1277
|
-
step. This parameter is translated to the `--memory-swap` option in
|
1278
|
-
Docker where the value is the sum of the container memory plus the
|
1279
|
-
`max_swap` value.
|
1280
|
-
swappiness : int, optional, default None
|
1281
|
-
This allows you to tune memory swappiness behavior for this step.
|
1282
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
1283
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
1284
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
1285
|
-
use_tmpfs : bool, default False
|
1286
|
-
This enables an explicit tmpfs mount for this step.
|
1287
|
-
tmpfs_tempdir : bool, default True
|
1288
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1289
|
-
tmpfs_size : int, optional, default None
|
1290
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1291
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1292
|
-
memory allocated for this step.
|
1293
|
-
tmpfs_path : str, optional, default None
|
1294
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1295
|
-
inferentia : int, default 0
|
1296
|
-
Number of Inferentia chips required for this step.
|
1297
|
-
efa : int, default 0
|
1298
|
-
Number of elastic fabric adapter network devices to attach to container
|
1367
|
+
vars : Dict[str, str], default {}
|
1368
|
+
Dictionary of environment variables to set.
|
1299
1369
|
"""
|
1300
1370
|
...
|
1301
1371
|
|
1302
1372
|
@typing.overload
|
1303
|
-
def
|
1373
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1304
1374
|
...
|
1305
1375
|
|
1306
1376
|
@typing.overload
|
1307
|
-
def
|
1308
|
-
...
|
1309
|
-
|
1310
|
-
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, efa: int = 0):
|
1311
|
-
"""
|
1312
|
-
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
1313
|
-
|
1314
|
-
Parameters
|
1315
|
-
----------
|
1316
|
-
cpu : int, default 1
|
1317
|
-
Number of CPUs required for this step. If `@resources` is
|
1318
|
-
also present, the maximum value from all decorators is used.
|
1319
|
-
gpu : int, default 0
|
1320
|
-
Number of GPUs required for this step. If `@resources` is
|
1321
|
-
also present, the maximum value from all decorators is used.
|
1322
|
-
memory : int, default 4096
|
1323
|
-
Memory size (in MB) required for this step. If
|
1324
|
-
`@resources` is also present, the maximum value from all decorators is
|
1325
|
-
used.
|
1326
|
-
image : str, optional, default None
|
1327
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
1328
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
1329
|
-
not, a default Docker image mapping to the current version of Python is used.
|
1330
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
1331
|
-
AWS Batch Job Queue to submit the job to.
|
1332
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
1333
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
1334
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
1335
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
1336
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
1337
|
-
shared_memory : int, optional, default None
|
1338
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1339
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1340
|
-
max_swap : int, optional, default None
|
1341
|
-
The total amount of swap memory (in MiB) a container can use for this
|
1342
|
-
step. This parameter is translated to the `--memory-swap` option in
|
1343
|
-
Docker where the value is the sum of the container memory plus the
|
1344
|
-
`max_swap` value.
|
1345
|
-
swappiness : int, optional, default None
|
1346
|
-
This allows you to tune memory swappiness behavior for this step.
|
1347
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
1348
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
1349
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
1350
|
-
use_tmpfs : bool, default False
|
1351
|
-
This enables an explicit tmpfs mount for this step.
|
1352
|
-
tmpfs_tempdir : bool, default True
|
1353
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1354
|
-
tmpfs_size : int, optional, default None
|
1355
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1356
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1357
|
-
memory allocated for this step.
|
1358
|
-
tmpfs_path : str, optional, default None
|
1359
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1360
|
-
inferentia : int, default 0
|
1361
|
-
Number of Inferentia chips required for this step.
|
1362
|
-
efa : int, default 0
|
1363
|
-
Number of elastic fabric adapter network devices to attach to container
|
1364
|
-
"""
|
1377
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1365
1378
|
...
|
1366
1379
|
|
1367
|
-
def
|
1380
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1368
1381
|
"""
|
1369
|
-
|
1370
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1371
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1372
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1373
|
-
starts only after all sensors finish.
|
1382
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1374
1383
|
|
1375
1384
|
Parameters
|
1376
1385
|
----------
|
1377
|
-
|
1378
|
-
|
1379
|
-
poke_interval : int
|
1380
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1381
|
-
mode : str
|
1382
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1383
|
-
exponential_backoff : bool
|
1384
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1385
|
-
pool : str
|
1386
|
-
the slot pool this task should run in,
|
1387
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1388
|
-
soft_fail : bool
|
1389
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1390
|
-
name : str
|
1391
|
-
Name of the sensor on Airflow
|
1392
|
-
description : str
|
1393
|
-
Description of sensor in the Airflow UI
|
1394
|
-
bucket_key : Union[str, List[str]]
|
1395
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1396
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1397
|
-
bucket_name : str
|
1398
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1399
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1400
|
-
wildcard_match : bool
|
1401
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1402
|
-
aws_conn_id : str
|
1403
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1404
|
-
verify : bool
|
1405
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1386
|
+
vars : Dict[str, str], default {}
|
1387
|
+
Dictionary of environment variables to set.
|
1406
1388
|
"""
|
1407
1389
|
...
|
1408
1390
|
|
@@ -1448,21 +1430,204 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
1448
1430
|
"""
|
1449
1431
|
...
|
1450
1432
|
|
1451
|
-
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1433
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1434
|
+
"""
|
1435
|
+
Specifies what flows belong to the same project.
|
1436
|
+
|
1437
|
+
A project-specific namespace is created for all flows that
|
1438
|
+
use the same `@project(name)`.
|
1439
|
+
|
1440
|
+
Parameters
|
1441
|
+
----------
|
1442
|
+
name : str
|
1443
|
+
Project name. Make sure that the name is unique amongst all
|
1444
|
+
projects that use the same production scheduler. The name may
|
1445
|
+
contain only lowercase alphanumeric characters and underscores.
|
1446
|
+
|
1447
|
+
|
1448
|
+
"""
|
1449
|
+
...
|
1450
|
+
|
1451
|
+
@typing.overload
|
1452
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1453
|
+
"""
|
1454
|
+
Specifies the PyPI packages for all steps of the flow.
|
1455
|
+
|
1456
|
+
Use `@pypi_base` to set common packages required by all
|
1457
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1458
|
+
Parameters
|
1459
|
+
----------
|
1460
|
+
packages : Dict[str, str], default: {}
|
1461
|
+
Packages to use for this flow. The key is the name of the package
|
1462
|
+
and the value is the version to use.
|
1463
|
+
python : str, optional, default: None
|
1464
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1465
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1466
|
+
"""
|
1467
|
+
...
|
1468
|
+
|
1469
|
+
@typing.overload
|
1470
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1471
|
+
...
|
1472
|
+
|
1473
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1474
|
+
"""
|
1475
|
+
Specifies the PyPI packages for all steps of the flow.
|
1476
|
+
|
1477
|
+
Use `@pypi_base` to set common packages required by all
|
1478
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1479
|
+
Parameters
|
1480
|
+
----------
|
1481
|
+
packages : Dict[str, str], default: {}
|
1482
|
+
Packages to use for this flow. The key is the name of the package
|
1483
|
+
and the value is the version to use.
|
1484
|
+
python : str, optional, default: None
|
1485
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1486
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1487
|
+
"""
|
1488
|
+
...
|
1489
|
+
|
1490
|
+
@typing.overload
|
1491
|
+
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]]:
|
1492
|
+
"""
|
1493
|
+
Specifies the event(s) that this flow depends on.
|
1494
|
+
|
1495
|
+
```
|
1496
|
+
@trigger(event='foo')
|
1497
|
+
```
|
1498
|
+
or
|
1499
|
+
```
|
1500
|
+
@trigger(events=['foo', 'bar'])
|
1501
|
+
```
|
1502
|
+
|
1503
|
+
Additionally, you can specify the parameter mappings
|
1504
|
+
to map event payload to Metaflow parameters for the flow.
|
1505
|
+
```
|
1506
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1507
|
+
```
|
1508
|
+
or
|
1509
|
+
```
|
1510
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1511
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1512
|
+
```
|
1513
|
+
|
1514
|
+
'parameters' can also be a list of strings and tuples like so:
|
1515
|
+
```
|
1516
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1517
|
+
```
|
1518
|
+
This is equivalent to:
|
1519
|
+
```
|
1520
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1521
|
+
```
|
1522
|
+
|
1523
|
+
Parameters
|
1524
|
+
----------
|
1525
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1526
|
+
Event dependency for this flow.
|
1527
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1528
|
+
Events dependency for this flow.
|
1529
|
+
options : Dict[str, Any], default {}
|
1530
|
+
Backend-specific configuration for tuning eventing behavior.
|
1531
|
+
|
1532
|
+
|
1533
|
+
"""
|
1534
|
+
...
|
1535
|
+
|
1536
|
+
@typing.overload
|
1537
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1538
|
+
...
|
1539
|
+
|
1540
|
+
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] = {}):
|
1541
|
+
"""
|
1542
|
+
Specifies the event(s) that this flow depends on.
|
1543
|
+
|
1544
|
+
```
|
1545
|
+
@trigger(event='foo')
|
1546
|
+
```
|
1547
|
+
or
|
1548
|
+
```
|
1549
|
+
@trigger(events=['foo', 'bar'])
|
1550
|
+
```
|
1551
|
+
|
1552
|
+
Additionally, you can specify the parameter mappings
|
1553
|
+
to map event payload to Metaflow parameters for the flow.
|
1554
|
+
```
|
1555
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1556
|
+
```
|
1557
|
+
or
|
1558
|
+
```
|
1559
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1560
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1561
|
+
```
|
1562
|
+
|
1563
|
+
'parameters' can also be a list of strings and tuples like so:
|
1564
|
+
```
|
1565
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1566
|
+
```
|
1567
|
+
This is equivalent to:
|
1568
|
+
```
|
1569
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1570
|
+
```
|
1571
|
+
|
1572
|
+
Parameters
|
1573
|
+
----------
|
1574
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1575
|
+
Event dependency for this flow.
|
1576
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1577
|
+
Events dependency for this flow.
|
1578
|
+
options : Dict[str, Any], default {}
|
1579
|
+
Backend-specific configuration for tuning eventing behavior.
|
1580
|
+
|
1581
|
+
|
1582
|
+
"""
|
1583
|
+
...
|
1584
|
+
|
1585
|
+
@typing.overload
|
1586
|
+
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1587
|
+
"""
|
1588
|
+
Specifies the times when the flow should be run when running on a
|
1589
|
+
production scheduler.
|
1590
|
+
|
1591
|
+
Parameters
|
1592
|
+
----------
|
1593
|
+
hourly : bool, default False
|
1594
|
+
Run the workflow hourly.
|
1595
|
+
daily : bool, default True
|
1596
|
+
Run the workflow daily.
|
1597
|
+
weekly : bool, default False
|
1598
|
+
Run the workflow weekly.
|
1599
|
+
cron : str, optional, default None
|
1600
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1601
|
+
specified by this expression.
|
1602
|
+
timezone : str, optional, default None
|
1603
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1604
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1605
|
+
"""
|
1606
|
+
...
|
1607
|
+
|
1608
|
+
@typing.overload
|
1609
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1610
|
+
...
|
1611
|
+
|
1612
|
+
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1452
1613
|
"""
|
1453
|
-
Specifies
|
1454
|
-
|
1455
|
-
A project-specific namespace is created for all flows that
|
1456
|
-
use the same `@project(name)`.
|
1614
|
+
Specifies the times when the flow should be run when running on a
|
1615
|
+
production scheduler.
|
1457
1616
|
|
1458
1617
|
Parameters
|
1459
1618
|
----------
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1619
|
+
hourly : bool, default False
|
1620
|
+
Run the workflow hourly.
|
1621
|
+
daily : bool, default True
|
1622
|
+
Run the workflow daily.
|
1623
|
+
weekly : bool, default False
|
1624
|
+
Run the workflow weekly.
|
1625
|
+
cron : str, optional, default None
|
1626
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1627
|
+
specified by this expression.
|
1628
|
+
timezone : str, optional, default None
|
1629
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1630
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1466
1631
|
"""
|
1467
1632
|
...
|
1468
1633
|
|
@@ -1515,91 +1680,45 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1515
1680
|
"""
|
1516
1681
|
...
|
1517
1682
|
|
1518
|
-
|
1519
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1520
|
-
"""
|
1521
|
-
Specifies the PyPI packages for all steps of the flow.
|
1522
|
-
|
1523
|
-
Use `@pypi_base` to set common packages required by all
|
1524
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1525
|
-
Parameters
|
1526
|
-
----------
|
1527
|
-
packages : Dict[str, str], default: {}
|
1528
|
-
Packages to use for this flow. The key is the name of the package
|
1529
|
-
and the value is the version to use.
|
1530
|
-
python : str, optional, default: None
|
1531
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1532
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1533
|
-
"""
|
1534
|
-
...
|
1535
|
-
|
1536
|
-
@typing.overload
|
1537
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1538
|
-
...
|
1539
|
-
|
1540
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1541
|
-
"""
|
1542
|
-
Specifies the PyPI packages for all steps of the flow.
|
1543
|
-
|
1544
|
-
Use `@pypi_base` to set common packages required by all
|
1545
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1546
|
-
Parameters
|
1547
|
-
----------
|
1548
|
-
packages : Dict[str, str], default: {}
|
1549
|
-
Packages to use for this flow. The key is the name of the package
|
1550
|
-
and the value is the version to use.
|
1551
|
-
python : str, optional, default: None
|
1552
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1553
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1554
|
-
"""
|
1555
|
-
...
|
1556
|
-
|
1557
|
-
@typing.overload
|
1558
|
-
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1559
|
-
"""
|
1560
|
-
Specifies the times when the flow should be run when running on a
|
1561
|
-
production scheduler.
|
1562
|
-
|
1563
|
-
Parameters
|
1564
|
-
----------
|
1565
|
-
hourly : bool, default False
|
1566
|
-
Run the workflow hourly.
|
1567
|
-
daily : bool, default True
|
1568
|
-
Run the workflow daily.
|
1569
|
-
weekly : bool, default False
|
1570
|
-
Run the workflow weekly.
|
1571
|
-
cron : str, optional, default None
|
1572
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1573
|
-
specified by this expression.
|
1574
|
-
timezone : str, optional, default None
|
1575
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1576
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1577
|
-
"""
|
1578
|
-
...
|
1579
|
-
|
1580
|
-
@typing.overload
|
1581
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1582
|
-
...
|
1583
|
-
|
1584
|
-
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1683
|
+
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]]:
|
1585
1684
|
"""
|
1586
|
-
|
1587
|
-
|
1685
|
+
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)
|
1686
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1687
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1688
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1689
|
+
starts only after all sensors finish.
|
1588
1690
|
|
1589
1691
|
Parameters
|
1590
1692
|
----------
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1693
|
+
timeout : int
|
1694
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1695
|
+
poke_interval : int
|
1696
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1697
|
+
mode : str
|
1698
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1699
|
+
exponential_backoff : bool
|
1700
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1701
|
+
pool : str
|
1702
|
+
the slot pool this task should run in,
|
1703
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1704
|
+
soft_fail : bool
|
1705
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1706
|
+
name : str
|
1707
|
+
Name of the sensor on Airflow
|
1708
|
+
description : str
|
1709
|
+
Description of sensor in the Airflow UI
|
1710
|
+
bucket_key : Union[str, List[str]]
|
1711
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1712
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1713
|
+
bucket_name : str
|
1714
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1715
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1716
|
+
wildcard_match : bool
|
1717
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1718
|
+
aws_conn_id : str
|
1719
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1720
|
+
verify : bool
|
1721
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1603
1722
|
"""
|
1604
1723
|
...
|
1605
1724
|
|
@@ -1706,101 +1825,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1706
1825
|
"""
|
1707
1826
|
...
|
1708
1827
|
|
1709
|
-
@typing.overload
|
1710
|
-
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]]:
|
1711
|
-
"""
|
1712
|
-
Specifies the event(s) that this flow depends on.
|
1713
|
-
|
1714
|
-
```
|
1715
|
-
@trigger(event='foo')
|
1716
|
-
```
|
1717
|
-
or
|
1718
|
-
```
|
1719
|
-
@trigger(events=['foo', 'bar'])
|
1720
|
-
```
|
1721
|
-
|
1722
|
-
Additionally, you can specify the parameter mappings
|
1723
|
-
to map event payload to Metaflow parameters for the flow.
|
1724
|
-
```
|
1725
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1726
|
-
```
|
1727
|
-
or
|
1728
|
-
```
|
1729
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1730
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1731
|
-
```
|
1732
|
-
|
1733
|
-
'parameters' can also be a list of strings and tuples like so:
|
1734
|
-
```
|
1735
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1736
|
-
```
|
1737
|
-
This is equivalent to:
|
1738
|
-
```
|
1739
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1740
|
-
```
|
1741
|
-
|
1742
|
-
Parameters
|
1743
|
-
----------
|
1744
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1745
|
-
Event dependency for this flow.
|
1746
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1747
|
-
Events dependency for this flow.
|
1748
|
-
options : Dict[str, Any], default {}
|
1749
|
-
Backend-specific configuration for tuning eventing behavior.
|
1750
|
-
|
1751
|
-
|
1752
|
-
"""
|
1753
|
-
...
|
1754
|
-
|
1755
|
-
@typing.overload
|
1756
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1757
|
-
...
|
1758
|
-
|
1759
|
-
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] = {}):
|
1760
|
-
"""
|
1761
|
-
Specifies the event(s) that this flow depends on.
|
1762
|
-
|
1763
|
-
```
|
1764
|
-
@trigger(event='foo')
|
1765
|
-
```
|
1766
|
-
or
|
1767
|
-
```
|
1768
|
-
@trigger(events=['foo', 'bar'])
|
1769
|
-
```
|
1770
|
-
|
1771
|
-
Additionally, you can specify the parameter mappings
|
1772
|
-
to map event payload to Metaflow parameters for the flow.
|
1773
|
-
```
|
1774
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1775
|
-
```
|
1776
|
-
or
|
1777
|
-
```
|
1778
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1779
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1780
|
-
```
|
1781
|
-
|
1782
|
-
'parameters' can also be a list of strings and tuples like so:
|
1783
|
-
```
|
1784
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1785
|
-
```
|
1786
|
-
This is equivalent to:
|
1787
|
-
```
|
1788
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1789
|
-
```
|
1790
|
-
|
1791
|
-
Parameters
|
1792
|
-
----------
|
1793
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1794
|
-
Event dependency for this flow.
|
1795
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1796
|
-
Events dependency for this flow.
|
1797
|
-
options : Dict[str, Any], default {}
|
1798
|
-
Backend-specific configuration for tuning eventing behavior.
|
1799
|
-
|
1800
|
-
|
1801
|
-
"""
|
1802
|
-
...
|
1803
|
-
|
1804
1828
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1805
1829
|
"""
|
1806
1830
|
Switch namespace to the one provided.
|