metaflow-stubs 2.12.1__py2.py3-none-any.whl → 2.12.2__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 +620 -620
- metaflow-stubs/cards.pyi +6 -6
- metaflow-stubs/cli.pyi +3 -23
- metaflow-stubs/client/__init__.pyi +4 -4
- metaflow-stubs/client/core.pyi +7 -7
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/clone_util.pyi +2 -2
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +3 -3
- 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 +18 -18
- 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 +3 -3
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow.pyi +4 -4
- 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 +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +5 -5
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_cli.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +4 -4
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +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 +5 -5
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +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 +3 -3
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +4 -4
- metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/s3/s3.pyi +5 -5
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +3 -3
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +4 -4
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +4 -4
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +3 -3
- metaflow-stubs/plugins/logs_cli.pyi +4 -4
- 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 +2 -2
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/tag_cli.pyi +5 -5
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +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/metaflow_runner.pyi +4 -4
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.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.1.dist-info → metaflow_stubs-2.12.2.dist-info}/METADATA +2 -2
- metaflow_stubs-2.12.2.dist-info/RECORD +142 -0
- metaflow_stubs-2.12.1.dist-info/RECORD +0 -142
- {metaflow_stubs-2.12.1.dist-info → metaflow_stubs-2.12.2.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.12.1.dist-info → metaflow_stubs-2.12.2.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-06-
|
3
|
+
# MF version: 2.12.2 #
|
4
|
+
# Generated on 2024-06-04T07:19:10.055768 #
|
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.datastore.inputs
|
11
12
|
import metaflow.plugins.datatools.s3.s3
|
12
13
|
import metaflow._vendor.click.types
|
13
|
-
import
|
14
|
-
import
|
14
|
+
import metaflow.metaflow_current
|
15
|
+
import metaflow.runner.metaflow_runner
|
16
|
+
import metaflow.parameters
|
17
|
+
import metaflow.client.core
|
15
18
|
import metaflow.events
|
16
19
|
import datetime
|
17
|
-
import
|
18
|
-
import
|
19
|
-
import metaflow.parameters
|
20
|
-
import metaflow.runner.metaflow_runner
|
21
|
-
import metaflow.metaflow_current
|
20
|
+
import io
|
21
|
+
import typing
|
22
22
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
23
23
|
StepFlag = typing.NewType("StepFlag", bool)
|
24
24
|
|
@@ -726,86 +726,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
726
726
|
"""
|
727
727
|
...
|
728
728
|
|
729
|
-
@typing.overload
|
730
|
-
def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
731
|
-
"""
|
732
|
-
Specifies the PyPI packages for the step.
|
733
|
-
|
734
|
-
Information in this decorator will augment any
|
735
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
736
|
-
you can use `@pypi_base` to set packages required by all
|
737
|
-
steps and use `@pypi` to specify step-specific overrides.
|
738
|
-
|
739
|
-
Parameters
|
740
|
-
----------
|
741
|
-
packages : Dict[str, str], default: {}
|
742
|
-
Packages to use for this step. The key is the name of the package
|
743
|
-
and the value is the version to use.
|
744
|
-
python : str, optional, default: None
|
745
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
746
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
747
|
-
"""
|
748
|
-
...
|
749
|
-
|
750
|
-
@typing.overload
|
751
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
752
|
-
...
|
753
|
-
|
754
|
-
@typing.overload
|
755
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
756
|
-
...
|
757
|
-
|
758
|
-
def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
759
|
-
"""
|
760
|
-
Specifies the PyPI packages for the step.
|
761
|
-
|
762
|
-
Information in this decorator will augment any
|
763
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
764
|
-
you can use `@pypi_base` to set packages required by all
|
765
|
-
steps and use `@pypi` to specify step-specific overrides.
|
766
|
-
|
767
|
-
Parameters
|
768
|
-
----------
|
769
|
-
packages : Dict[str, str], default: {}
|
770
|
-
Packages to use for this step. The key is the name of the package
|
771
|
-
and the value is the version to use.
|
772
|
-
python : str, optional, default: None
|
773
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
774
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
775
|
-
"""
|
776
|
-
...
|
777
|
-
|
778
|
-
@typing.overload
|
779
|
-
def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
780
|
-
"""
|
781
|
-
Specifies environment variables to be set prior to the execution of a step.
|
782
|
-
|
783
|
-
Parameters
|
784
|
-
----------
|
785
|
-
vars : Dict[str, str], default {}
|
786
|
-
Dictionary of environment variables to set.
|
787
|
-
"""
|
788
|
-
...
|
789
|
-
|
790
|
-
@typing.overload
|
791
|
-
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
792
|
-
...
|
793
|
-
|
794
|
-
@typing.overload
|
795
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
796
|
-
...
|
797
|
-
|
798
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
799
|
-
"""
|
800
|
-
Specifies environment variables to be set prior to the execution of a step.
|
801
|
-
|
802
|
-
Parameters
|
803
|
-
----------
|
804
|
-
vars : Dict[str, str], default {}
|
805
|
-
Dictionary of environment variables to set.
|
806
|
-
"""
|
807
|
-
...
|
808
|
-
|
809
729
|
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
810
730
|
"""
|
811
731
|
Specifies that this step should execute on Kubernetes.
|
@@ -865,134 +785,6 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
865
785
|
"""
|
866
786
|
...
|
867
787
|
|
868
|
-
@typing.overload
|
869
|
-
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]]]:
|
870
|
-
"""
|
871
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
872
|
-
|
873
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
874
|
-
|
875
|
-
Parameters
|
876
|
-
----------
|
877
|
-
type : str, default 'default'
|
878
|
-
Card type.
|
879
|
-
id : str, optional, default None
|
880
|
-
If multiple cards are present, use this id to identify this card.
|
881
|
-
options : Dict[str, Any], default {}
|
882
|
-
Options passed to the card. The contents depend on the card type.
|
883
|
-
timeout : int, default 45
|
884
|
-
Interrupt reporting if it takes more than this many seconds.
|
885
|
-
|
886
|
-
|
887
|
-
"""
|
888
|
-
...
|
889
|
-
|
890
|
-
@typing.overload
|
891
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
892
|
-
...
|
893
|
-
|
894
|
-
@typing.overload
|
895
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
896
|
-
...
|
897
|
-
|
898
|
-
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):
|
899
|
-
"""
|
900
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
901
|
-
|
902
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
903
|
-
|
904
|
-
Parameters
|
905
|
-
----------
|
906
|
-
type : str, default 'default'
|
907
|
-
Card type.
|
908
|
-
id : str, optional, default None
|
909
|
-
If multiple cards are present, use this id to identify this card.
|
910
|
-
options : Dict[str, Any], default {}
|
911
|
-
Options passed to the card. The contents depend on the card type.
|
912
|
-
timeout : int, default 45
|
913
|
-
Interrupt reporting if it takes more than this many seconds.
|
914
|
-
|
915
|
-
|
916
|
-
"""
|
917
|
-
...
|
918
|
-
|
919
|
-
@typing.overload
|
920
|
-
def resources(*, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
921
|
-
"""
|
922
|
-
Specifies the resources needed when executing this step.
|
923
|
-
|
924
|
-
Use `@resources` to specify the resource requirements
|
925
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
926
|
-
|
927
|
-
You can choose the compute layer on the command line by executing e.g.
|
928
|
-
```
|
929
|
-
python myflow.py run --with batch
|
930
|
-
```
|
931
|
-
or
|
932
|
-
```
|
933
|
-
python myflow.py run --with kubernetes
|
934
|
-
```
|
935
|
-
which executes the flow on the desired system using the
|
936
|
-
requirements specified in `@resources`.
|
937
|
-
|
938
|
-
Parameters
|
939
|
-
----------
|
940
|
-
cpu : int, default 1
|
941
|
-
Number of CPUs required for this step.
|
942
|
-
gpu : int, default 0
|
943
|
-
Number of GPUs required for this step.
|
944
|
-
disk : int, optional, default None
|
945
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
946
|
-
memory : int, default 4096
|
947
|
-
Memory size (in MB) required for this step.
|
948
|
-
shared_memory : int, optional, default None
|
949
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
950
|
-
This parameter maps to the `--shm-size` option in Docker.
|
951
|
-
"""
|
952
|
-
...
|
953
|
-
|
954
|
-
@typing.overload
|
955
|
-
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
956
|
-
...
|
957
|
-
|
958
|
-
@typing.overload
|
959
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
960
|
-
...
|
961
|
-
|
962
|
-
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
963
|
-
"""
|
964
|
-
Specifies the resources needed when executing this step.
|
965
|
-
|
966
|
-
Use `@resources` to specify the resource requirements
|
967
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
968
|
-
|
969
|
-
You can choose the compute layer on the command line by executing e.g.
|
970
|
-
```
|
971
|
-
python myflow.py run --with batch
|
972
|
-
```
|
973
|
-
or
|
974
|
-
```
|
975
|
-
python myflow.py run --with kubernetes
|
976
|
-
```
|
977
|
-
which executes the flow on the desired system using the
|
978
|
-
requirements specified in `@resources`.
|
979
|
-
|
980
|
-
Parameters
|
981
|
-
----------
|
982
|
-
cpu : int, default 1
|
983
|
-
Number of CPUs required for this step.
|
984
|
-
gpu : int, default 0
|
985
|
-
Number of GPUs required for this step.
|
986
|
-
disk : int, optional, default None
|
987
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
988
|
-
memory : int, default 4096
|
989
|
-
Memory size (in MB) required for this step.
|
990
|
-
shared_memory : int, optional, default None
|
991
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
992
|
-
This parameter maps to the `--shm-size` option in Docker.
|
993
|
-
"""
|
994
|
-
...
|
995
|
-
|
996
788
|
@typing.overload
|
997
789
|
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]]]:
|
998
790
|
"""
|
@@ -1051,55 +843,33 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1051
843
|
...
|
1052
844
|
|
1053
845
|
@typing.overload
|
1054
|
-
def
|
846
|
+
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]]]:
|
1055
847
|
"""
|
1056
|
-
Specifies
|
1057
|
-
to a step needs to be retried.
|
1058
|
-
|
1059
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1060
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1061
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1062
|
-
|
1063
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1064
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1065
|
-
ensuring that the flow execution can continue.
|
848
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1066
849
|
|
1067
850
|
Parameters
|
1068
851
|
----------
|
1069
|
-
|
1070
|
-
|
1071
|
-
minutes_between_retries : int, default 2
|
1072
|
-
Number of minutes between retries.
|
852
|
+
vars : Dict[str, str], default {}
|
853
|
+
Dictionary of environment variables to set.
|
1073
854
|
"""
|
1074
855
|
...
|
1075
856
|
|
1076
857
|
@typing.overload
|
1077
|
-
def
|
858
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1078
859
|
...
|
1079
860
|
|
1080
861
|
@typing.overload
|
1081
|
-
def
|
862
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1082
863
|
...
|
1083
864
|
|
1084
|
-
def
|
865
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1085
866
|
"""
|
1086
|
-
Specifies
|
1087
|
-
to a step needs to be retried.
|
1088
|
-
|
1089
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1090
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1091
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1092
|
-
|
1093
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1094
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1095
|
-
ensuring that the flow execution can continue.
|
867
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1096
868
|
|
1097
869
|
Parameters
|
1098
870
|
----------
|
1099
|
-
|
1100
|
-
|
1101
|
-
minutes_between_retries : int, default 2
|
1102
|
-
Number of minutes between retries.
|
871
|
+
vars : Dict[str, str], default {}
|
872
|
+
Dictionary of environment variables to set.
|
1103
873
|
"""
|
1104
874
|
...
|
1105
875
|
|
@@ -1136,63 +906,6 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
1136
906
|
"""
|
1137
907
|
...
|
1138
908
|
|
1139
|
-
@typing.overload
|
1140
|
-
def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1141
|
-
"""
|
1142
|
-
Specifies a timeout for your step.
|
1143
|
-
|
1144
|
-
This decorator is useful if this step may hang indefinitely.
|
1145
|
-
|
1146
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1147
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1148
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1149
|
-
|
1150
|
-
Note that all the values specified in parameters are added together so if you specify
|
1151
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1152
|
-
|
1153
|
-
Parameters
|
1154
|
-
----------
|
1155
|
-
seconds : int, default 0
|
1156
|
-
Number of seconds to wait prior to timing out.
|
1157
|
-
minutes : int, default 0
|
1158
|
-
Number of minutes to wait prior to timing out.
|
1159
|
-
hours : int, default 0
|
1160
|
-
Number of hours to wait prior to timing out.
|
1161
|
-
"""
|
1162
|
-
...
|
1163
|
-
|
1164
|
-
@typing.overload
|
1165
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1166
|
-
...
|
1167
|
-
|
1168
|
-
@typing.overload
|
1169
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1170
|
-
...
|
1171
|
-
|
1172
|
-
def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
1173
|
-
"""
|
1174
|
-
Specifies a timeout for your step.
|
1175
|
-
|
1176
|
-
This decorator is useful if this step may hang indefinitely.
|
1177
|
-
|
1178
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1179
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1180
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1181
|
-
|
1182
|
-
Note that all the values specified in parameters are added together so if you specify
|
1183
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1184
|
-
|
1185
|
-
Parameters
|
1186
|
-
----------
|
1187
|
-
seconds : int, default 0
|
1188
|
-
Number of seconds to wait prior to timing out.
|
1189
|
-
minutes : int, default 0
|
1190
|
-
Number of minutes to wait prior to timing out.
|
1191
|
-
hours : int, default 0
|
1192
|
-
Number of hours to wait prior to timing out.
|
1193
|
-
"""
|
1194
|
-
...
|
1195
|
-
|
1196
909
|
@typing.overload
|
1197
910
|
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]]]:
|
1198
911
|
"""
|
@@ -1389,156 +1102,640 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1389
1102
|
"""
|
1390
1103
|
...
|
1391
1104
|
|
1392
|
-
|
1105
|
+
@typing.overload
|
1106
|
+
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]]]:
|
1393
1107
|
"""
|
1394
|
-
|
1395
|
-
|
1108
|
+
Specifies the PyPI packages for the step.
|
1109
|
+
|
1110
|
+
Information in this decorator will augment any
|
1111
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1112
|
+
you can use `@pypi_base` to set packages required by all
|
1113
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1396
1114
|
|
1397
1115
|
Parameters
|
1398
1116
|
----------
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
exponential_backoff : bool
|
1406
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1407
|
-
pool : str
|
1408
|
-
the slot pool this task should run in,
|
1409
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1410
|
-
soft_fail : bool
|
1411
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1412
|
-
name : str
|
1413
|
-
Name of the sensor on Airflow
|
1414
|
-
description : str
|
1415
|
-
Description of sensor in the Airflow UI
|
1416
|
-
external_dag_id : str
|
1417
|
-
The dag_id that contains the task you want to wait for.
|
1418
|
-
external_task_ids : List[str]
|
1419
|
-
The list of task_ids that you want to wait for.
|
1420
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1421
|
-
allowed_states : List[str]
|
1422
|
-
Iterable of allowed states, (Default: ['success'])
|
1423
|
-
failed_states : List[str]
|
1424
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1425
|
-
execution_delta : datetime.timedelta
|
1426
|
-
time difference with the previous execution to look at,
|
1427
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1428
|
-
check_existence: bool
|
1429
|
-
Set to True to check if the external task exists or check if
|
1430
|
-
the DAG to wait for exists. (Default: True)
|
1117
|
+
packages : Dict[str, str], default: {}
|
1118
|
+
Packages to use for this step. The key is the name of the package
|
1119
|
+
and the value is the version to use.
|
1120
|
+
python : str, optional, default: None
|
1121
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1122
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1431
1123
|
"""
|
1432
1124
|
...
|
1433
1125
|
|
1434
1126
|
@typing.overload
|
1435
|
-
def
|
1127
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1128
|
+
...
|
1129
|
+
|
1130
|
+
@typing.overload
|
1131
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1132
|
+
...
|
1133
|
+
|
1134
|
+
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):
|
1436
1135
|
"""
|
1437
|
-
Specifies the
|
1438
|
-
|
1439
|
-
```
|
1440
|
-
@trigger(event='foo')
|
1441
|
-
```
|
1442
|
-
or
|
1443
|
-
```
|
1444
|
-
@trigger(events=['foo', 'bar'])
|
1445
|
-
```
|
1446
|
-
|
1447
|
-
Additionally, you can specify the parameter mappings
|
1448
|
-
to map event payload to Metaflow parameters for the flow.
|
1449
|
-
```
|
1450
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1451
|
-
```
|
1452
|
-
or
|
1453
|
-
```
|
1454
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1455
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1456
|
-
```
|
1136
|
+
Specifies the PyPI packages for the step.
|
1457
1137
|
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
This is equivalent to:
|
1463
|
-
```
|
1464
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1465
|
-
```
|
1138
|
+
Information in this decorator will augment any
|
1139
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1140
|
+
you can use `@pypi_base` to set packages required by all
|
1141
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1466
1142
|
|
1467
1143
|
Parameters
|
1468
1144
|
----------
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1145
|
+
packages : Dict[str, str], default: {}
|
1146
|
+
Packages to use for this step. The key is the name of the package
|
1147
|
+
and the value is the version to use.
|
1148
|
+
python : str, optional, default: None
|
1149
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1150
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1151
|
+
"""
|
1152
|
+
...
|
1153
|
+
|
1154
|
+
@typing.overload
|
1155
|
+
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]]]:
|
1156
|
+
"""
|
1157
|
+
Specifies the number of times the task corresponding
|
1158
|
+
to a step needs to be retried.
|
1475
1159
|
|
1160
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1161
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1162
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1163
|
+
|
1164
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1165
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1166
|
+
ensuring that the flow execution can continue.
|
1476
1167
|
|
1168
|
+
Parameters
|
1169
|
+
----------
|
1170
|
+
times : int, default 3
|
1171
|
+
Number of times to retry this task.
|
1172
|
+
minutes_between_retries : int, default 2
|
1173
|
+
Number of minutes between retries.
|
1477
1174
|
"""
|
1478
1175
|
...
|
1479
1176
|
|
1480
1177
|
@typing.overload
|
1481
|
-
def
|
1178
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1482
1179
|
...
|
1483
1180
|
|
1484
|
-
|
1181
|
+
@typing.overload
|
1182
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1183
|
+
...
|
1184
|
+
|
1185
|
+
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):
|
1485
1186
|
"""
|
1486
|
-
Specifies the
|
1487
|
-
|
1488
|
-
```
|
1489
|
-
@trigger(event='foo')
|
1490
|
-
```
|
1491
|
-
or
|
1492
|
-
```
|
1493
|
-
@trigger(events=['foo', 'bar'])
|
1494
|
-
```
|
1187
|
+
Specifies the number of times the task corresponding
|
1188
|
+
to a step needs to be retried.
|
1495
1189
|
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1500
|
-
```
|
1501
|
-
or
|
1502
|
-
```
|
1503
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1504
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1505
|
-
```
|
1190
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1191
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1192
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1506
1193
|
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
```
|
1511
|
-
This is equivalent to:
|
1512
|
-
```
|
1513
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1514
|
-
```
|
1194
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1195
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1196
|
+
ensuring that the flow execution can continue.
|
1515
1197
|
|
1516
1198
|
Parameters
|
1517
1199
|
----------
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
options : Dict[str, Any], default {}
|
1523
|
-
Backend-specific configuration for tuning eventing behavior.
|
1524
|
-
|
1525
|
-
|
1200
|
+
times : int, default 3
|
1201
|
+
Number of times to retry this task.
|
1202
|
+
minutes_between_retries : int, default 2
|
1203
|
+
Number of minutes between retries.
|
1526
1204
|
"""
|
1527
1205
|
...
|
1528
1206
|
|
1529
1207
|
@typing.overload
|
1530
|
-
def
|
1208
|
+
def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1531
1209
|
"""
|
1532
|
-
Specifies
|
1210
|
+
Specifies a timeout for your step.
|
1533
1211
|
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1212
|
+
This decorator is useful if this step may hang indefinitely.
|
1213
|
+
|
1214
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1215
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1216
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1217
|
+
|
1218
|
+
Note that all the values specified in parameters are added together so if you specify
|
1219
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1220
|
+
|
1221
|
+
Parameters
|
1222
|
+
----------
|
1223
|
+
seconds : int, default 0
|
1224
|
+
Number of seconds to wait prior to timing out.
|
1225
|
+
minutes : int, default 0
|
1226
|
+
Number of minutes to wait prior to timing out.
|
1227
|
+
hours : int, default 0
|
1228
|
+
Number of hours to wait prior to timing out.
|
1229
|
+
"""
|
1230
|
+
...
|
1231
|
+
|
1232
|
+
@typing.overload
|
1233
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1234
|
+
...
|
1235
|
+
|
1236
|
+
@typing.overload
|
1237
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1238
|
+
...
|
1239
|
+
|
1240
|
+
def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
1241
|
+
"""
|
1242
|
+
Specifies a timeout for your step.
|
1243
|
+
|
1244
|
+
This decorator is useful if this step may hang indefinitely.
|
1245
|
+
|
1246
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1247
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1248
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1249
|
+
|
1250
|
+
Note that all the values specified in parameters are added together so if you specify
|
1251
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1252
|
+
|
1253
|
+
Parameters
|
1254
|
+
----------
|
1255
|
+
seconds : int, default 0
|
1256
|
+
Number of seconds to wait prior to timing out.
|
1257
|
+
minutes : int, default 0
|
1258
|
+
Number of minutes to wait prior to timing out.
|
1259
|
+
hours : int, default 0
|
1260
|
+
Number of hours to wait prior to timing out.
|
1261
|
+
"""
|
1262
|
+
...
|
1263
|
+
|
1264
|
+
@typing.overload
|
1265
|
+
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]]]:
|
1266
|
+
"""
|
1267
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1268
|
+
|
1269
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1270
|
+
|
1271
|
+
Parameters
|
1272
|
+
----------
|
1273
|
+
type : str, default 'default'
|
1274
|
+
Card type.
|
1275
|
+
id : str, optional, default None
|
1276
|
+
If multiple cards are present, use this id to identify this card.
|
1277
|
+
options : Dict[str, Any], default {}
|
1278
|
+
Options passed to the card. The contents depend on the card type.
|
1279
|
+
timeout : int, default 45
|
1280
|
+
Interrupt reporting if it takes more than this many seconds.
|
1281
|
+
|
1282
|
+
|
1283
|
+
"""
|
1284
|
+
...
|
1285
|
+
|
1286
|
+
@typing.overload
|
1287
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1288
|
+
...
|
1289
|
+
|
1290
|
+
@typing.overload
|
1291
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1292
|
+
...
|
1293
|
+
|
1294
|
+
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):
|
1295
|
+
"""
|
1296
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1297
|
+
|
1298
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1299
|
+
|
1300
|
+
Parameters
|
1301
|
+
----------
|
1302
|
+
type : str, default 'default'
|
1303
|
+
Card type.
|
1304
|
+
id : str, optional, default None
|
1305
|
+
If multiple cards are present, use this id to identify this card.
|
1306
|
+
options : Dict[str, Any], default {}
|
1307
|
+
Options passed to the card. The contents depend on the card type.
|
1308
|
+
timeout : int, default 45
|
1309
|
+
Interrupt reporting if it takes more than this many seconds.
|
1310
|
+
|
1311
|
+
|
1312
|
+
"""
|
1313
|
+
...
|
1314
|
+
|
1315
|
+
@typing.overload
|
1316
|
+
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]]]:
|
1317
|
+
"""
|
1318
|
+
Specifies the resources needed when executing this step.
|
1319
|
+
|
1320
|
+
Use `@resources` to specify the resource requirements
|
1321
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1322
|
+
|
1323
|
+
You can choose the compute layer on the command line by executing e.g.
|
1324
|
+
```
|
1325
|
+
python myflow.py run --with batch
|
1326
|
+
```
|
1327
|
+
or
|
1328
|
+
```
|
1329
|
+
python myflow.py run --with kubernetes
|
1330
|
+
```
|
1331
|
+
which executes the flow on the desired system using the
|
1332
|
+
requirements specified in `@resources`.
|
1333
|
+
|
1334
|
+
Parameters
|
1335
|
+
----------
|
1336
|
+
cpu : int, default 1
|
1337
|
+
Number of CPUs required for this step.
|
1338
|
+
gpu : int, default 0
|
1339
|
+
Number of GPUs required for this step.
|
1340
|
+
disk : int, optional, default None
|
1341
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1342
|
+
memory : int, default 4096
|
1343
|
+
Memory size (in MB) required for this step.
|
1344
|
+
shared_memory : int, optional, default None
|
1345
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1346
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1347
|
+
"""
|
1348
|
+
...
|
1349
|
+
|
1350
|
+
@typing.overload
|
1351
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1352
|
+
...
|
1353
|
+
|
1354
|
+
@typing.overload
|
1355
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1356
|
+
...
|
1357
|
+
|
1358
|
+
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):
|
1359
|
+
"""
|
1360
|
+
Specifies the resources needed when executing this step.
|
1361
|
+
|
1362
|
+
Use `@resources` to specify the resource requirements
|
1363
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1364
|
+
|
1365
|
+
You can choose the compute layer on the command line by executing e.g.
|
1366
|
+
```
|
1367
|
+
python myflow.py run --with batch
|
1368
|
+
```
|
1369
|
+
or
|
1370
|
+
```
|
1371
|
+
python myflow.py run --with kubernetes
|
1372
|
+
```
|
1373
|
+
which executes the flow on the desired system using the
|
1374
|
+
requirements specified in `@resources`.
|
1375
|
+
|
1376
|
+
Parameters
|
1377
|
+
----------
|
1378
|
+
cpu : int, default 1
|
1379
|
+
Number of CPUs required for this step.
|
1380
|
+
gpu : int, default 0
|
1381
|
+
Number of GPUs required for this step.
|
1382
|
+
disk : int, optional, default None
|
1383
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1384
|
+
memory : int, default 4096
|
1385
|
+
Memory size (in MB) required for this step.
|
1386
|
+
shared_memory : int, optional, default None
|
1387
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1388
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1389
|
+
"""
|
1390
|
+
...
|
1391
|
+
|
1392
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1393
|
+
"""
|
1394
|
+
Specifies what flows belong to the same project.
|
1395
|
+
|
1396
|
+
A project-specific namespace is created for all flows that
|
1397
|
+
use the same `@project(name)`.
|
1398
|
+
|
1399
|
+
Parameters
|
1400
|
+
----------
|
1401
|
+
name : str
|
1402
|
+
Project name. Make sure that the name is unique amongst all
|
1403
|
+
projects that use the same production scheduler. The name may
|
1404
|
+
contain only lowercase alphanumeric characters and underscores.
|
1405
|
+
|
1406
|
+
|
1407
|
+
"""
|
1408
|
+
...
|
1409
|
+
|
1410
|
+
@typing.overload
|
1411
|
+
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]]:
|
1412
|
+
"""
|
1413
|
+
Specifies the times when the flow should be run when running on a
|
1414
|
+
production scheduler.
|
1415
|
+
|
1416
|
+
Parameters
|
1417
|
+
----------
|
1418
|
+
hourly : bool, default False
|
1419
|
+
Run the workflow hourly.
|
1420
|
+
daily : bool, default True
|
1421
|
+
Run the workflow daily.
|
1422
|
+
weekly : bool, default False
|
1423
|
+
Run the workflow weekly.
|
1424
|
+
cron : str, optional, default None
|
1425
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1426
|
+
specified by this expression.
|
1427
|
+
timezone : str, optional, default None
|
1428
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1429
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1430
|
+
"""
|
1431
|
+
...
|
1432
|
+
|
1433
|
+
@typing.overload
|
1434
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1435
|
+
...
|
1436
|
+
|
1437
|
+
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):
|
1438
|
+
"""
|
1439
|
+
Specifies the times when the flow should be run when running on a
|
1440
|
+
production scheduler.
|
1441
|
+
|
1442
|
+
Parameters
|
1443
|
+
----------
|
1444
|
+
hourly : bool, default False
|
1445
|
+
Run the workflow hourly.
|
1446
|
+
daily : bool, default True
|
1447
|
+
Run the workflow daily.
|
1448
|
+
weekly : bool, default False
|
1449
|
+
Run the workflow weekly.
|
1450
|
+
cron : str, optional, default None
|
1451
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1452
|
+
specified by this expression.
|
1453
|
+
timezone : str, optional, default None
|
1454
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1455
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1456
|
+
"""
|
1457
|
+
...
|
1458
|
+
|
1459
|
+
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]]:
|
1460
|
+
"""
|
1461
|
+
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)
|
1462
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1463
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1464
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1465
|
+
starts only after all sensors finish.
|
1466
|
+
|
1467
|
+
Parameters
|
1468
|
+
----------
|
1469
|
+
timeout : int
|
1470
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1471
|
+
poke_interval : int
|
1472
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1473
|
+
mode : str
|
1474
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1475
|
+
exponential_backoff : bool
|
1476
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1477
|
+
pool : str
|
1478
|
+
the slot pool this task should run in,
|
1479
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1480
|
+
soft_fail : bool
|
1481
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1482
|
+
name : str
|
1483
|
+
Name of the sensor on Airflow
|
1484
|
+
description : str
|
1485
|
+
Description of sensor in the Airflow UI
|
1486
|
+
bucket_key : Union[str, List[str]]
|
1487
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1488
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1489
|
+
bucket_name : str
|
1490
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1491
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1492
|
+
wildcard_match : bool
|
1493
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1494
|
+
aws_conn_id : str
|
1495
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1496
|
+
verify : bool
|
1497
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1498
|
+
"""
|
1499
|
+
...
|
1500
|
+
|
1501
|
+
@typing.overload
|
1502
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1503
|
+
"""
|
1504
|
+
Specifies the PyPI packages for all steps of the flow.
|
1505
|
+
|
1506
|
+
Use `@pypi_base` to set common packages required by all
|
1507
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1508
|
+
Parameters
|
1509
|
+
----------
|
1510
|
+
packages : Dict[str, str], default: {}
|
1511
|
+
Packages to use for this flow. The key is the name of the package
|
1512
|
+
and the value is the version to use.
|
1513
|
+
python : str, optional, default: None
|
1514
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1515
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1516
|
+
"""
|
1517
|
+
...
|
1518
|
+
|
1519
|
+
@typing.overload
|
1520
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1521
|
+
...
|
1522
|
+
|
1523
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1524
|
+
"""
|
1525
|
+
Specifies the PyPI packages for all steps of the flow.
|
1526
|
+
|
1527
|
+
Use `@pypi_base` to set common packages required by all
|
1528
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1529
|
+
Parameters
|
1530
|
+
----------
|
1531
|
+
packages : Dict[str, str], default: {}
|
1532
|
+
Packages to use for this flow. The key is the name of the package
|
1533
|
+
and the value is the version to use.
|
1534
|
+
python : str, optional, default: None
|
1535
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1536
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1537
|
+
"""
|
1538
|
+
...
|
1539
|
+
|
1540
|
+
@typing.overload
|
1541
|
+
def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1542
|
+
"""
|
1543
|
+
Specifies the Conda environment for all steps of the flow.
|
1544
|
+
|
1545
|
+
Use `@conda_base` to set common libraries required by all
|
1546
|
+
steps and use `@conda` to specify step-specific additions.
|
1547
|
+
|
1548
|
+
Parameters
|
1549
|
+
----------
|
1550
|
+
packages : Dict[str, str], default {}
|
1551
|
+
Packages to use for this flow. The key is the name of the package
|
1552
|
+
and the value is the version to use.
|
1553
|
+
libraries : Dict[str, str], default {}
|
1554
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1555
|
+
python : str, optional, default None
|
1556
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1557
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1558
|
+
disabled : bool, default False
|
1559
|
+
If set to True, disables Conda.
|
1560
|
+
"""
|
1561
|
+
...
|
1562
|
+
|
1563
|
+
@typing.overload
|
1564
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1565
|
+
...
|
1566
|
+
|
1567
|
+
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1568
|
+
"""
|
1569
|
+
Specifies the Conda environment for all steps of the flow.
|
1570
|
+
|
1571
|
+
Use `@conda_base` to set common libraries required by all
|
1572
|
+
steps and use `@conda` to specify step-specific additions.
|
1573
|
+
|
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
|
+
libraries : Dict[str, str], default {}
|
1580
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1581
|
+
python : str, optional, default None
|
1582
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1583
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1584
|
+
disabled : bool, default False
|
1585
|
+
If set to True, disables Conda.
|
1586
|
+
"""
|
1587
|
+
...
|
1588
|
+
|
1589
|
+
def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1590
|
+
"""
|
1591
|
+
The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
|
1592
|
+
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1593
|
+
|
1594
|
+
Parameters
|
1595
|
+
----------
|
1596
|
+
timeout : int
|
1597
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1598
|
+
poke_interval : int
|
1599
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1600
|
+
mode : str
|
1601
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1602
|
+
exponential_backoff : bool
|
1603
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1604
|
+
pool : str
|
1605
|
+
the slot pool this task should run in,
|
1606
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1607
|
+
soft_fail : bool
|
1608
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1609
|
+
name : str
|
1610
|
+
Name of the sensor on Airflow
|
1611
|
+
description : str
|
1612
|
+
Description of sensor in the Airflow UI
|
1613
|
+
external_dag_id : str
|
1614
|
+
The dag_id that contains the task you want to wait for.
|
1615
|
+
external_task_ids : List[str]
|
1616
|
+
The list of task_ids that you want to wait for.
|
1617
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1618
|
+
allowed_states : List[str]
|
1619
|
+
Iterable of allowed states, (Default: ['success'])
|
1620
|
+
failed_states : List[str]
|
1621
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1622
|
+
execution_delta : datetime.timedelta
|
1623
|
+
time difference with the previous execution to look at,
|
1624
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1625
|
+
check_existence: bool
|
1626
|
+
Set to True to check if the external task exists or check if
|
1627
|
+
the DAG to wait for exists. (Default: True)
|
1628
|
+
"""
|
1629
|
+
...
|
1630
|
+
|
1631
|
+
@typing.overload
|
1632
|
+
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]]:
|
1633
|
+
"""
|
1634
|
+
Specifies the event(s) that this flow depends on.
|
1635
|
+
|
1636
|
+
```
|
1637
|
+
@trigger(event='foo')
|
1638
|
+
```
|
1639
|
+
or
|
1640
|
+
```
|
1641
|
+
@trigger(events=['foo', 'bar'])
|
1642
|
+
```
|
1643
|
+
|
1644
|
+
Additionally, you can specify the parameter mappings
|
1645
|
+
to map event payload to Metaflow parameters for the flow.
|
1646
|
+
```
|
1647
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1648
|
+
```
|
1649
|
+
or
|
1650
|
+
```
|
1651
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1652
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1653
|
+
```
|
1654
|
+
|
1655
|
+
'parameters' can also be a list of strings and tuples like so:
|
1656
|
+
```
|
1657
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1658
|
+
```
|
1659
|
+
This is equivalent to:
|
1660
|
+
```
|
1661
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1662
|
+
```
|
1663
|
+
|
1664
|
+
Parameters
|
1665
|
+
----------
|
1666
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1667
|
+
Event dependency for this flow.
|
1668
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1669
|
+
Events dependency for this flow.
|
1670
|
+
options : Dict[str, Any], default {}
|
1671
|
+
Backend-specific configuration for tuning eventing behavior.
|
1672
|
+
|
1673
|
+
|
1674
|
+
"""
|
1675
|
+
...
|
1676
|
+
|
1677
|
+
@typing.overload
|
1678
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1679
|
+
...
|
1680
|
+
|
1681
|
+
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] = {}):
|
1682
|
+
"""
|
1683
|
+
Specifies the event(s) that this flow depends on.
|
1684
|
+
|
1685
|
+
```
|
1686
|
+
@trigger(event='foo')
|
1687
|
+
```
|
1688
|
+
or
|
1689
|
+
```
|
1690
|
+
@trigger(events=['foo', 'bar'])
|
1691
|
+
```
|
1692
|
+
|
1693
|
+
Additionally, you can specify the parameter mappings
|
1694
|
+
to map event payload to Metaflow parameters for the flow.
|
1695
|
+
```
|
1696
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1697
|
+
```
|
1698
|
+
or
|
1699
|
+
```
|
1700
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1701
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1702
|
+
```
|
1703
|
+
|
1704
|
+
'parameters' can also be a list of strings and tuples like so:
|
1705
|
+
```
|
1706
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1707
|
+
```
|
1708
|
+
This is equivalent to:
|
1709
|
+
```
|
1710
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1711
|
+
```
|
1712
|
+
|
1713
|
+
Parameters
|
1714
|
+
----------
|
1715
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1716
|
+
Event dependency for this flow.
|
1717
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1718
|
+
Events dependency for this flow.
|
1719
|
+
options : Dict[str, Any], default {}
|
1720
|
+
Backend-specific configuration for tuning eventing behavior.
|
1721
|
+
|
1722
|
+
|
1723
|
+
"""
|
1724
|
+
...
|
1725
|
+
|
1726
|
+
@typing.overload
|
1727
|
+
def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[str, str], None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1728
|
+
"""
|
1729
|
+
Specifies the flow(s) that this flow depends on.
|
1730
|
+
|
1731
|
+
```
|
1732
|
+
@trigger_on_finish(flow='FooFlow')
|
1733
|
+
```
|
1734
|
+
or
|
1735
|
+
```
|
1736
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1737
|
+
```
|
1738
|
+
This decorator respects the @project decorator and triggers the flow
|
1542
1739
|
when upstream runs within the same namespace complete successfully
|
1543
1740
|
|
1544
1741
|
Additionally, you can specify project aware upstream flow dependencies
|
@@ -1629,203 +1826,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1629
1826
|
"""
|
1630
1827
|
...
|
1631
1828
|
|
1632
|
-
def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1633
|
-
"""
|
1634
|
-
The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
|
1635
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1636
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1637
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1638
|
-
starts only after all sensors finish.
|
1639
|
-
|
1640
|
-
Parameters
|
1641
|
-
----------
|
1642
|
-
timeout : int
|
1643
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1644
|
-
poke_interval : int
|
1645
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1646
|
-
mode : str
|
1647
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1648
|
-
exponential_backoff : bool
|
1649
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1650
|
-
pool : str
|
1651
|
-
the slot pool this task should run in,
|
1652
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1653
|
-
soft_fail : bool
|
1654
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1655
|
-
name : str
|
1656
|
-
Name of the sensor on Airflow
|
1657
|
-
description : str
|
1658
|
-
Description of sensor in the Airflow UI
|
1659
|
-
bucket_key : Union[str, List[str]]
|
1660
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1661
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1662
|
-
bucket_name : str
|
1663
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1664
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1665
|
-
wildcard_match : bool
|
1666
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1667
|
-
aws_conn_id : str
|
1668
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1669
|
-
verify : bool
|
1670
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1671
|
-
"""
|
1672
|
-
...
|
1673
|
-
|
1674
|
-
@typing.overload
|
1675
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1676
|
-
"""
|
1677
|
-
Specifies the PyPI packages for all steps of the flow.
|
1678
|
-
|
1679
|
-
Use `@pypi_base` to set common packages required by all
|
1680
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1681
|
-
Parameters
|
1682
|
-
----------
|
1683
|
-
packages : Dict[str, str], default: {}
|
1684
|
-
Packages to use for this flow. The key is the name of the package
|
1685
|
-
and the value is the version to use.
|
1686
|
-
python : str, optional, default: None
|
1687
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1688
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1689
|
-
"""
|
1690
|
-
...
|
1691
|
-
|
1692
|
-
@typing.overload
|
1693
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1694
|
-
...
|
1695
|
-
|
1696
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1697
|
-
"""
|
1698
|
-
Specifies the PyPI packages for all steps of the flow.
|
1699
|
-
|
1700
|
-
Use `@pypi_base` to set common packages required by all
|
1701
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1702
|
-
Parameters
|
1703
|
-
----------
|
1704
|
-
packages : Dict[str, str], default: {}
|
1705
|
-
Packages to use for this flow. The key is the name of the package
|
1706
|
-
and the value is the version to use.
|
1707
|
-
python : str, optional, default: None
|
1708
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1709
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1710
|
-
"""
|
1711
|
-
...
|
1712
|
-
|
1713
|
-
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1714
|
-
"""
|
1715
|
-
Specifies what flows belong to the same project.
|
1716
|
-
|
1717
|
-
A project-specific namespace is created for all flows that
|
1718
|
-
use the same `@project(name)`.
|
1719
|
-
|
1720
|
-
Parameters
|
1721
|
-
----------
|
1722
|
-
name : str
|
1723
|
-
Project name. Make sure that the name is unique amongst all
|
1724
|
-
projects that use the same production scheduler. The name may
|
1725
|
-
contain only lowercase alphanumeric characters and underscores.
|
1726
|
-
|
1727
|
-
|
1728
|
-
"""
|
1729
|
-
...
|
1730
|
-
|
1731
|
-
@typing.overload
|
1732
|
-
def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1733
|
-
"""
|
1734
|
-
Specifies the Conda environment for all steps of the flow.
|
1735
|
-
|
1736
|
-
Use `@conda_base` to set common libraries required by all
|
1737
|
-
steps and use `@conda` to specify step-specific additions.
|
1738
|
-
|
1739
|
-
Parameters
|
1740
|
-
----------
|
1741
|
-
packages : Dict[str, str], default {}
|
1742
|
-
Packages to use for this flow. The key is the name of the package
|
1743
|
-
and the value is the version to use.
|
1744
|
-
libraries : Dict[str, str], default {}
|
1745
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1746
|
-
python : str, optional, default None
|
1747
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1748
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1749
|
-
disabled : bool, default False
|
1750
|
-
If set to True, disables Conda.
|
1751
|
-
"""
|
1752
|
-
...
|
1753
|
-
|
1754
|
-
@typing.overload
|
1755
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1756
|
-
...
|
1757
|
-
|
1758
|
-
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1759
|
-
"""
|
1760
|
-
Specifies the Conda environment for all steps of the flow.
|
1761
|
-
|
1762
|
-
Use `@conda_base` to set common libraries required by all
|
1763
|
-
steps and use `@conda` to specify step-specific additions.
|
1764
|
-
|
1765
|
-
Parameters
|
1766
|
-
----------
|
1767
|
-
packages : Dict[str, str], default {}
|
1768
|
-
Packages to use for this flow. The key is the name of the package
|
1769
|
-
and the value is the version to use.
|
1770
|
-
libraries : Dict[str, str], default {}
|
1771
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1772
|
-
python : str, optional, default None
|
1773
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1774
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1775
|
-
disabled : bool, default False
|
1776
|
-
If set to True, disables Conda.
|
1777
|
-
"""
|
1778
|
-
...
|
1779
|
-
|
1780
|
-
@typing.overload
|
1781
|
-
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1782
|
-
"""
|
1783
|
-
Specifies the times when the flow should be run when running on a
|
1784
|
-
production scheduler.
|
1785
|
-
|
1786
|
-
Parameters
|
1787
|
-
----------
|
1788
|
-
hourly : bool, default False
|
1789
|
-
Run the workflow hourly.
|
1790
|
-
daily : bool, default True
|
1791
|
-
Run the workflow daily.
|
1792
|
-
weekly : bool, default False
|
1793
|
-
Run the workflow weekly.
|
1794
|
-
cron : str, optional, default None
|
1795
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1796
|
-
specified by this expression.
|
1797
|
-
timezone : str, optional, default None
|
1798
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1799
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1800
|
-
"""
|
1801
|
-
...
|
1802
|
-
|
1803
|
-
@typing.overload
|
1804
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1805
|
-
...
|
1806
|
-
|
1807
|
-
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):
|
1808
|
-
"""
|
1809
|
-
Specifies the times when the flow should be run when running on a
|
1810
|
-
production scheduler.
|
1811
|
-
|
1812
|
-
Parameters
|
1813
|
-
----------
|
1814
|
-
hourly : bool, default False
|
1815
|
-
Run the workflow hourly.
|
1816
|
-
daily : bool, default True
|
1817
|
-
Run the workflow daily.
|
1818
|
-
weekly : bool, default False
|
1819
|
-
Run the workflow weekly.
|
1820
|
-
cron : str, optional, default None
|
1821
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1822
|
-
specified by this expression.
|
1823
|
-
timezone : str, optional, default None
|
1824
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1825
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1826
|
-
"""
|
1827
|
-
...
|
1828
|
-
|
1829
1829
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1830
1830
|
"""
|
1831
1831
|
Switch namespace to the one provided.
|