ob-metaflow-stubs 3.7__py2.py3-none-any.whl → 3.9__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 +608 -408
- metaflow-stubs/cards.pyi +5 -5
- metaflow-stubs/cli.pyi +31 -26
- metaflow-stubs/client/__init__.pyi +3 -3
- metaflow-stubs/client/core.pyi +9 -9
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/clone_util.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +8 -7
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +5 -5
- metaflow-stubs/metadata/metadata.pyi +3 -3
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +6 -4
- 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 +11 -5
- metaflow-stubs/plugins/__init__.pyi +3 -3
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow.pyi +3 -3
- metaflow-stubs/plugins/airflow/airflow_cli.pyi +3 -3
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +4 -4
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +4 -4
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +5 -5
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +5 -5
- 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 +2 -2
- 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 +4 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/s3/s3.pyi +8 -7
- 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 +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +4 -4
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/logs_cli.pyi +3 -3
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/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 +5 -5
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +4 -4
- 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 +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/procpoll.pyi +2 -2
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +9 -0
- metaflow-stubs/runner/metaflow_runner.pyi +696 -0
- metaflow-stubs/runner/nbrun.pyi +224 -0
- metaflow-stubs/runner/subprocess_manager.pyi +221 -0
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- {ob_metaflow_stubs-3.7.dist-info → ob_metaflow_stubs-3.9.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-3.9.dist-info/RECORD +142 -0
- ob_metaflow_stubs-3.7.dist-info/RECORD +0 -138
- {ob_metaflow_stubs-3.7.dist-info → ob_metaflow_stubs-3.9.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-3.7.dist-info → ob_metaflow_stubs-3.9.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,23 +1,25 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.4.2+ob(v1) #
|
4
|
+
# Generated on 2024-06-19T18:39:56.270719 #
|
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.client.core
|
12
|
-
import metaflow.metaflow_current
|
13
|
-
import io
|
14
|
-
import metaflow.events
|
15
|
-
import datetime
|
16
|
-
import metaflow.parameters
|
17
|
-
import metaflow.datastore.inputs
|
18
|
-
import typing
|
19
11
|
import metaflow.plugins.datatools.s3.s3
|
20
12
|
import metaflow._vendor.click.types
|
13
|
+
import typing
|
14
|
+
import metaflow.events
|
15
|
+
import metaflow.metaflow_current
|
16
|
+
import metaflow.datastore.inputs
|
17
|
+
import metaflow.client.core
|
18
|
+
import metaflow.runner.metaflow_runner
|
19
|
+
import metaflow.parameters
|
20
|
+
import metaflow.flowspec
|
21
|
+
import datetime
|
22
|
+
import io
|
21
23
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
22
24
|
StepFlag = typing.NewType("StepFlag", bool)
|
23
25
|
|
@@ -104,7 +106,7 @@ def metadata(ms: str) -> str:
|
|
104
106
|
"""
|
105
107
|
...
|
106
108
|
|
107
|
-
class FlowSpec(object, metaclass=
|
109
|
+
class FlowSpec(object, metaclass=metaflow.flowspec._FlowSpecMeta):
|
108
110
|
def __init__(self, use_cli = True):
|
109
111
|
"""
|
110
112
|
Construct a FlowSpec
|
@@ -783,79 +785,51 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
783
785
|
...
|
784
786
|
|
785
787
|
@typing.overload
|
786
|
-
def
|
788
|
+
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]]]:
|
787
789
|
"""
|
788
|
-
Specifies the
|
789
|
-
|
790
|
-
Use `@resources` to specify the resource requirements
|
791
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
790
|
+
Specifies that the step will success under all circumstances.
|
792
791
|
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
or
|
798
|
-
```
|
799
|
-
python myflow.py run --with kubernetes
|
800
|
-
```
|
801
|
-
which executes the flow on the desired system using the
|
802
|
-
requirements specified in `@resources`.
|
792
|
+
The decorator will create an optional artifact, specified by `var`, which
|
793
|
+
contains the exception raised. You can use it to detect the presence
|
794
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
795
|
+
are missing.
|
803
796
|
|
804
797
|
Parameters
|
805
798
|
----------
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
memory : int, default 4096
|
813
|
-
Memory size (in MB) required for this step.
|
814
|
-
shared_memory : int, optional, default None
|
815
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
816
|
-
This parameter maps to the `--shm-size` option in Docker.
|
799
|
+
var : str, optional, default None
|
800
|
+
Name of the artifact in which to store the caught exception.
|
801
|
+
If not specified, the exception is not stored.
|
802
|
+
print_exception : bool, default True
|
803
|
+
Determines whether or not the exception is printed to
|
804
|
+
stdout when caught.
|
817
805
|
"""
|
818
806
|
...
|
819
807
|
|
820
808
|
@typing.overload
|
821
|
-
def
|
809
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
822
810
|
...
|
823
811
|
|
824
812
|
@typing.overload
|
825
|
-
def
|
813
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
826
814
|
...
|
827
815
|
|
828
|
-
def
|
816
|
+
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):
|
829
817
|
"""
|
830
|
-
Specifies the
|
831
|
-
|
832
|
-
Use `@resources` to specify the resource requirements
|
833
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
818
|
+
Specifies that the step will success under all circumstances.
|
834
819
|
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
or
|
840
|
-
```
|
841
|
-
python myflow.py run --with kubernetes
|
842
|
-
```
|
843
|
-
which executes the flow on the desired system using the
|
844
|
-
requirements specified in `@resources`.
|
820
|
+
The decorator will create an optional artifact, specified by `var`, which
|
821
|
+
contains the exception raised. You can use it to detect the presence
|
822
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
823
|
+
are missing.
|
845
824
|
|
846
825
|
Parameters
|
847
826
|
----------
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
memory : int, default 4096
|
855
|
-
Memory size (in MB) required for this step.
|
856
|
-
shared_memory : int, optional, default None
|
857
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
858
|
-
This parameter maps to the `--shm-size` option in Docker.
|
827
|
+
var : str, optional, default None
|
828
|
+
Name of the artifact in which to store the caught exception.
|
829
|
+
If not specified, the exception is not stored.
|
830
|
+
print_exception : bool, default True
|
831
|
+
Determines whether or not the exception is printed to
|
832
|
+
stdout when caught.
|
859
833
|
"""
|
860
834
|
...
|
861
835
|
|
@@ -968,149 +942,55 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
968
942
|
...
|
969
943
|
|
970
944
|
@typing.overload
|
971
|
-
def
|
945
|
+
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]]]:
|
972
946
|
"""
|
973
|
-
Specifies
|
947
|
+
Specifies the number of times the task corresponding
|
948
|
+
to a step needs to be retried.
|
949
|
+
|
950
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
951
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
952
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
953
|
+
|
954
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
955
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
956
|
+
ensuring that the flow execution can continue.
|
974
957
|
|
975
958
|
Parameters
|
976
959
|
----------
|
977
|
-
|
978
|
-
Number of
|
979
|
-
|
980
|
-
|
981
|
-
Number of GPUs required for this step. If `@resources` is
|
982
|
-
also present, the maximum value from all decorators is used.
|
983
|
-
memory : int, default 4096
|
984
|
-
Memory size (in MB) required for this step. If
|
985
|
-
`@resources` is also present, the maximum value from all decorators is
|
986
|
-
used.
|
987
|
-
image : str, optional, default None
|
988
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
989
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
990
|
-
not, a default Docker image mapping to the current version of Python is used.
|
991
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
992
|
-
AWS Batch Job Queue to submit the job to.
|
993
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
994
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
995
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
996
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
997
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
998
|
-
shared_memory : int, optional, default None
|
999
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1000
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1001
|
-
max_swap : int, optional, default None
|
1002
|
-
The total amount of swap memory (in MiB) a container can use for this
|
1003
|
-
step. This parameter is translated to the `--memory-swap` option in
|
1004
|
-
Docker where the value is the sum of the container memory plus the
|
1005
|
-
`max_swap` value.
|
1006
|
-
swappiness : int, optional, default None
|
1007
|
-
This allows you to tune memory swappiness behavior for this step.
|
1008
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
1009
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
1010
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
1011
|
-
use_tmpfs : bool, default False
|
1012
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
1013
|
-
not available on Fargate compute environments
|
1014
|
-
tmpfs_tempdir : bool, default True
|
1015
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1016
|
-
tmpfs_size : int, optional, default None
|
1017
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1018
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1019
|
-
memory allocated for this step.
|
1020
|
-
tmpfs_path : str, optional, default None
|
1021
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1022
|
-
inferentia : int, default 0
|
1023
|
-
Number of Inferentia chips required for this step.
|
1024
|
-
trainium : int, default None
|
1025
|
-
Alias for inferentia. Use only one of the two.
|
1026
|
-
efa : int, default 0
|
1027
|
-
Number of elastic fabric adapter network devices to attach to container
|
1028
|
-
ephemeral_storage: int, default None
|
1029
|
-
The total amount, in GiB, of ephemeral storage to set for the task (21-200)
|
1030
|
-
This is only relevant for Fargate compute environments
|
1031
|
-
log_driver: str, optional, default None
|
1032
|
-
The log driver to use for the Amazon ECS container.
|
1033
|
-
log_options: List[str], optional, default None
|
1034
|
-
List of strings containing options for the chosen log driver. The configurable values
|
1035
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1036
|
-
Example usage: ["awslogs-group:aws/batch/job"]
|
960
|
+
times : int, default 3
|
961
|
+
Number of times to retry this task.
|
962
|
+
minutes_between_retries : int, default 2
|
963
|
+
Number of minutes between retries.
|
1037
964
|
"""
|
1038
965
|
...
|
1039
966
|
|
1040
967
|
@typing.overload
|
1041
|
-
def
|
968
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1042
969
|
...
|
1043
970
|
|
1044
971
|
@typing.overload
|
1045
|
-
def
|
972
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1046
973
|
...
|
1047
974
|
|
1048
|
-
def
|
975
|
+
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):
|
1049
976
|
"""
|
1050
|
-
Specifies
|
977
|
+
Specifies the number of times the task corresponding
|
978
|
+
to a step needs to be retried.
|
979
|
+
|
980
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
981
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
982
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
983
|
+
|
984
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
985
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
986
|
+
ensuring that the flow execution can continue.
|
1051
987
|
|
1052
988
|
Parameters
|
1053
989
|
----------
|
1054
|
-
|
1055
|
-
Number of
|
1056
|
-
|
1057
|
-
|
1058
|
-
Number of GPUs required for this step. If `@resources` is
|
1059
|
-
also present, the maximum value from all decorators is used.
|
1060
|
-
memory : int, default 4096
|
1061
|
-
Memory size (in MB) required for this step. If
|
1062
|
-
`@resources` is also present, the maximum value from all decorators is
|
1063
|
-
used.
|
1064
|
-
image : str, optional, default None
|
1065
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
1066
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
1067
|
-
not, a default Docker image mapping to the current version of Python is used.
|
1068
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
1069
|
-
AWS Batch Job Queue to submit the job to.
|
1070
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
1071
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
1072
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
1073
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
1074
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
1075
|
-
shared_memory : int, optional, default None
|
1076
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1077
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1078
|
-
max_swap : int, optional, default None
|
1079
|
-
The total amount of swap memory (in MiB) a container can use for this
|
1080
|
-
step. This parameter is translated to the `--memory-swap` option in
|
1081
|
-
Docker where the value is the sum of the container memory plus the
|
1082
|
-
`max_swap` value.
|
1083
|
-
swappiness : int, optional, default None
|
1084
|
-
This allows you to tune memory swappiness behavior for this step.
|
1085
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
1086
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
1087
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
1088
|
-
use_tmpfs : bool, default False
|
1089
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
1090
|
-
not available on Fargate compute environments
|
1091
|
-
tmpfs_tempdir : bool, default True
|
1092
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1093
|
-
tmpfs_size : int, optional, default None
|
1094
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1095
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1096
|
-
memory allocated for this step.
|
1097
|
-
tmpfs_path : str, optional, default None
|
1098
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1099
|
-
inferentia : int, default 0
|
1100
|
-
Number of Inferentia chips required for this step.
|
1101
|
-
trainium : int, default None
|
1102
|
-
Alias for inferentia. Use only one of the two.
|
1103
|
-
efa : int, default 0
|
1104
|
-
Number of elastic fabric adapter network devices to attach to container
|
1105
|
-
ephemeral_storage: int, default None
|
1106
|
-
The total amount, in GiB, of ephemeral storage to set for the task (21-200)
|
1107
|
-
This is only relevant for Fargate compute environments
|
1108
|
-
log_driver: str, optional, default None
|
1109
|
-
The log driver to use for the Amazon ECS container.
|
1110
|
-
log_options: List[str], optional, default None
|
1111
|
-
List of strings containing options for the chosen log driver. The configurable values
|
1112
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1113
|
-
Example usage: ["awslogs-group:aws/batch/job"]
|
990
|
+
times : int, default 3
|
991
|
+
Number of times to retry this task.
|
992
|
+
minutes_between_retries : int, default 2
|
993
|
+
Number of minutes between retries.
|
1114
994
|
"""
|
1115
995
|
...
|
1116
996
|
|
@@ -1148,33 +1028,51 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
1148
1028
|
...
|
1149
1029
|
|
1150
1030
|
@typing.overload
|
1151
|
-
def
|
1031
|
+
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]]]:
|
1152
1032
|
"""
|
1153
|
-
Specifies
|
1033
|
+
Specifies the PyPI packages for the step.
|
1154
1034
|
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1035
|
+
Information in this decorator will augment any
|
1036
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1037
|
+
you can use `@pypi_base` to set packages required by all
|
1038
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1039
|
+
|
1040
|
+
Parameters
|
1041
|
+
----------
|
1042
|
+
packages : Dict[str, str], default: {}
|
1043
|
+
Packages to use for this step. The key is the name of the package
|
1044
|
+
and the value is the version to use.
|
1045
|
+
python : str, optional, default: None
|
1046
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1047
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1159
1048
|
"""
|
1160
1049
|
...
|
1161
1050
|
|
1162
1051
|
@typing.overload
|
1163
|
-
def
|
1052
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1164
1053
|
...
|
1165
1054
|
|
1166
1055
|
@typing.overload
|
1167
|
-
def
|
1056
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1168
1057
|
...
|
1169
1058
|
|
1170
|
-
def
|
1059
|
+
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):
|
1171
1060
|
"""
|
1172
|
-
Specifies
|
1061
|
+
Specifies the PyPI packages for the step.
|
1062
|
+
|
1063
|
+
Information in this decorator will augment any
|
1064
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1065
|
+
you can use `@pypi_base` to set packages required by all
|
1066
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1173
1067
|
|
1174
1068
|
Parameters
|
1175
1069
|
----------
|
1176
|
-
|
1177
|
-
|
1070
|
+
packages : Dict[str, str], default: {}
|
1071
|
+
Packages to use for this step. The key is the name of the package
|
1072
|
+
and the value is the version to use.
|
1073
|
+
python : str, optional, default: None
|
1074
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1075
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1178
1076
|
"""
|
1179
1077
|
...
|
1180
1078
|
|
@@ -1238,202 +1136,359 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
1238
1136
|
...
|
1239
1137
|
|
1240
1138
|
@typing.overload
|
1241
|
-
def
|
1139
|
+
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]]]:
|
1242
1140
|
"""
|
1243
|
-
Specifies
|
1244
|
-
|
1245
|
-
Information in this decorator will augment any
|
1246
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1247
|
-
you can use `@pypi_base` to set packages required by all
|
1248
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1141
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1249
1142
|
|
1250
1143
|
Parameters
|
1251
1144
|
----------
|
1252
|
-
|
1253
|
-
|
1254
|
-
and the value is the version to use.
|
1255
|
-
python : str, optional, default: None
|
1256
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1257
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1145
|
+
vars : Dict[str, str], default {}
|
1146
|
+
Dictionary of environment variables to set.
|
1258
1147
|
"""
|
1259
1148
|
...
|
1260
1149
|
|
1261
1150
|
@typing.overload
|
1262
|
-
def
|
1151
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1263
1152
|
...
|
1264
1153
|
|
1265
1154
|
@typing.overload
|
1266
|
-
def
|
1155
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1267
1156
|
...
|
1268
1157
|
|
1269
|
-
def
|
1158
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1270
1159
|
"""
|
1271
|
-
Specifies
|
1272
|
-
|
1273
|
-
Information in this decorator will augment any
|
1274
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1275
|
-
you can use `@pypi_base` to set packages required by all
|
1276
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1160
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1277
1161
|
|
1278
1162
|
Parameters
|
1279
1163
|
----------
|
1280
|
-
|
1281
|
-
|
1282
|
-
and the value is the version to use.
|
1283
|
-
python : str, optional, default: None
|
1284
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1285
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1164
|
+
vars : Dict[str, str], default {}
|
1165
|
+
Dictionary of environment variables to set.
|
1286
1166
|
"""
|
1287
1167
|
...
|
1288
1168
|
|
1289
1169
|
@typing.overload
|
1290
|
-
def
|
1170
|
+
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]]]:
|
1291
1171
|
"""
|
1292
|
-
Specifies
|
1172
|
+
Specifies the resources needed when executing this step.
|
1293
1173
|
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1174
|
+
Use `@resources` to specify the resource requirements
|
1175
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1176
|
+
|
1177
|
+
You can choose the compute layer on the command line by executing e.g.
|
1178
|
+
```
|
1179
|
+
python myflow.py run --with batch
|
1180
|
+
```
|
1181
|
+
or
|
1182
|
+
```
|
1183
|
+
python myflow.py run --with kubernetes
|
1184
|
+
```
|
1185
|
+
which executes the flow on the desired system using the
|
1186
|
+
requirements specified in `@resources`.
|
1298
1187
|
|
1299
1188
|
Parameters
|
1300
1189
|
----------
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1190
|
+
cpu : int, default 1
|
1191
|
+
Number of CPUs required for this step.
|
1192
|
+
gpu : int, default 0
|
1193
|
+
Number of GPUs required for this step.
|
1194
|
+
disk : int, optional, default None
|
1195
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1196
|
+
memory : int, default 4096
|
1197
|
+
Memory size (in MB) required for this step.
|
1198
|
+
shared_memory : int, optional, default None
|
1199
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1200
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1307
1201
|
"""
|
1308
1202
|
...
|
1309
1203
|
|
1310
1204
|
@typing.overload
|
1311
|
-
def
|
1205
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1312
1206
|
...
|
1313
1207
|
|
1314
1208
|
@typing.overload
|
1315
|
-
def
|
1209
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1316
1210
|
...
|
1317
1211
|
|
1318
|
-
def
|
1212
|
+
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):
|
1319
1213
|
"""
|
1320
|
-
Specifies
|
1214
|
+
Specifies the resources needed when executing this step.
|
1321
1215
|
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1216
|
+
Use `@resources` to specify the resource requirements
|
1217
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1218
|
+
|
1219
|
+
You can choose the compute layer on the command line by executing e.g.
|
1220
|
+
```
|
1221
|
+
python myflow.py run --with batch
|
1222
|
+
```
|
1223
|
+
or
|
1224
|
+
```
|
1225
|
+
python myflow.py run --with kubernetes
|
1226
|
+
```
|
1227
|
+
which executes the flow on the desired system using the
|
1228
|
+
requirements specified in `@resources`.
|
1326
1229
|
|
1327
1230
|
Parameters
|
1328
1231
|
----------
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1232
|
+
cpu : int, default 1
|
1233
|
+
Number of CPUs required for this step.
|
1234
|
+
gpu : int, default 0
|
1235
|
+
Number of GPUs required for this step.
|
1236
|
+
disk : int, optional, default None
|
1237
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1238
|
+
memory : int, default 4096
|
1239
|
+
Memory size (in MB) required for this step.
|
1240
|
+
shared_memory : int, optional, default None
|
1241
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1242
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1335
1243
|
"""
|
1336
1244
|
...
|
1337
1245
|
|
1338
1246
|
@typing.overload
|
1339
|
-
def
|
1247
|
+
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]]]:
|
1340
1248
|
"""
|
1341
|
-
Specifies
|
1342
|
-
to a step needs to be retried.
|
1343
|
-
|
1344
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1345
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1346
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1347
|
-
|
1348
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1349
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1350
|
-
ensuring that the flow execution can continue.
|
1249
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
1351
1250
|
|
1352
1251
|
Parameters
|
1353
1252
|
----------
|
1354
|
-
|
1355
|
-
Number of
|
1356
|
-
|
1357
|
-
|
1253
|
+
cpu : int, default 1
|
1254
|
+
Number of CPUs required for this step. If `@resources` is
|
1255
|
+
also present, the maximum value from all decorators is used.
|
1256
|
+
gpu : int, default 0
|
1257
|
+
Number of GPUs required for this step. If `@resources` is
|
1258
|
+
also present, the maximum value from all decorators is used.
|
1259
|
+
memory : int, default 4096
|
1260
|
+
Memory size (in MB) required for this step. If
|
1261
|
+
`@resources` is also present, the maximum value from all decorators is
|
1262
|
+
used.
|
1263
|
+
image : str, optional, default None
|
1264
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
1265
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
1266
|
+
not, a default Docker image mapping to the current version of Python is used.
|
1267
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
1268
|
+
AWS Batch Job Queue to submit the job to.
|
1269
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
1270
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
1271
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
1272
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
1273
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
1274
|
+
shared_memory : int, optional, default None
|
1275
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1276
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1277
|
+
max_swap : int, optional, default None
|
1278
|
+
The total amount of swap memory (in MiB) a container can use for this
|
1279
|
+
step. This parameter is translated to the `--memory-swap` option in
|
1280
|
+
Docker where the value is the sum of the container memory plus the
|
1281
|
+
`max_swap` value.
|
1282
|
+
swappiness : int, optional, default None
|
1283
|
+
This allows you to tune memory swappiness behavior for this step.
|
1284
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
1285
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
1286
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
1287
|
+
use_tmpfs : bool, default False
|
1288
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
1289
|
+
not available on Fargate compute environments
|
1290
|
+
tmpfs_tempdir : bool, default True
|
1291
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1292
|
+
tmpfs_size : int, optional, default None
|
1293
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
1294
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1295
|
+
memory allocated for this step.
|
1296
|
+
tmpfs_path : str, optional, default None
|
1297
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1298
|
+
inferentia : int, default 0
|
1299
|
+
Number of Inferentia chips required for this step.
|
1300
|
+
trainium : int, default None
|
1301
|
+
Alias for inferentia. Use only one of the two.
|
1302
|
+
efa : int, default 0
|
1303
|
+
Number of elastic fabric adapter network devices to attach to container
|
1304
|
+
ephemeral_storage : int, default None
|
1305
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
1306
|
+
This is only relevant for Fargate compute environments
|
1307
|
+
log_driver: str, optional, default None
|
1308
|
+
The log driver to use for the Amazon ECS container.
|
1309
|
+
log_options: List[str], optional, default None
|
1310
|
+
List of strings containing options for the chosen log driver. The configurable values
|
1311
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1312
|
+
Example: [`awslogs-group:aws/batch/job`]
|
1358
1313
|
"""
|
1359
1314
|
...
|
1360
1315
|
|
1361
1316
|
@typing.overload
|
1362
|
-
def
|
1317
|
+
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1363
1318
|
...
|
1364
1319
|
|
1365
1320
|
@typing.overload
|
1366
|
-
def
|
1321
|
+
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1367
1322
|
...
|
1368
1323
|
|
1369
|
-
def
|
1324
|
+
def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None):
|
1370
1325
|
"""
|
1371
|
-
Specifies
|
1372
|
-
to a step needs to be retried.
|
1373
|
-
|
1374
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1375
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1376
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1377
|
-
|
1378
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1379
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1380
|
-
ensuring that the flow execution can continue.
|
1326
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
1381
1327
|
|
1382
1328
|
Parameters
|
1383
1329
|
----------
|
1384
|
-
|
1385
|
-
Number of
|
1386
|
-
|
1387
|
-
|
1330
|
+
cpu : int, default 1
|
1331
|
+
Number of CPUs required for this step. If `@resources` is
|
1332
|
+
also present, the maximum value from all decorators is used.
|
1333
|
+
gpu : int, default 0
|
1334
|
+
Number of GPUs required for this step. If `@resources` is
|
1335
|
+
also present, the maximum value from all decorators is used.
|
1336
|
+
memory : int, default 4096
|
1337
|
+
Memory size (in MB) required for this step. If
|
1338
|
+
`@resources` is also present, the maximum value from all decorators is
|
1339
|
+
used.
|
1340
|
+
image : str, optional, default None
|
1341
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
1342
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
1343
|
+
not, a default Docker image mapping to the current version of Python is used.
|
1344
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
1345
|
+
AWS Batch Job Queue to submit the job to.
|
1346
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
1347
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
1348
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
1349
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
1350
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
1351
|
+
shared_memory : int, optional, default None
|
1352
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1353
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1354
|
+
max_swap : int, optional, default None
|
1355
|
+
The total amount of swap memory (in MiB) a container can use for this
|
1356
|
+
step. This parameter is translated to the `--memory-swap` option in
|
1357
|
+
Docker where the value is the sum of the container memory plus the
|
1358
|
+
`max_swap` value.
|
1359
|
+
swappiness : int, optional, default None
|
1360
|
+
This allows you to tune memory swappiness behavior for this step.
|
1361
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
1362
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
1363
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
1364
|
+
use_tmpfs : bool, default False
|
1365
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
1366
|
+
not available on Fargate compute environments
|
1367
|
+
tmpfs_tempdir : bool, default True
|
1368
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1369
|
+
tmpfs_size : int, optional, default None
|
1370
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
1371
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1372
|
+
memory allocated for this step.
|
1373
|
+
tmpfs_path : str, optional, default None
|
1374
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
1375
|
+
inferentia : int, default 0
|
1376
|
+
Number of Inferentia chips required for this step.
|
1377
|
+
trainium : int, default None
|
1378
|
+
Alias for inferentia. Use only one of the two.
|
1379
|
+
efa : int, default 0
|
1380
|
+
Number of elastic fabric adapter network devices to attach to container
|
1381
|
+
ephemeral_storage : int, default None
|
1382
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
1383
|
+
This is only relevant for Fargate compute environments
|
1384
|
+
log_driver: str, optional, default None
|
1385
|
+
The log driver to use for the Amazon ECS container.
|
1386
|
+
log_options: List[str], optional, default None
|
1387
|
+
List of strings containing options for the chosen log driver. The configurable values
|
1388
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1389
|
+
Example: [`awslogs-group:aws/batch/job`]
|
1388
1390
|
"""
|
1389
1391
|
...
|
1390
1392
|
|
1391
|
-
|
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]]:
|
1393
|
+
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]]:
|
1393
1394
|
"""
|
1394
|
-
|
1395
|
-
|
1395
|
+
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)
|
1396
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1397
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1398
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1399
|
+
starts only after all sensors finish.
|
1396
1400
|
|
1397
1401
|
Parameters
|
1398
1402
|
----------
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1403
|
+
timeout : int
|
1404
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1405
|
+
poke_interval : int
|
1406
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1407
|
+
mode : str
|
1408
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1409
|
+
exponential_backoff : bool
|
1410
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1411
|
+
pool : str
|
1412
|
+
the slot pool this task should run in,
|
1413
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1414
|
+
soft_fail : bool
|
1415
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1416
|
+
name : str
|
1417
|
+
Name of the sensor on Airflow
|
1418
|
+
description : str
|
1419
|
+
Description of sensor in the Airflow UI
|
1420
|
+
bucket_key : Union[str, List[str]]
|
1421
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1422
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1423
|
+
bucket_name : str
|
1424
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1425
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1426
|
+
wildcard_match : bool
|
1427
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1428
|
+
aws_conn_id : str
|
1429
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1430
|
+
verify : bool
|
1431
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1411
1432
|
"""
|
1412
1433
|
...
|
1413
1434
|
|
1414
|
-
|
1415
|
-
|
1435
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1436
|
+
"""
|
1437
|
+
Specifies what flows belong to the same project.
|
1438
|
+
|
1439
|
+
A project-specific namespace is created for all flows that
|
1440
|
+
use the same `@project(name)`.
|
1441
|
+
|
1442
|
+
Parameters
|
1443
|
+
----------
|
1444
|
+
name : str
|
1445
|
+
Project name. Make sure that the name is unique amongst all
|
1446
|
+
projects that use the same production scheduler. The name may
|
1447
|
+
contain only lowercase alphanumeric characters and underscores.
|
1448
|
+
|
1449
|
+
|
1450
|
+
"""
|
1416
1451
|
...
|
1417
1452
|
|
1418
|
-
def
|
1453
|
+
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]]:
|
1419
1454
|
"""
|
1420
|
-
|
1421
|
-
|
1455
|
+
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.
|
1456
|
+
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.
|
1422
1457
|
|
1423
1458
|
Parameters
|
1424
1459
|
----------
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1460
|
+
timeout : int
|
1461
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1462
|
+
poke_interval : int
|
1463
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1464
|
+
mode : str
|
1465
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1466
|
+
exponential_backoff : bool
|
1467
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1468
|
+
pool : str
|
1469
|
+
the slot pool this task should run in,
|
1470
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1471
|
+
soft_fail : bool
|
1472
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1473
|
+
name : str
|
1474
|
+
Name of the sensor on Airflow
|
1475
|
+
description : str
|
1476
|
+
Description of sensor in the Airflow UI
|
1477
|
+
external_dag_id : str
|
1478
|
+
The dag_id that contains the task you want to wait for.
|
1479
|
+
external_task_ids : List[str]
|
1480
|
+
The list of task_ids that you want to wait for.
|
1481
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1482
|
+
allowed_states : List[str]
|
1483
|
+
Iterable of allowed states, (Default: ['success'])
|
1484
|
+
failed_states : List[str]
|
1485
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1486
|
+
execution_delta : datetime.timedelta
|
1487
|
+
time difference with the previous execution to look at,
|
1488
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1489
|
+
check_existence: bool
|
1490
|
+
Set to True to check if the external task exists or check if
|
1491
|
+
the DAG to wait for exists. (Default: True)
|
1437
1492
|
"""
|
1438
1493
|
...
|
1439
1494
|
|
@@ -1620,105 +1675,52 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1620
1675
|
"""
|
1621
1676
|
...
|
1622
1677
|
|
1623
|
-
|
1678
|
+
@typing.overload
|
1679
|
+
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]]:
|
1624
1680
|
"""
|
1625
|
-
|
1626
|
-
|
1627
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1628
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1629
|
-
starts only after all sensors finish.
|
1681
|
+
Specifies the times when the flow should be run when running on a
|
1682
|
+
production scheduler.
|
1630
1683
|
|
1631
1684
|
Parameters
|
1632
1685
|
----------
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1646
|
-
name : str
|
1647
|
-
Name of the sensor on Airflow
|
1648
|
-
description : str
|
1649
|
-
Description of sensor in the Airflow UI
|
1650
|
-
bucket_key : Union[str, List[str]]
|
1651
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1652
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1653
|
-
bucket_name : str
|
1654
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1655
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1656
|
-
wildcard_match : bool
|
1657
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1658
|
-
aws_conn_id : str
|
1659
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1660
|
-
verify : bool
|
1661
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1686
|
+
hourly : bool, default False
|
1687
|
+
Run the workflow hourly.
|
1688
|
+
daily : bool, default True
|
1689
|
+
Run the workflow daily.
|
1690
|
+
weekly : bool, default False
|
1691
|
+
Run the workflow weekly.
|
1692
|
+
cron : str, optional, default None
|
1693
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1694
|
+
specified by this expression.
|
1695
|
+
timezone : str, optional, default None
|
1696
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1697
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1662
1698
|
"""
|
1663
1699
|
...
|
1664
1700
|
|
1665
|
-
|
1666
|
-
|
1667
|
-
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.
|
1668
|
-
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.
|
1669
|
-
|
1670
|
-
Parameters
|
1671
|
-
----------
|
1672
|
-
timeout : int
|
1673
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1674
|
-
poke_interval : int
|
1675
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1676
|
-
mode : str
|
1677
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1678
|
-
exponential_backoff : bool
|
1679
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1680
|
-
pool : str
|
1681
|
-
the slot pool this task should run in,
|
1682
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1683
|
-
soft_fail : bool
|
1684
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1685
|
-
name : str
|
1686
|
-
Name of the sensor on Airflow
|
1687
|
-
description : str
|
1688
|
-
Description of sensor in the Airflow UI
|
1689
|
-
external_dag_id : str
|
1690
|
-
The dag_id that contains the task you want to wait for.
|
1691
|
-
external_task_ids : List[str]
|
1692
|
-
The list of task_ids that you want to wait for.
|
1693
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1694
|
-
allowed_states : List[str]
|
1695
|
-
Iterable of allowed states, (Default: ['success'])
|
1696
|
-
failed_states : List[str]
|
1697
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1698
|
-
execution_delta : datetime.timedelta
|
1699
|
-
time difference with the previous execution to look at,
|
1700
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1701
|
-
check_existence: bool
|
1702
|
-
Set to True to check if the external task exists or check if
|
1703
|
-
the DAG to wait for exists. (Default: True)
|
1704
|
-
"""
|
1701
|
+
@typing.overload
|
1702
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1705
1703
|
...
|
1706
1704
|
|
1707
|
-
def
|
1705
|
+
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):
|
1708
1706
|
"""
|
1709
|
-
Specifies
|
1710
|
-
|
1711
|
-
A project-specific namespace is created for all flows that
|
1712
|
-
use the same `@project(name)`.
|
1707
|
+
Specifies the times when the flow should be run when running on a
|
1708
|
+
production scheduler.
|
1713
1709
|
|
1714
1710
|
Parameters
|
1715
1711
|
----------
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1712
|
+
hourly : bool, default False
|
1713
|
+
Run the workflow hourly.
|
1714
|
+
daily : bool, default True
|
1715
|
+
Run the workflow daily.
|
1716
|
+
weekly : bool, default False
|
1717
|
+
Run the workflow weekly.
|
1718
|
+
cron : str, optional, default None
|
1719
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1720
|
+
specified by this expression.
|
1721
|
+
timezone : str, optional, default None
|
1722
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1723
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1722
1724
|
"""
|
1723
1725
|
...
|
1724
1726
|
|
@@ -2775,6 +2777,204 @@ class DataArtifact(metaflow.client.core.MetaflowObject, metaclass=type):
|
|
2775
2777
|
...
|
2776
2778
|
...
|
2777
2779
|
|
2780
|
+
class Runner(object, metaclass=type):
|
2781
|
+
def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, **kwargs):
|
2782
|
+
...
|
2783
|
+
def __enter__(self) -> metaflow.runner.metaflow_runner.Runner:
|
2784
|
+
...
|
2785
|
+
def __aenter__(self) -> metaflow.runner.metaflow_runner.Runner:
|
2786
|
+
...
|
2787
|
+
def _Runner__get_executing_run(self, tfp_runner_attribute, command_obj):
|
2788
|
+
...
|
2789
|
+
def run(self, **kwargs) -> metaflow.runner.metaflow_runner.ExecutingRun:
|
2790
|
+
"""
|
2791
|
+
Blocking execution of the run. This method will wait until
|
2792
|
+
the run has completed execution.
|
2793
|
+
|
2794
|
+
Parameters
|
2795
|
+
----------
|
2796
|
+
**kwargs : Any
|
2797
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2798
|
+
the `run` command, in particular, any parameters accepted by the flow.
|
2799
|
+
|
2800
|
+
Returns
|
2801
|
+
-------
|
2802
|
+
ExecutingRun
|
2803
|
+
ExecutingRun containing the results of the run.
|
2804
|
+
"""
|
2805
|
+
...
|
2806
|
+
def resume(self, **kwargs):
|
2807
|
+
"""
|
2808
|
+
Blocking resume execution of the run.
|
2809
|
+
This method will wait until the resumed run has completed execution.
|
2810
|
+
|
2811
|
+
Parameters
|
2812
|
+
----------
|
2813
|
+
**kwargs : Any
|
2814
|
+
Additional arguments that you would pass to `python ./myflow.py` after
|
2815
|
+
the `resume` command.
|
2816
|
+
|
2817
|
+
Returns
|
2818
|
+
-------
|
2819
|
+
ExecutingRun
|
2820
|
+
ExecutingRun containing the results of the resumed run.
|
2821
|
+
"""
|
2822
|
+
...
|
2823
|
+
def async_run(self, **kwargs) -> metaflow.runner.metaflow_runner.ExecutingRun:
|
2824
|
+
"""
|
2825
|
+
Non-blocking execution of the run. This method will return as soon as the
|
2826
|
+
run has launched.
|
2827
|
+
|
2828
|
+
Note that this method is asynchronous and needs to be `await`ed.
|
2829
|
+
|
2830
|
+
Parameters
|
2831
|
+
----------
|
2832
|
+
**kwargs : Any
|
2833
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2834
|
+
the `run` command, in particular, any parameters accepted by the flow.
|
2835
|
+
|
2836
|
+
Returns
|
2837
|
+
-------
|
2838
|
+
ExecutingRun
|
2839
|
+
ExecutingRun representing the run that was started.
|
2840
|
+
"""
|
2841
|
+
...
|
2842
|
+
def async_resume(self, **kwargs):
|
2843
|
+
"""
|
2844
|
+
Non-blocking resume execution of the run.
|
2845
|
+
This method will return as soon as the resume has launched.
|
2846
|
+
|
2847
|
+
Note that this method is asynchronous and needs to be `await`ed.
|
2848
|
+
|
2849
|
+
Parameters
|
2850
|
+
----------
|
2851
|
+
**kwargs : Any
|
2852
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2853
|
+
the `resume` command.
|
2854
|
+
|
2855
|
+
Returns
|
2856
|
+
-------
|
2857
|
+
ExecutingRun
|
2858
|
+
ExecutingRun representing the resumed run that was started.
|
2859
|
+
"""
|
2860
|
+
...
|
2861
|
+
def __exit__(self, exc_type, exc_value, traceback):
|
2862
|
+
...
|
2863
|
+
def __aexit__(self, exc_type, exc_value, traceback):
|
2864
|
+
...
|
2865
|
+
def cleanup(self):
|
2866
|
+
"""
|
2867
|
+
Delete any temporary files created during execution.
|
2868
|
+
"""
|
2869
|
+
...
|
2870
|
+
...
|
2871
|
+
|
2872
|
+
class NBRunner(object, metaclass=type):
|
2873
|
+
def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str = "/tmp", **kwargs):
|
2874
|
+
...
|
2875
|
+
def nbrun(self, **kwargs):
|
2876
|
+
"""
|
2877
|
+
Blocking execution of the run. This method will wait until
|
2878
|
+
the run has completed execution.
|
2879
|
+
|
2880
|
+
Note that in contrast to `run`, this method returns a
|
2881
|
+
`metaflow.Run` object directly and calls `cleanup()` internally
|
2882
|
+
to support a common notebook pattern of executing a flow and
|
2883
|
+
retrieving its results immediately.
|
2884
|
+
|
2885
|
+
Parameters
|
2886
|
+
----------
|
2887
|
+
**kwargs : Any
|
2888
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2889
|
+
the `run` command, in particular, any parameters accepted by the flow.
|
2890
|
+
|
2891
|
+
Returns
|
2892
|
+
-------
|
2893
|
+
Run
|
2894
|
+
A `metaflow.Run` object representing the finished run.
|
2895
|
+
"""
|
2896
|
+
...
|
2897
|
+
def nbresume(self, **kwargs):
|
2898
|
+
"""
|
2899
|
+
Blocking resuming of a run. This method will wait until
|
2900
|
+
the resumed run has completed execution.
|
2901
|
+
|
2902
|
+
Note that in contrast to `resume`, this method returns a
|
2903
|
+
`metaflow.Run` object directly and calls `cleanup()` internally
|
2904
|
+
to support a common notebook pattern of executing a flow and
|
2905
|
+
retrieving its results immediately.
|
2906
|
+
|
2907
|
+
Parameters
|
2908
|
+
----------
|
2909
|
+
**kwargs : Any
|
2910
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2911
|
+
the `resume` command.
|
2912
|
+
|
2913
|
+
Returns
|
2914
|
+
-------
|
2915
|
+
Run
|
2916
|
+
A `metaflow.Run` object representing the resumed run.
|
2917
|
+
"""
|
2918
|
+
...
|
2919
|
+
def run(self, **kwargs):
|
2920
|
+
"""
|
2921
|
+
Runs the flow.
|
2922
|
+
"""
|
2923
|
+
...
|
2924
|
+
def resume(self, **kwargs):
|
2925
|
+
"""
|
2926
|
+
Resumes the flow.
|
2927
|
+
"""
|
2928
|
+
...
|
2929
|
+
def async_run(self, **kwargs):
|
2930
|
+
"""
|
2931
|
+
Non-blocking execution of the run. This method will return as soon as the
|
2932
|
+
run has launched. This method is equivalent to `Runner.async_run`.
|
2933
|
+
|
2934
|
+
Note that this method is asynchronous and needs to be `await`ed.
|
2935
|
+
|
2936
|
+
|
2937
|
+
Parameters
|
2938
|
+
----------
|
2939
|
+
**kwargs : Any
|
2940
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2941
|
+
the `run` command, in particular, any parameters accepted by the flow.
|
2942
|
+
|
2943
|
+
Returns
|
2944
|
+
-------
|
2945
|
+
ExecutingRun
|
2946
|
+
ExecutingRun representing the run that was started.
|
2947
|
+
"""
|
2948
|
+
...
|
2949
|
+
def async_resume(self, **kwargs):
|
2950
|
+
"""
|
2951
|
+
Non-blocking execution of the run. This method will return as soon as the
|
2952
|
+
run has launched. This method is equivalent to `Runner.async_resume`.
|
2953
|
+
|
2954
|
+
Note that this method is asynchronous and needs to be `await`ed.
|
2955
|
+
|
2956
|
+
Parameters
|
2957
|
+
----------
|
2958
|
+
**kwargs : Any
|
2959
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2960
|
+
the `run` command, in particular, any parameters accepted by the flow.
|
2961
|
+
|
2962
|
+
Returns
|
2963
|
+
-------
|
2964
|
+
ExecutingRun
|
2965
|
+
ExecutingRun representing the run that was started.
|
2966
|
+
"""
|
2967
|
+
...
|
2968
|
+
def cleanup(self):
|
2969
|
+
"""
|
2970
|
+
Delete any temporary files created during execution.
|
2971
|
+
|
2972
|
+
Call this method after using `async_run` or `async_resume`. You don't
|
2973
|
+
have to call this after `nbrun` or `nbresume`.
|
2974
|
+
"""
|
2975
|
+
...
|
2976
|
+
...
|
2977
|
+
|
2778
2978
|
def get_aws_client(module, with_error = False, role_arn = None, session_vars = None, client_params = None):
|
2779
2979
|
...
|
2780
2980
|
|