ob-metaflow-stubs 3.5__py2.py3-none-any.whl → 3.6__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 +486 -486
- metaflow-stubs/cards.pyi +4 -4
- metaflow-stubs/cli.pyi +3 -3
- metaflow-stubs/client/__init__.pyi +4 -4
- metaflow-stubs/client/core.pyi +6 -6
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/clone_util.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/metadata/metadata.pyi +2 -2
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +10 -4
- metaflow-stubs/metaflow_current.pyi +17 -17
- 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 +4 -4
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow.pyi +9 -5
- metaflow-stubs/plugins/airflow/airflow_cli.pyi +3 -3
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_cli.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_cli.pyi +5 -5
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- 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 +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/s3/s3.pyi +9 -6
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +3 -3
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +8 -4
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +15 -4
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +24 -7
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +127 -0
- metaflow-stubs/plugins/logs_cli.pyi +3 -3
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/tag_cli.pyi +5 -5
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +4 -2
- metaflow-stubs/procpoll.pyi +2 -2
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +14 -0
- {ob_metaflow_stubs-3.5.dist-info → ob_metaflow_stubs-3.6.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-3.6.dist-info/RECORD +138 -0
- ob_metaflow_stubs-3.5.dist-info/RECORD +0 -136
- {ob_metaflow_stubs-3.5.dist-info → ob_metaflow_stubs-3.6.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-3.5.dist-info → ob_metaflow_stubs-3.6.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.11.
|
4
|
-
# Generated on 2024-05-
|
3
|
+
# MF version: 2.11.16.1+ob(v1) #
|
4
|
+
# Generated on 2024-05-21T17:36:50.007848 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import
|
12
|
-
import metaflow.
|
13
|
-
import metaflow.plugins.datatools.s3.s3
|
14
|
-
import metaflow.events
|
11
|
+
import metaflow.metaflow_current
|
12
|
+
import metaflow.parameters
|
15
13
|
import datetime
|
14
|
+
import metaflow.events
|
15
|
+
import metaflow.datastore.inputs
|
16
|
+
import typing
|
16
17
|
import metaflow._vendor.click.types
|
17
18
|
import metaflow.client.core
|
18
19
|
import io
|
19
|
-
import metaflow.
|
20
|
-
import metaflow.metaflow_current
|
20
|
+
import metaflow.plugins.datatools.s3.s3
|
21
21
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
22
22
|
StepFlag = typing.NewType("StepFlag", bool)
|
23
23
|
|
@@ -921,6 +921,90 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
921
921
|
"""
|
922
922
|
...
|
923
923
|
|
924
|
+
@typing.overload
|
925
|
+
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]]]:
|
926
|
+
"""
|
927
|
+
Specifies the number of times the task corresponding
|
928
|
+
to a step needs to be retried.
|
929
|
+
|
930
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
931
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
932
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
933
|
+
|
934
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
935
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
936
|
+
ensuring that the flow execution can continue.
|
937
|
+
|
938
|
+
Parameters
|
939
|
+
----------
|
940
|
+
times : int, default 3
|
941
|
+
Number of times to retry this task.
|
942
|
+
minutes_between_retries : int, default 2
|
943
|
+
Number of minutes between retries.
|
944
|
+
"""
|
945
|
+
...
|
946
|
+
|
947
|
+
@typing.overload
|
948
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
949
|
+
...
|
950
|
+
|
951
|
+
@typing.overload
|
952
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
953
|
+
...
|
954
|
+
|
955
|
+
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):
|
956
|
+
"""
|
957
|
+
Specifies the number of times the task corresponding
|
958
|
+
to a step needs to be retried.
|
959
|
+
|
960
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
961
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
962
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
963
|
+
|
964
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
965
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
966
|
+
ensuring that the flow execution can continue.
|
967
|
+
|
968
|
+
Parameters
|
969
|
+
----------
|
970
|
+
times : int, default 3
|
971
|
+
Number of times to retry this task.
|
972
|
+
minutes_between_retries : int, default 2
|
973
|
+
Number of minutes between retries.
|
974
|
+
"""
|
975
|
+
...
|
976
|
+
|
977
|
+
@typing.overload
|
978
|
+
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]]]:
|
979
|
+
"""
|
980
|
+
Specifies environment variables to be set prior to the execution of a step.
|
981
|
+
|
982
|
+
Parameters
|
983
|
+
----------
|
984
|
+
vars : Dict[str, str], default {}
|
985
|
+
Dictionary of environment variables to set.
|
986
|
+
"""
|
987
|
+
...
|
988
|
+
|
989
|
+
@typing.overload
|
990
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
991
|
+
...
|
992
|
+
|
993
|
+
@typing.overload
|
994
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
995
|
+
...
|
996
|
+
|
997
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
998
|
+
"""
|
999
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1000
|
+
|
1001
|
+
Parameters
|
1002
|
+
----------
|
1003
|
+
vars : Dict[str, str], default {}
|
1004
|
+
Dictionary of environment variables to set.
|
1005
|
+
"""
|
1006
|
+
...
|
1007
|
+
|
924
1008
|
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]]]:
|
925
1009
|
"""
|
926
1010
|
Specifies that this step should execute on Kubernetes.
|
@@ -980,6 +1064,39 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
980
1064
|
"""
|
981
1065
|
...
|
982
1066
|
|
1067
|
+
@typing.overload
|
1068
|
+
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]]]:
|
1069
|
+
"""
|
1070
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1071
|
+
the execution of a step.
|
1072
|
+
|
1073
|
+
Parameters
|
1074
|
+
----------
|
1075
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1076
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1077
|
+
"""
|
1078
|
+
...
|
1079
|
+
|
1080
|
+
@typing.overload
|
1081
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1082
|
+
...
|
1083
|
+
|
1084
|
+
@typing.overload
|
1085
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1086
|
+
...
|
1087
|
+
|
1088
|
+
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]]] = []):
|
1089
|
+
"""
|
1090
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1091
|
+
the execution of a step.
|
1092
|
+
|
1093
|
+
Parameters
|
1094
|
+
----------
|
1095
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1096
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1097
|
+
"""
|
1098
|
+
...
|
1099
|
+
|
983
1100
|
@typing.overload
|
984
1101
|
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]]]:
|
985
1102
|
"""
|
@@ -1038,117 +1155,117 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1038
1155
|
...
|
1039
1156
|
|
1040
1157
|
@typing.overload
|
1041
|
-
def
|
1158
|
+
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]]]:
|
1042
1159
|
"""
|
1043
|
-
Specifies
|
1160
|
+
Specifies the resources needed when executing this step.
|
1044
1161
|
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1162
|
+
Use `@resources` to specify the resource requirements
|
1163
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1164
|
+
|
1165
|
+
You can choose the compute layer on the command line by executing e.g.
|
1166
|
+
```
|
1167
|
+
python myflow.py run --with batch
|
1168
|
+
```
|
1169
|
+
or
|
1170
|
+
```
|
1171
|
+
python myflow.py run --with kubernetes
|
1172
|
+
```
|
1173
|
+
which executes the flow on the desired system using the
|
1174
|
+
requirements specified in `@resources`.
|
1049
1175
|
|
1050
1176
|
Parameters
|
1051
1177
|
----------
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1178
|
+
cpu : int, default 1
|
1179
|
+
Number of CPUs required for this step.
|
1180
|
+
gpu : int, default 0
|
1181
|
+
Number of GPUs required for this step.
|
1182
|
+
disk : int, optional, default None
|
1183
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1184
|
+
memory : int, default 4096
|
1185
|
+
Memory size (in MB) required for this step.
|
1186
|
+
shared_memory : int, optional, default None
|
1187
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1188
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1058
1189
|
"""
|
1059
1190
|
...
|
1060
1191
|
|
1061
1192
|
@typing.overload
|
1062
|
-
def
|
1193
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1063
1194
|
...
|
1064
1195
|
|
1065
1196
|
@typing.overload
|
1066
|
-
def
|
1197
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1067
1198
|
...
|
1068
1199
|
|
1069
|
-
def
|
1200
|
+
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):
|
1070
1201
|
"""
|
1071
|
-
Specifies
|
1202
|
+
Specifies the resources needed when executing this step.
|
1072
1203
|
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1204
|
+
Use `@resources` to specify the resource requirements
|
1205
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1206
|
+
|
1207
|
+
You can choose the compute layer on the command line by executing e.g.
|
1208
|
+
```
|
1209
|
+
python myflow.py run --with batch
|
1210
|
+
```
|
1211
|
+
or
|
1212
|
+
```
|
1213
|
+
python myflow.py run --with kubernetes
|
1214
|
+
```
|
1215
|
+
which executes the flow on the desired system using the
|
1216
|
+
requirements specified in `@resources`.
|
1077
1217
|
|
1078
1218
|
Parameters
|
1079
1219
|
----------
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1220
|
+
cpu : int, default 1
|
1221
|
+
Number of CPUs required for this step.
|
1222
|
+
gpu : int, default 0
|
1223
|
+
Number of GPUs required for this step.
|
1224
|
+
disk : int, optional, default None
|
1225
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1226
|
+
memory : int, default 4096
|
1227
|
+
Memory size (in MB) required for this step.
|
1228
|
+
shared_memory : int, optional, default None
|
1229
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1230
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1086
1231
|
"""
|
1087
1232
|
...
|
1088
1233
|
|
1089
1234
|
@typing.overload
|
1090
|
-
def
|
1235
|
+
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]]]:
|
1091
1236
|
"""
|
1092
|
-
|
1093
|
-
|
1094
|
-
This decorator is useful if this step may hang indefinitely.
|
1095
|
-
|
1096
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1097
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1098
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1237
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1099
1238
|
|
1100
|
-
Note that
|
1101
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1239
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1102
1240
|
|
1103
1241
|
Parameters
|
1104
1242
|
----------
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1243
|
+
type : str, default 'default'
|
1244
|
+
Card type.
|
1245
|
+
id : str, optional, default None
|
1246
|
+
If multiple cards are present, use this id to identify this card.
|
1247
|
+
options : Dict[str, Any], default {}
|
1248
|
+
Options passed to the card. The contents depend on the card type.
|
1249
|
+
timeout : int, default 45
|
1250
|
+
Interrupt reporting if it takes more than this many seconds.
|
1251
|
+
|
1252
|
+
|
1111
1253
|
"""
|
1112
1254
|
...
|
1113
1255
|
|
1114
1256
|
@typing.overload
|
1115
|
-
def
|
1257
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1116
1258
|
...
|
1117
1259
|
|
1118
1260
|
@typing.overload
|
1119
|
-
def
|
1261
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1120
1262
|
...
|
1121
1263
|
|
1122
|
-
def
|
1264
|
+
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):
|
1123
1265
|
"""
|
1124
|
-
|
1125
|
-
|
1126
|
-
This decorator is useful if this step may hang indefinitely.
|
1127
|
-
|
1128
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1129
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1130
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1266
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1131
1267
|
|
1132
|
-
Note that
|
1133
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1134
|
-
|
1135
|
-
Parameters
|
1136
|
-
----------
|
1137
|
-
seconds : int, default 0
|
1138
|
-
Number of seconds to wait prior to timing out.
|
1139
|
-
minutes : int, default 0
|
1140
|
-
Number of minutes to wait prior to timing out.
|
1141
|
-
hours : int, default 0
|
1142
|
-
Number of hours to wait prior to timing out.
|
1143
|
-
"""
|
1144
|
-
...
|
1145
|
-
|
1146
|
-
@typing.overload
|
1147
|
-
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]]]:
|
1148
|
-
"""
|
1149
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1150
|
-
|
1151
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1268
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1152
1269
|
|
1153
1270
|
Parameters
|
1154
1271
|
----------
|
@@ -1166,443 +1283,199 @@ def card(*, type: str = "default", id: typing.Optional[str] = None, options: typ
|
|
1166
1283
|
...
|
1167
1284
|
|
1168
1285
|
@typing.overload
|
1169
|
-
def
|
1170
|
-
...
|
1171
|
-
|
1172
|
-
@typing.overload
|
1173
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1174
|
-
...
|
1175
|
-
|
1176
|
-
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):
|
1177
|
-
"""
|
1178
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1179
|
-
|
1180
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1181
|
-
|
1182
|
-
Parameters
|
1183
|
-
----------
|
1184
|
-
type : str, default 'default'
|
1185
|
-
Card type.
|
1186
|
-
id : str, optional, default None
|
1187
|
-
If multiple cards are present, use this id to identify this card.
|
1188
|
-
options : Dict[str, Any], default {}
|
1189
|
-
Options passed to the card. The contents depend on the card type.
|
1190
|
-
timeout : int, default 45
|
1191
|
-
Interrupt reporting if it takes more than this many seconds.
|
1192
|
-
|
1193
|
-
|
1194
|
-
"""
|
1195
|
-
...
|
1196
|
-
|
1197
|
-
@typing.overload
|
1198
|
-
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]]]:
|
1286
|
+
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]]]:
|
1199
1287
|
"""
|
1200
|
-
Specifies the
|
1201
|
-
|
1202
|
-
Use `@resources` to specify the resource requirements
|
1203
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1288
|
+
Specifies that the step will success under all circumstances.
|
1204
1289
|
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
or
|
1210
|
-
```
|
1211
|
-
python myflow.py run --with kubernetes
|
1212
|
-
```
|
1213
|
-
which executes the flow on the desired system using the
|
1214
|
-
requirements specified in `@resources`.
|
1290
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1291
|
+
contains the exception raised. You can use it to detect the presence
|
1292
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1293
|
+
are missing.
|
1215
1294
|
|
1216
1295
|
Parameters
|
1217
1296
|
----------
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
memory : int, default 4096
|
1225
|
-
Memory size (in MB) required for this step.
|
1226
|
-
shared_memory : int, optional, default None
|
1227
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1228
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1297
|
+
var : str, optional, default None
|
1298
|
+
Name of the artifact in which to store the caught exception.
|
1299
|
+
If not specified, the exception is not stored.
|
1300
|
+
print_exception : bool, default True
|
1301
|
+
Determines whether or not the exception is printed to
|
1302
|
+
stdout when caught.
|
1229
1303
|
"""
|
1230
1304
|
...
|
1231
1305
|
|
1232
1306
|
@typing.overload
|
1233
|
-
def
|
1307
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1234
1308
|
...
|
1235
1309
|
|
1236
1310
|
@typing.overload
|
1237
|
-
def
|
1238
|
-
...
|
1239
|
-
|
1240
|
-
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):
|
1241
|
-
"""
|
1242
|
-
Specifies the resources needed when executing this step.
|
1243
|
-
|
1244
|
-
Use `@resources` to specify the resource requirements
|
1245
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1246
|
-
|
1247
|
-
You can choose the compute layer on the command line by executing e.g.
|
1248
|
-
```
|
1249
|
-
python myflow.py run --with batch
|
1250
|
-
```
|
1251
|
-
or
|
1252
|
-
```
|
1253
|
-
python myflow.py run --with kubernetes
|
1254
|
-
```
|
1255
|
-
which executes the flow on the desired system using the
|
1256
|
-
requirements specified in `@resources`.
|
1257
|
-
|
1258
|
-
Parameters
|
1259
|
-
----------
|
1260
|
-
cpu : int, default 1
|
1261
|
-
Number of CPUs required for this step.
|
1262
|
-
gpu : int, default 0
|
1263
|
-
Number of GPUs required for this step.
|
1264
|
-
disk : int, optional, default None
|
1265
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1266
|
-
memory : int, default 4096
|
1267
|
-
Memory size (in MB) required for this step.
|
1268
|
-
shared_memory : int, optional, default None
|
1269
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1270
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1271
|
-
"""
|
1311
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1272
1312
|
...
|
1273
1313
|
|
1274
|
-
|
1275
|
-
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]]]:
|
1314
|
+
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):
|
1276
1315
|
"""
|
1277
|
-
Specifies the
|
1278
|
-
to a step needs to be retried.
|
1279
|
-
|
1280
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1281
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1282
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1316
|
+
Specifies that the step will success under all circumstances.
|
1283
1317
|
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1318
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1319
|
+
contains the exception raised. You can use it to detect the presence
|
1320
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1321
|
+
are missing.
|
1287
1322
|
|
1288
1323
|
Parameters
|
1289
1324
|
----------
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1325
|
+
var : str, optional, default None
|
1326
|
+
Name of the artifact in which to store the caught exception.
|
1327
|
+
If not specified, the exception is not stored.
|
1328
|
+
print_exception : bool, default True
|
1329
|
+
Determines whether or not the exception is printed to
|
1330
|
+
stdout when caught.
|
1294
1331
|
"""
|
1295
1332
|
...
|
1296
1333
|
|
1297
1334
|
@typing.overload
|
1298
|
-
def
|
1299
|
-
...
|
1300
|
-
|
1301
|
-
@typing.overload
|
1302
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1303
|
-
...
|
1304
|
-
|
1305
|
-
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):
|
1335
|
+
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]]]:
|
1306
1336
|
"""
|
1307
|
-
Specifies
|
1308
|
-
to a step needs to be retried.
|
1309
|
-
|
1310
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1311
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1312
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1313
|
-
|
1314
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1315
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1316
|
-
ensuring that the flow execution can continue.
|
1337
|
+
Specifies a timeout for your step.
|
1317
1338
|
|
1318
|
-
|
1319
|
-
----------
|
1320
|
-
times : int, default 3
|
1321
|
-
Number of times to retry this task.
|
1322
|
-
minutes_between_retries : int, default 2
|
1323
|
-
Number of minutes between retries.
|
1324
|
-
"""
|
1325
|
-
...
|
1326
|
-
|
1327
|
-
@typing.overload
|
1328
|
-
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]]]:
|
1329
|
-
"""
|
1330
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
1331
|
-
the execution of a step.
|
1339
|
+
This decorator is useful if this step may hang indefinitely.
|
1332
1340
|
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
List of secret specs, defining how the secrets are to be retrieved
|
1337
|
-
"""
|
1338
|
-
...
|
1339
|
-
|
1340
|
-
@typing.overload
|
1341
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1342
|
-
...
|
1343
|
-
|
1344
|
-
@typing.overload
|
1345
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1346
|
-
...
|
1347
|
-
|
1348
|
-
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]]] = []):
|
1349
|
-
"""
|
1350
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
1351
|
-
the execution of a step.
|
1341
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1342
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1343
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1352
1344
|
|
1353
|
-
|
1354
|
-
|
1355
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
1356
|
-
List of secret specs, defining how the secrets are to be retrieved
|
1357
|
-
"""
|
1358
|
-
...
|
1359
|
-
|
1360
|
-
@typing.overload
|
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]]]:
|
1362
|
-
"""
|
1363
|
-
Specifies environment variables to be set prior to the execution of a step.
|
1345
|
+
Note that all the values specified in parameters are added together so if you specify
|
1346
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1364
1347
|
|
1365
1348
|
Parameters
|
1366
1349
|
----------
|
1367
|
-
|
1368
|
-
|
1350
|
+
seconds : int, default 0
|
1351
|
+
Number of seconds to wait prior to timing out.
|
1352
|
+
minutes : int, default 0
|
1353
|
+
Number of minutes to wait prior to timing out.
|
1354
|
+
hours : int, default 0
|
1355
|
+
Number of hours to wait prior to timing out.
|
1369
1356
|
"""
|
1370
1357
|
...
|
1371
1358
|
|
1372
1359
|
@typing.overload
|
1373
|
-
def
|
1360
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1374
1361
|
...
|
1375
1362
|
|
1376
1363
|
@typing.overload
|
1377
|
-
def
|
1378
|
-
...
|
1379
|
-
|
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] = {}):
|
1381
|
-
"""
|
1382
|
-
Specifies environment variables to be set prior to the execution of a step.
|
1383
|
-
|
1384
|
-
Parameters
|
1385
|
-
----------
|
1386
|
-
vars : Dict[str, str], default {}
|
1387
|
-
Dictionary of environment variables to set.
|
1388
|
-
"""
|
1364
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1389
1365
|
...
|
1390
1366
|
|
1391
|
-
|
1392
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1367
|
+
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):
|
1393
1368
|
"""
|
1394
|
-
Specifies
|
1369
|
+
Specifies a timeout for your step.
|
1395
1370
|
|
1396
|
-
|
1397
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1398
|
-
Parameters
|
1399
|
-
----------
|
1400
|
-
packages : Dict[str, str], default: {}
|
1401
|
-
Packages to use for this flow. The key is the name of the package
|
1402
|
-
and the value is the version to use.
|
1403
|
-
python : str, optional, default: None
|
1404
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1405
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1406
|
-
"""
|
1407
|
-
...
|
1408
|
-
|
1409
|
-
@typing.overload
|
1410
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1411
|
-
...
|
1412
|
-
|
1413
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1414
|
-
"""
|
1415
|
-
Specifies the PyPI packages for all steps of the flow.
|
1371
|
+
This decorator is useful if this step may hang indefinitely.
|
1416
1372
|
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
----------
|
1421
|
-
packages : Dict[str, str], default: {}
|
1422
|
-
Packages to use for this flow. The key is the name of the package
|
1423
|
-
and the value is the version to use.
|
1424
|
-
python : str, optional, default: None
|
1425
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1426
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1427
|
-
"""
|
1428
|
-
...
|
1429
|
-
|
1430
|
-
def airflow_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]]:
|
1431
|
-
"""
|
1432
|
-
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.
|
1433
|
-
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.
|
1373
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1374
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1375
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1434
1376
|
|
1435
|
-
|
1436
|
-
|
1437
|
-
timeout : int
|
1438
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1439
|
-
poke_interval : int
|
1440
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1441
|
-
mode : str
|
1442
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1443
|
-
exponential_backoff : bool
|
1444
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1445
|
-
pool : str
|
1446
|
-
the slot pool this task should run in,
|
1447
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1448
|
-
soft_fail : bool
|
1449
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1450
|
-
name : str
|
1451
|
-
Name of the sensor on Airflow
|
1452
|
-
description : str
|
1453
|
-
Description of sensor in the Airflow UI
|
1454
|
-
external_dag_id : str
|
1455
|
-
The dag_id that contains the task you want to wait for.
|
1456
|
-
external_task_ids : List[str]
|
1457
|
-
The list of task_ids that you want to wait for.
|
1458
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1459
|
-
allowed_states : List[str]
|
1460
|
-
Iterable of allowed states, (Default: ['success'])
|
1461
|
-
failed_states : List[str]
|
1462
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1463
|
-
execution_delta : datetime.timedelta
|
1464
|
-
time difference with the previous execution to look at,
|
1465
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1466
|
-
check_existence: bool
|
1467
|
-
Set to True to check if the external task exists or check if
|
1468
|
-
the DAG to wait for exists. (Default: True)
|
1469
|
-
"""
|
1470
|
-
...
|
1471
|
-
|
1472
|
-
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]]:
|
1473
|
-
"""
|
1474
|
-
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)
|
1475
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1476
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1477
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1478
|
-
starts only after all sensors finish.
|
1377
|
+
Note that all the values specified in parameters are added together so if you specify
|
1378
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1479
1379
|
|
1480
1380
|
Parameters
|
1481
1381
|
----------
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
exponential_backoff : bool
|
1489
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1490
|
-
pool : str
|
1491
|
-
the slot pool this task should run in,
|
1492
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1493
|
-
soft_fail : bool
|
1494
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1495
|
-
name : str
|
1496
|
-
Name of the sensor on Airflow
|
1497
|
-
description : str
|
1498
|
-
Description of sensor in the Airflow UI
|
1499
|
-
bucket_key : Union[str, List[str]]
|
1500
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1501
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1502
|
-
bucket_name : str
|
1503
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1504
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1505
|
-
wildcard_match : bool
|
1506
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1507
|
-
aws_conn_id : str
|
1508
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1509
|
-
verify : bool
|
1510
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1382
|
+
seconds : int, default 0
|
1383
|
+
Number of seconds to wait prior to timing out.
|
1384
|
+
minutes : int, default 0
|
1385
|
+
Number of minutes to wait prior to timing out.
|
1386
|
+
hours : int, default 0
|
1387
|
+
Number of hours to wait prior to timing out.
|
1511
1388
|
"""
|
1512
1389
|
...
|
1513
1390
|
|
1514
1391
|
@typing.overload
|
1515
|
-
def
|
1392
|
+
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]]:
|
1516
1393
|
"""
|
1517
|
-
Specifies the
|
1518
|
-
|
1519
|
-
```
|
1520
|
-
@trigger(event='foo')
|
1521
|
-
```
|
1522
|
-
or
|
1523
|
-
```
|
1524
|
-
@trigger(events=['foo', 'bar'])
|
1525
|
-
```
|
1526
|
-
|
1527
|
-
Additionally, you can specify the parameter mappings
|
1528
|
-
to map event payload to Metaflow parameters for the flow.
|
1529
|
-
```
|
1530
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1531
|
-
```
|
1532
|
-
or
|
1533
|
-
```
|
1534
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1535
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1536
|
-
```
|
1537
|
-
|
1538
|
-
'parameters' can also be a list of strings and tuples like so:
|
1539
|
-
```
|
1540
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1541
|
-
```
|
1542
|
-
This is equivalent to:
|
1543
|
-
```
|
1544
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1545
|
-
```
|
1394
|
+
Specifies the times when the flow should be run when running on a
|
1395
|
+
production scheduler.
|
1546
1396
|
|
1547
1397
|
Parameters
|
1548
1398
|
----------
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1399
|
+
hourly : bool, default False
|
1400
|
+
Run the workflow hourly.
|
1401
|
+
daily : bool, default True
|
1402
|
+
Run the workflow daily.
|
1403
|
+
weekly : bool, default False
|
1404
|
+
Run the workflow weekly.
|
1405
|
+
cron : str, optional, default None
|
1406
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1407
|
+
specified by this expression.
|
1408
|
+
timezone : str, optional, default None
|
1409
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1410
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1557
1411
|
"""
|
1558
1412
|
...
|
1559
1413
|
|
1560
1414
|
@typing.overload
|
1561
|
-
def
|
1562
|
-
...
|
1563
|
-
|
1564
|
-
def
|
1565
|
-
"""
|
1566
|
-
Specifies the
|
1567
|
-
|
1568
|
-
```
|
1569
|
-
@trigger(event='foo')
|
1570
|
-
```
|
1571
|
-
or
|
1572
|
-
```
|
1573
|
-
@trigger(events=['foo', 'bar'])
|
1574
|
-
```
|
1575
|
-
|
1576
|
-
Additionally, you can specify the parameter mappings
|
1577
|
-
to map event payload to Metaflow parameters for the flow.
|
1578
|
-
```
|
1579
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1580
|
-
```
|
1581
|
-
or
|
1582
|
-
```
|
1583
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1584
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1585
|
-
```
|
1586
|
-
|
1587
|
-
'parameters' can also be a list of strings and tuples like so:
|
1588
|
-
```
|
1589
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1590
|
-
```
|
1591
|
-
This is equivalent to:
|
1592
|
-
```
|
1593
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1594
|
-
```
|
1415
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1416
|
+
...
|
1417
|
+
|
1418
|
+
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):
|
1419
|
+
"""
|
1420
|
+
Specifies the times when the flow should be run when running on a
|
1421
|
+
production scheduler.
|
1595
1422
|
|
1596
1423
|
Parameters
|
1597
1424
|
----------
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1425
|
+
hourly : bool, default False
|
1426
|
+
Run the workflow hourly.
|
1427
|
+
daily : bool, default True
|
1428
|
+
Run the workflow daily.
|
1429
|
+
weekly : bool, default False
|
1430
|
+
Run the workflow weekly.
|
1431
|
+
cron : str, optional, default None
|
1432
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1433
|
+
specified by this expression.
|
1434
|
+
timezone : str, optional, default None
|
1435
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1436
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1437
|
+
"""
|
1438
|
+
...
|
1439
|
+
|
1440
|
+
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]]:
|
1441
|
+
"""
|
1442
|
+
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)
|
1443
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1444
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1445
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1446
|
+
starts only after all sensors finish.
|
1605
1447
|
|
1448
|
+
Parameters
|
1449
|
+
----------
|
1450
|
+
timeout : int
|
1451
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1452
|
+
poke_interval : int
|
1453
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1454
|
+
mode : str
|
1455
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1456
|
+
exponential_backoff : bool
|
1457
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1458
|
+
pool : str
|
1459
|
+
the slot pool this task should run in,
|
1460
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1461
|
+
soft_fail : bool
|
1462
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1463
|
+
name : str
|
1464
|
+
Name of the sensor on Airflow
|
1465
|
+
description : str
|
1466
|
+
Description of sensor in the Airflow UI
|
1467
|
+
bucket_key : Union[str, List[str]]
|
1468
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1469
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1470
|
+
bucket_name : str
|
1471
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1472
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1473
|
+
wildcard_match : bool
|
1474
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1475
|
+
aws_conn_id : str
|
1476
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1477
|
+
verify : bool
|
1478
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1606
1479
|
"""
|
1607
1480
|
...
|
1608
1481
|
|
@@ -1655,6 +1528,48 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1655
1528
|
"""
|
1656
1529
|
...
|
1657
1530
|
|
1531
|
+
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]]:
|
1532
|
+
"""
|
1533
|
+
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.
|
1534
|
+
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.
|
1535
|
+
|
1536
|
+
Parameters
|
1537
|
+
----------
|
1538
|
+
timeout : int
|
1539
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1540
|
+
poke_interval : int
|
1541
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1542
|
+
mode : str
|
1543
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1544
|
+
exponential_backoff : bool
|
1545
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1546
|
+
pool : str
|
1547
|
+
the slot pool this task should run in,
|
1548
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1549
|
+
soft_fail : bool
|
1550
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1551
|
+
name : str
|
1552
|
+
Name of the sensor on Airflow
|
1553
|
+
description : str
|
1554
|
+
Description of sensor in the Airflow UI
|
1555
|
+
external_dag_id : str
|
1556
|
+
The dag_id that contains the task you want to wait for.
|
1557
|
+
external_task_ids : List[str]
|
1558
|
+
The list of task_ids that you want to wait for.
|
1559
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1560
|
+
allowed_states : List[str]
|
1561
|
+
Iterable of allowed states, (Default: ['success'])
|
1562
|
+
failed_states : List[str]
|
1563
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1564
|
+
execution_delta : datetime.timedelta
|
1565
|
+
time difference with the previous execution to look at,
|
1566
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1567
|
+
check_existence: bool
|
1568
|
+
Set to True to check if the external task exists or check if
|
1569
|
+
the DAG to wait for exists. (Default: True)
|
1570
|
+
"""
|
1571
|
+
...
|
1572
|
+
|
1658
1573
|
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1659
1574
|
"""
|
1660
1575
|
Specifies what flows belong to the same project.
|
@@ -1674,51 +1589,41 @@ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typ
|
|
1674
1589
|
...
|
1675
1590
|
|
1676
1591
|
@typing.overload
|
1677
|
-
def
|
1592
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1678
1593
|
"""
|
1679
|
-
Specifies the
|
1680
|
-
production scheduler.
|
1594
|
+
Specifies the PyPI packages for all steps of the flow.
|
1681
1595
|
|
1596
|
+
Use `@pypi_base` to set common packages required by all
|
1597
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1682
1598
|
Parameters
|
1683
1599
|
----------
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
cron : str, optional, default None
|
1691
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1692
|
-
specified by this expression.
|
1693
|
-
timezone : str, optional, default None
|
1694
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1695
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1600
|
+
packages : Dict[str, str], default: {}
|
1601
|
+
Packages to use for this flow. The key is the name of the package
|
1602
|
+
and the value is the version to use.
|
1603
|
+
python : str, optional, default: None
|
1604
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1605
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1696
1606
|
"""
|
1697
1607
|
...
|
1698
1608
|
|
1699
1609
|
@typing.overload
|
1700
|
-
def
|
1610
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1701
1611
|
...
|
1702
1612
|
|
1703
|
-
def
|
1613
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1704
1614
|
"""
|
1705
|
-
Specifies the
|
1706
|
-
production scheduler.
|
1615
|
+
Specifies the PyPI packages for all steps of the flow.
|
1707
1616
|
|
1617
|
+
Use `@pypi_base` to set common packages required by all
|
1618
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1708
1619
|
Parameters
|
1709
1620
|
----------
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
cron : str, optional, default None
|
1717
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1718
|
-
specified by this expression.
|
1719
|
-
timezone : str, optional, default None
|
1720
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1721
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1621
|
+
packages : Dict[str, str], default: {}
|
1622
|
+
Packages to use for this flow. The key is the name of the package
|
1623
|
+
and the value is the version to use.
|
1624
|
+
python : str, optional, default: None
|
1625
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1626
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1722
1627
|
"""
|
1723
1628
|
...
|
1724
1629
|
|
@@ -1825,6 +1730,101 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1825
1730
|
"""
|
1826
1731
|
...
|
1827
1732
|
|
1733
|
+
@typing.overload
|
1734
|
+
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]]:
|
1735
|
+
"""
|
1736
|
+
Specifies the event(s) that this flow depends on.
|
1737
|
+
|
1738
|
+
```
|
1739
|
+
@trigger(event='foo')
|
1740
|
+
```
|
1741
|
+
or
|
1742
|
+
```
|
1743
|
+
@trigger(events=['foo', 'bar'])
|
1744
|
+
```
|
1745
|
+
|
1746
|
+
Additionally, you can specify the parameter mappings
|
1747
|
+
to map event payload to Metaflow parameters for the flow.
|
1748
|
+
```
|
1749
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1750
|
+
```
|
1751
|
+
or
|
1752
|
+
```
|
1753
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1754
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1755
|
+
```
|
1756
|
+
|
1757
|
+
'parameters' can also be a list of strings and tuples like so:
|
1758
|
+
```
|
1759
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1760
|
+
```
|
1761
|
+
This is equivalent to:
|
1762
|
+
```
|
1763
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1764
|
+
```
|
1765
|
+
|
1766
|
+
Parameters
|
1767
|
+
----------
|
1768
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1769
|
+
Event dependency for this flow.
|
1770
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1771
|
+
Events dependency for this flow.
|
1772
|
+
options : Dict[str, Any], default {}
|
1773
|
+
Backend-specific configuration for tuning eventing behavior.
|
1774
|
+
|
1775
|
+
|
1776
|
+
"""
|
1777
|
+
...
|
1778
|
+
|
1779
|
+
@typing.overload
|
1780
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1781
|
+
...
|
1782
|
+
|
1783
|
+
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] = {}):
|
1784
|
+
"""
|
1785
|
+
Specifies the event(s) that this flow depends on.
|
1786
|
+
|
1787
|
+
```
|
1788
|
+
@trigger(event='foo')
|
1789
|
+
```
|
1790
|
+
or
|
1791
|
+
```
|
1792
|
+
@trigger(events=['foo', 'bar'])
|
1793
|
+
```
|
1794
|
+
|
1795
|
+
Additionally, you can specify the parameter mappings
|
1796
|
+
to map event payload to Metaflow parameters for the flow.
|
1797
|
+
```
|
1798
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1799
|
+
```
|
1800
|
+
or
|
1801
|
+
```
|
1802
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1803
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1804
|
+
```
|
1805
|
+
|
1806
|
+
'parameters' can also be a list of strings and tuples like so:
|
1807
|
+
```
|
1808
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1809
|
+
```
|
1810
|
+
This is equivalent to:
|
1811
|
+
```
|
1812
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1813
|
+
```
|
1814
|
+
|
1815
|
+
Parameters
|
1816
|
+
----------
|
1817
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1818
|
+
Event dependency for this flow.
|
1819
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1820
|
+
Events dependency for this flow.
|
1821
|
+
options : Dict[str, Any], default {}
|
1822
|
+
Backend-specific configuration for tuning eventing behavior.
|
1823
|
+
|
1824
|
+
|
1825
|
+
"""
|
1826
|
+
...
|
1827
|
+
|
1828
1828
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1829
1829
|
"""
|
1830
1830
|
Switch namespace to the one provided.
|