metaflow-stubs 2.12.3__py2.py3-none-any.whl → 2.12.4__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 +590 -589
- metaflow-stubs/cards.pyi +4 -4
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +7 -7
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/clone_util.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +6 -5
- 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 +2 -2
- metaflow-stubs/metaflow_current.pyi +5 -5
- metaflow-stubs/mflog/mflog.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +10 -4
- 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 +3 -3
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +4 -4
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +4 -4
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +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 +4 -4
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +3 -3
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +4 -4
- metaflow-stubs/plugins/datatools/s3/s3.pyi +7 -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 +3 -3
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +3 -3
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +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 +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/logs_cli.pyi +2 -2
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +3 -3
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +3 -3
- 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 +3 -3
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/procpoll.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +4 -4
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.12.3.dist-info → metaflow_stubs-2.12.4.dist-info}/METADATA +2 -2
- metaflow_stubs-2.12.4.dist-info/RECORD +142 -0
- metaflow_stubs-2.12.3.dist-info/RECORD +0 -142
- {metaflow_stubs-2.12.3.dist-info → metaflow_stubs-2.12.4.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.12.3.dist-info → metaflow_stubs-2.12.4.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,24 +1,25 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-06-
|
3
|
+
# MF version: 2.12.4 #
|
4
|
+
# Generated on 2024-06-18T20:28:20.449033 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import metaflow.
|
12
|
-
import io
|
13
|
-
import metaflow.metaflow_current
|
14
|
-
import metaflow.datastore.inputs
|
15
|
-
import metaflow.plugins.datatools.s3.s3
|
11
|
+
import metaflow._vendor.click.types
|
16
12
|
import datetime
|
17
|
-
import typing
|
18
|
-
import metaflow.runner.metaflow_runner
|
19
13
|
import metaflow.events
|
14
|
+
import metaflow.flowspec
|
15
|
+
import io
|
20
16
|
import metaflow.client.core
|
21
|
-
import metaflow.
|
17
|
+
import metaflow.metaflow_current
|
18
|
+
import metaflow.runner.metaflow_runner
|
19
|
+
import typing
|
20
|
+
import metaflow.plugins.datatools.s3.s3
|
21
|
+
import metaflow.datastore.inputs
|
22
|
+
import metaflow.parameters
|
22
23
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
23
24
|
StepFlag = typing.NewType("StepFlag", bool)
|
24
25
|
|
@@ -105,7 +106,7 @@ def metadata(ms: str) -> str:
|
|
105
106
|
"""
|
106
107
|
...
|
107
108
|
|
108
|
-
class FlowSpec(object, metaclass=
|
109
|
+
class FlowSpec(object, metaclass=metaflow.flowspec._FlowSpecMeta):
|
109
110
|
def __init__(self, use_cli = True):
|
110
111
|
"""
|
111
112
|
Construct a FlowSpec
|
@@ -726,155 +727,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
726
727
|
"""
|
727
728
|
...
|
728
729
|
|
729
|
-
@typing.overload
|
730
|
-
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]]]:
|
731
|
-
"""
|
732
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
733
|
-
|
734
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
735
|
-
|
736
|
-
Parameters
|
737
|
-
----------
|
738
|
-
type : str, default 'default'
|
739
|
-
Card type.
|
740
|
-
id : str, optional, default None
|
741
|
-
If multiple cards are present, use this id to identify this card.
|
742
|
-
options : Dict[str, Any], default {}
|
743
|
-
Options passed to the card. The contents depend on the card type.
|
744
|
-
timeout : int, default 45
|
745
|
-
Interrupt reporting if it takes more than this many seconds.
|
746
|
-
|
747
|
-
|
748
|
-
"""
|
749
|
-
...
|
750
|
-
|
751
|
-
@typing.overload
|
752
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
753
|
-
...
|
754
|
-
|
755
|
-
@typing.overload
|
756
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
757
|
-
...
|
758
|
-
|
759
|
-
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):
|
760
|
-
"""
|
761
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
762
|
-
|
763
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
764
|
-
|
765
|
-
Parameters
|
766
|
-
----------
|
767
|
-
type : str, default 'default'
|
768
|
-
Card type.
|
769
|
-
id : str, optional, default None
|
770
|
-
If multiple cards are present, use this id to identify this card.
|
771
|
-
options : Dict[str, Any], default {}
|
772
|
-
Options passed to the card. The contents depend on the card type.
|
773
|
-
timeout : int, default 45
|
774
|
-
Interrupt reporting if it takes more than this many seconds.
|
775
|
-
|
776
|
-
|
777
|
-
"""
|
778
|
-
...
|
779
|
-
|
780
|
-
@typing.overload
|
781
|
-
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]]]:
|
782
|
-
"""
|
783
|
-
Specifies that the step will success under all circumstances.
|
784
|
-
|
785
|
-
The decorator will create an optional artifact, specified by `var`, which
|
786
|
-
contains the exception raised. You can use it to detect the presence
|
787
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
788
|
-
are missing.
|
789
|
-
|
790
|
-
Parameters
|
791
|
-
----------
|
792
|
-
var : str, optional, default None
|
793
|
-
Name of the artifact in which to store the caught exception.
|
794
|
-
If not specified, the exception is not stored.
|
795
|
-
print_exception : bool, default True
|
796
|
-
Determines whether or not the exception is printed to
|
797
|
-
stdout when caught.
|
798
|
-
"""
|
799
|
-
...
|
800
|
-
|
801
|
-
@typing.overload
|
802
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
803
|
-
...
|
804
|
-
|
805
|
-
@typing.overload
|
806
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
807
|
-
...
|
808
|
-
|
809
|
-
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):
|
810
|
-
"""
|
811
|
-
Specifies that the step will success under all circumstances.
|
812
|
-
|
813
|
-
The decorator will create an optional artifact, specified by `var`, which
|
814
|
-
contains the exception raised. You can use it to detect the presence
|
815
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
816
|
-
are missing.
|
817
|
-
|
818
|
-
Parameters
|
819
|
-
----------
|
820
|
-
var : str, optional, default None
|
821
|
-
Name of the artifact in which to store the caught exception.
|
822
|
-
If not specified, the exception is not stored.
|
823
|
-
print_exception : bool, default True
|
824
|
-
Determines whether or not the exception is printed to
|
825
|
-
stdout when caught.
|
826
|
-
"""
|
827
|
-
...
|
828
|
-
|
829
|
-
@typing.overload
|
830
|
-
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]]]:
|
831
|
-
"""
|
832
|
-
Specifies the PyPI packages for the step.
|
833
|
-
|
834
|
-
Information in this decorator will augment any
|
835
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
836
|
-
you can use `@pypi_base` to set packages required by all
|
837
|
-
steps and use `@pypi` to specify step-specific overrides.
|
838
|
-
|
839
|
-
Parameters
|
840
|
-
----------
|
841
|
-
packages : Dict[str, str], default: {}
|
842
|
-
Packages to use for this step. The key is the name of the package
|
843
|
-
and the value is the version to use.
|
844
|
-
python : str, optional, default: None
|
845
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
846
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
847
|
-
"""
|
848
|
-
...
|
849
|
-
|
850
|
-
@typing.overload
|
851
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
852
|
-
...
|
853
|
-
|
854
|
-
@typing.overload
|
855
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
856
|
-
...
|
857
|
-
|
858
|
-
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):
|
859
|
-
"""
|
860
|
-
Specifies the PyPI packages for the step.
|
861
|
-
|
862
|
-
Information in this decorator will augment any
|
863
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
864
|
-
you can use `@pypi_base` to set packages required by all
|
865
|
-
steps and use `@pypi` to specify step-specific overrides.
|
866
|
-
|
867
|
-
Parameters
|
868
|
-
----------
|
869
|
-
packages : Dict[str, str], default: {}
|
870
|
-
Packages to use for this step. The key is the name of the package
|
871
|
-
and the value is the version to use.
|
872
|
-
python : str, optional, default: None
|
873
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
874
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
875
|
-
"""
|
876
|
-
...
|
877
|
-
|
878
730
|
@typing.overload
|
879
731
|
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]]]:
|
880
732
|
"""
|
@@ -1023,191 +875,90 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1023
875
|
...
|
1024
876
|
|
1025
877
|
@typing.overload
|
1026
|
-
def
|
878
|
+
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]]]:
|
1027
879
|
"""
|
1028
|
-
Specifies
|
1029
|
-
to a step needs to be retried.
|
880
|
+
Specifies a timeout for your step.
|
1030
881
|
|
1031
|
-
This decorator is useful
|
1032
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1033
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
882
|
+
This decorator is useful if this step may hang indefinitely.
|
1034
883
|
|
1035
|
-
This can be used in conjunction with the `@
|
1036
|
-
|
1037
|
-
|
884
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
885
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
886
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
887
|
+
|
888
|
+
Note that all the values specified in parameters are added together so if you specify
|
889
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1038
890
|
|
1039
891
|
Parameters
|
1040
892
|
----------
|
1041
|
-
|
1042
|
-
Number of
|
1043
|
-
|
1044
|
-
Number of minutes
|
893
|
+
seconds : int, default 0
|
894
|
+
Number of seconds to wait prior to timing out.
|
895
|
+
minutes : int, default 0
|
896
|
+
Number of minutes to wait prior to timing out.
|
897
|
+
hours : int, default 0
|
898
|
+
Number of hours to wait prior to timing out.
|
1045
899
|
"""
|
1046
900
|
...
|
1047
901
|
|
1048
902
|
@typing.overload
|
1049
|
-
def
|
903
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1050
904
|
...
|
1051
905
|
|
1052
906
|
@typing.overload
|
1053
|
-
def
|
907
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1054
908
|
...
|
1055
909
|
|
1056
|
-
def
|
910
|
+
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):
|
1057
911
|
"""
|
1058
|
-
Specifies
|
1059
|
-
to a step needs to be retried.
|
912
|
+
Specifies a timeout for your step.
|
1060
913
|
|
1061
|
-
This decorator is useful
|
1062
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1063
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
914
|
+
This decorator is useful if this step may hang indefinitely.
|
1064
915
|
|
1065
|
-
This can be used in conjunction with the `@
|
1066
|
-
|
1067
|
-
|
916
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
917
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
918
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
919
|
+
|
920
|
+
Note that all the values specified in parameters are added together so if you specify
|
921
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1068
922
|
|
1069
923
|
Parameters
|
1070
924
|
----------
|
1071
|
-
|
1072
|
-
Number of
|
1073
|
-
|
1074
|
-
Number of minutes
|
925
|
+
seconds : int, default 0
|
926
|
+
Number of seconds to wait prior to timing out.
|
927
|
+
minutes : int, default 0
|
928
|
+
Number of minutes to wait prior to timing out.
|
929
|
+
hours : int, default 0
|
930
|
+
Number of hours to wait prior to timing out.
|
1075
931
|
"""
|
1076
932
|
...
|
1077
933
|
|
1078
934
|
@typing.overload
|
1079
|
-
def
|
935
|
+
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]]]:
|
1080
936
|
"""
|
1081
|
-
Specifies
|
1082
|
-
|
1083
|
-
Use `@resources` to specify the resource requirements
|
1084
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1085
|
-
|
1086
|
-
You can choose the compute layer on the command line by executing e.g.
|
1087
|
-
```
|
1088
|
-
python myflow.py run --with batch
|
1089
|
-
```
|
1090
|
-
or
|
1091
|
-
```
|
1092
|
-
python myflow.py run --with kubernetes
|
1093
|
-
```
|
1094
|
-
which executes the flow on the desired system using the
|
1095
|
-
requirements specified in `@resources`.
|
937
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1096
938
|
|
1097
939
|
Parameters
|
1098
940
|
----------
|
1099
|
-
|
1100
|
-
|
1101
|
-
gpu : int, default 0
|
1102
|
-
Number of GPUs required for this step.
|
1103
|
-
disk : int, optional, default None
|
1104
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1105
|
-
memory : int, default 4096
|
1106
|
-
Memory size (in MB) required for this step.
|
1107
|
-
shared_memory : int, optional, default None
|
1108
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1109
|
-
This parameter maps to the `--shm-size` option in Docker.
|
941
|
+
vars : Dict[str, str], default {}
|
942
|
+
Dictionary of environment variables to set.
|
1110
943
|
"""
|
1111
944
|
...
|
1112
945
|
|
1113
946
|
@typing.overload
|
1114
|
-
def
|
947
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1115
948
|
...
|
1116
949
|
|
1117
950
|
@typing.overload
|
1118
|
-
def
|
1119
|
-
...
|
1120
|
-
|
1121
|
-
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):
|
1122
|
-
"""
|
1123
|
-
Specifies the resources needed when executing this step.
|
1124
|
-
|
1125
|
-
Use `@resources` to specify the resource requirements
|
1126
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1127
|
-
|
1128
|
-
You can choose the compute layer on the command line by executing e.g.
|
1129
|
-
```
|
1130
|
-
python myflow.py run --with batch
|
1131
|
-
```
|
1132
|
-
or
|
1133
|
-
```
|
1134
|
-
python myflow.py run --with kubernetes
|
1135
|
-
```
|
1136
|
-
which executes the flow on the desired system using the
|
1137
|
-
requirements specified in `@resources`.
|
1138
|
-
|
1139
|
-
Parameters
|
1140
|
-
----------
|
1141
|
-
cpu : int, default 1
|
1142
|
-
Number of CPUs required for this step.
|
1143
|
-
gpu : int, default 0
|
1144
|
-
Number of GPUs required for this step.
|
1145
|
-
disk : int, optional, default None
|
1146
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1147
|
-
memory : int, default 4096
|
1148
|
-
Memory size (in MB) required for this step.
|
1149
|
-
shared_memory : int, optional, default None
|
1150
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1151
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1152
|
-
"""
|
951
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1153
952
|
...
|
1154
953
|
|
1155
|
-
def
|
954
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1156
955
|
"""
|
1157
|
-
Specifies
|
956
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1158
957
|
|
1159
958
|
Parameters
|
1160
959
|
----------
|
1161
|
-
|
1162
|
-
|
1163
|
-
also present, the maximum value from all decorators is used.
|
1164
|
-
memory : int, default 4096
|
1165
|
-
Memory size (in MB) required for this step. If
|
1166
|
-
`@resources` is also present, the maximum value from all decorators is
|
1167
|
-
used.
|
1168
|
-
disk : int, default 10240
|
1169
|
-
Disk size (in MB) required for this step. If
|
1170
|
-
`@resources` is also present, the maximum value from all decorators is
|
1171
|
-
used.
|
1172
|
-
image : str, optional, default None
|
1173
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
1174
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1175
|
-
not, a default Docker image mapping to the current version of Python is used.
|
1176
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1177
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1178
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1179
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
1180
|
-
secrets : List[str], optional, default None
|
1181
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1182
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1183
|
-
in Metaflow configuration.
|
1184
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1185
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
1186
|
-
gpu : int, optional, default None
|
1187
|
-
Number of GPUs required for this step. A value of zero implies that
|
1188
|
-
the scheduled node should not have GPUs.
|
1189
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1190
|
-
The vendor of the GPUs to be used for this step.
|
1191
|
-
tolerations : List[str], default []
|
1192
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1193
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1194
|
-
use_tmpfs : bool, default False
|
1195
|
-
This enables an explicit tmpfs mount for this step.
|
1196
|
-
tmpfs_tempdir : bool, default True
|
1197
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1198
|
-
tmpfs_size : int, optional, default: None
|
1199
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1200
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1201
|
-
memory allocated for this step.
|
1202
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
1203
|
-
Path to tmpfs mount for this step.
|
1204
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
1205
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1206
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1207
|
-
shared_memory: int, optional
|
1208
|
-
Shared memory size (in MiB) required for this step
|
1209
|
-
port: int, optional
|
1210
|
-
Port number to specify in the Kubernetes job object
|
960
|
+
vars : Dict[str, str], default {}
|
961
|
+
Dictionary of environment variables to set.
|
1211
962
|
"""
|
1212
963
|
...
|
1213
964
|
|
@@ -1245,59 +996,55 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
1245
996
|
...
|
1246
997
|
|
1247
998
|
@typing.overload
|
1248
|
-
def
|
999
|
+
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]]]:
|
1249
1000
|
"""
|
1250
|
-
Specifies
|
1251
|
-
|
1252
|
-
This decorator is useful if this step may hang indefinitely.
|
1001
|
+
Specifies the number of times the task corresponding
|
1002
|
+
to a step needs to be retried.
|
1253
1003
|
|
1254
|
-
This
|
1255
|
-
|
1256
|
-
|
1004
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1005
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1006
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1257
1007
|
|
1258
|
-
|
1259
|
-
|
1008
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1009
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1010
|
+
ensuring that the flow execution can continue.
|
1260
1011
|
|
1261
1012
|
Parameters
|
1262
1013
|
----------
|
1263
|
-
|
1264
|
-
Number of
|
1265
|
-
|
1266
|
-
Number of minutes
|
1267
|
-
hours : int, default 0
|
1268
|
-
Number of hours to wait prior to timing out.
|
1014
|
+
times : int, default 3
|
1015
|
+
Number of times to retry this task.
|
1016
|
+
minutes_between_retries : int, default 2
|
1017
|
+
Number of minutes between retries.
|
1269
1018
|
"""
|
1270
1019
|
...
|
1271
1020
|
|
1272
1021
|
@typing.overload
|
1273
|
-
def
|
1022
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1274
1023
|
...
|
1275
1024
|
|
1276
1025
|
@typing.overload
|
1277
|
-
def
|
1026
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1278
1027
|
...
|
1279
1028
|
|
1280
|
-
def
|
1029
|
+
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):
|
1281
1030
|
"""
|
1282
|
-
Specifies
|
1283
|
-
|
1284
|
-
This decorator is useful if this step may hang indefinitely.
|
1031
|
+
Specifies the number of times the task corresponding
|
1032
|
+
to a step needs to be retried.
|
1285
1033
|
|
1286
|
-
This
|
1287
|
-
|
1288
|
-
|
1034
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
1035
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
1036
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
1289
1037
|
|
1290
|
-
|
1291
|
-
|
1038
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1039
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
1040
|
+
ensuring that the flow execution can continue.
|
1292
1041
|
|
1293
1042
|
Parameters
|
1294
1043
|
----------
|
1295
|
-
|
1296
|
-
Number of
|
1297
|
-
|
1298
|
-
Number of minutes
|
1299
|
-
hours : int, default 0
|
1300
|
-
Number of hours to wait prior to timing out.
|
1044
|
+
times : int, default 3
|
1045
|
+
Number of times to retry this task.
|
1046
|
+
minutes_between_retries : int, default 2
|
1047
|
+
Number of minutes between retries.
|
1301
1048
|
"""
|
1302
1049
|
...
|
1303
1050
|
|
@@ -1359,75 +1106,503 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1359
1106
|
...
|
1360
1107
|
|
1361
1108
|
@typing.overload
|
1362
|
-
def
|
1109
|
+
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]]]:
|
1363
1110
|
"""
|
1364
|
-
Specifies
|
1111
|
+
Specifies the resources needed when executing this step.
|
1112
|
+
|
1113
|
+
Use `@resources` to specify the resource requirements
|
1114
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1115
|
+
|
1116
|
+
You can choose the compute layer on the command line by executing e.g.
|
1117
|
+
```
|
1118
|
+
python myflow.py run --with batch
|
1119
|
+
```
|
1120
|
+
or
|
1121
|
+
```
|
1122
|
+
python myflow.py run --with kubernetes
|
1123
|
+
```
|
1124
|
+
which executes the flow on the desired system using the
|
1125
|
+
requirements specified in `@resources`.
|
1365
1126
|
|
1366
1127
|
Parameters
|
1367
1128
|
----------
|
1368
|
-
|
1369
|
-
|
1129
|
+
cpu : int, default 1
|
1130
|
+
Number of CPUs required for this step.
|
1131
|
+
gpu : int, default 0
|
1132
|
+
Number of GPUs required for this step.
|
1133
|
+
disk : int, optional, default None
|
1134
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1135
|
+
memory : int, default 4096
|
1136
|
+
Memory size (in MB) required for this step.
|
1137
|
+
shared_memory : int, optional, default None
|
1138
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1139
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1370
1140
|
"""
|
1371
1141
|
...
|
1372
1142
|
|
1373
1143
|
@typing.overload
|
1374
|
-
def
|
1144
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1375
1145
|
...
|
1376
1146
|
|
1377
1147
|
@typing.overload
|
1378
|
-
def
|
1148
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1379
1149
|
...
|
1380
1150
|
|
1381
|
-
def
|
1151
|
+
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):
|
1382
1152
|
"""
|
1383
|
-
Specifies
|
1153
|
+
Specifies the resources needed when executing this step.
|
1154
|
+
|
1155
|
+
Use `@resources` to specify the resource requirements
|
1156
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1157
|
+
|
1158
|
+
You can choose the compute layer on the command line by executing e.g.
|
1159
|
+
```
|
1160
|
+
python myflow.py run --with batch
|
1161
|
+
```
|
1162
|
+
or
|
1163
|
+
```
|
1164
|
+
python myflow.py run --with kubernetes
|
1165
|
+
```
|
1166
|
+
which executes the flow on the desired system using the
|
1167
|
+
requirements specified in `@resources`.
|
1384
1168
|
|
1385
1169
|
Parameters
|
1386
1170
|
----------
|
1387
|
-
|
1388
|
-
|
1171
|
+
cpu : int, default 1
|
1172
|
+
Number of CPUs required for this step.
|
1173
|
+
gpu : int, default 0
|
1174
|
+
Number of GPUs required for this step.
|
1175
|
+
disk : int, optional, default None
|
1176
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1177
|
+
memory : int, default 4096
|
1178
|
+
Memory size (in MB) required for this step.
|
1179
|
+
shared_memory : int, optional, default None
|
1180
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1181
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1389
1182
|
"""
|
1390
1183
|
...
|
1391
1184
|
|
1392
|
-
|
1185
|
+
@typing.overload
|
1186
|
+
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]]]:
|
1393
1187
|
"""
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1398
|
-
starts only after all sensors finish.
|
1188
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1189
|
+
|
1190
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1399
1191
|
|
1400
1192
|
Parameters
|
1401
1193
|
----------
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1194
|
+
type : str, default 'default'
|
1195
|
+
Card type.
|
1196
|
+
id : str, optional, default None
|
1197
|
+
If multiple cards are present, use this id to identify this card.
|
1198
|
+
options : Dict[str, Any], default {}
|
1199
|
+
Options passed to the card. The contents depend on the card type.
|
1200
|
+
timeout : int, default 45
|
1201
|
+
Interrupt reporting if it takes more than this many seconds.
|
1202
|
+
|
1203
|
+
|
1204
|
+
"""
|
1205
|
+
...
|
1206
|
+
|
1207
|
+
@typing.overload
|
1208
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1209
|
+
...
|
1210
|
+
|
1211
|
+
@typing.overload
|
1212
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1213
|
+
...
|
1214
|
+
|
1215
|
+
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):
|
1216
|
+
"""
|
1217
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1218
|
+
|
1219
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1220
|
+
|
1221
|
+
Parameters
|
1222
|
+
----------
|
1223
|
+
type : str, default 'default'
|
1224
|
+
Card type.
|
1225
|
+
id : str, optional, default None
|
1226
|
+
If multiple cards are present, use this id to identify this card.
|
1227
|
+
options : Dict[str, Any], default {}
|
1228
|
+
Options passed to the card. The contents depend on the card type.
|
1229
|
+
timeout : int, default 45
|
1230
|
+
Interrupt reporting if it takes more than this many seconds.
|
1231
|
+
|
1232
|
+
|
1233
|
+
"""
|
1234
|
+
...
|
1235
|
+
|
1236
|
+
@typing.overload
|
1237
|
+
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]]]:
|
1238
|
+
"""
|
1239
|
+
Specifies the PyPI packages for the step.
|
1240
|
+
|
1241
|
+
Information in this decorator will augment any
|
1242
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1243
|
+
you can use `@pypi_base` to set packages required by all
|
1244
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1245
|
+
|
1246
|
+
Parameters
|
1247
|
+
----------
|
1248
|
+
packages : Dict[str, str], default: {}
|
1249
|
+
Packages to use for this step. The key is the name of the package
|
1250
|
+
and the value is the version to use.
|
1251
|
+
python : str, optional, default: None
|
1252
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1253
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1254
|
+
"""
|
1255
|
+
...
|
1256
|
+
|
1257
|
+
@typing.overload
|
1258
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1259
|
+
...
|
1260
|
+
|
1261
|
+
@typing.overload
|
1262
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1263
|
+
...
|
1264
|
+
|
1265
|
+
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):
|
1266
|
+
"""
|
1267
|
+
Specifies the PyPI packages for the step.
|
1268
|
+
|
1269
|
+
Information in this decorator will augment any
|
1270
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1271
|
+
you can use `@pypi_base` to set packages required by all
|
1272
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1273
|
+
|
1274
|
+
Parameters
|
1275
|
+
----------
|
1276
|
+
packages : Dict[str, str], default: {}
|
1277
|
+
Packages to use for this step. The key is the name of the package
|
1278
|
+
and the value is the version to use.
|
1279
|
+
python : str, optional, default: None
|
1280
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1281
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1282
|
+
"""
|
1283
|
+
...
|
1284
|
+
|
1285
|
+
@typing.overload
|
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]]]:
|
1287
|
+
"""
|
1288
|
+
Specifies that the step will success under all circumstances.
|
1289
|
+
|
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.
|
1294
|
+
|
1295
|
+
Parameters
|
1296
|
+
----------
|
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.
|
1303
|
+
"""
|
1304
|
+
...
|
1305
|
+
|
1306
|
+
@typing.overload
|
1307
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1308
|
+
...
|
1309
|
+
|
1310
|
+
@typing.overload
|
1311
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1312
|
+
...
|
1313
|
+
|
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):
|
1315
|
+
"""
|
1316
|
+
Specifies that the step will success under all circumstances.
|
1317
|
+
|
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.
|
1322
|
+
|
1323
|
+
Parameters
|
1324
|
+
----------
|
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.
|
1331
|
+
"""
|
1332
|
+
...
|
1333
|
+
|
1334
|
+
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]]]:
|
1335
|
+
"""
|
1336
|
+
Specifies that this step should execute on Kubernetes.
|
1337
|
+
|
1338
|
+
Parameters
|
1339
|
+
----------
|
1340
|
+
cpu : int, default 1
|
1341
|
+
Number of CPUs required for this step. If `@resources` is
|
1342
|
+
also present, the maximum value from all decorators is used.
|
1343
|
+
memory : int, default 4096
|
1344
|
+
Memory size (in MB) required for this step. If
|
1345
|
+
`@resources` is also present, the maximum value from all decorators is
|
1346
|
+
used.
|
1347
|
+
disk : int, default 10240
|
1348
|
+
Disk size (in MB) required for this step. If
|
1349
|
+
`@resources` is also present, the maximum value from all decorators is
|
1350
|
+
used.
|
1351
|
+
image : str, optional, default None
|
1352
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
1353
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1354
|
+
not, a default Docker image mapping to the current version of Python is used.
|
1355
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1356
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1357
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1358
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
1359
|
+
secrets : List[str], optional, default None
|
1360
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1361
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1362
|
+
in Metaflow configuration.
|
1363
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1364
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
1365
|
+
gpu : int, optional, default None
|
1366
|
+
Number of GPUs required for this step. A value of zero implies that
|
1367
|
+
the scheduled node should not have GPUs.
|
1368
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1369
|
+
The vendor of the GPUs to be used for this step.
|
1370
|
+
tolerations : List[str], default []
|
1371
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1372
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1373
|
+
use_tmpfs : bool, default False
|
1374
|
+
This enables an explicit tmpfs mount for this step.
|
1375
|
+
tmpfs_tempdir : bool, default True
|
1376
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1377
|
+
tmpfs_size : int, optional, default: None
|
1378
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
1379
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1380
|
+
memory allocated for this step.
|
1381
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
1382
|
+
Path to tmpfs mount for this step.
|
1383
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
1384
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1385
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1386
|
+
shared_memory: int, optional
|
1387
|
+
Shared memory size (in MiB) required for this step
|
1388
|
+
port: int, optional
|
1389
|
+
Port number to specify in the Kubernetes job object
|
1390
|
+
"""
|
1391
|
+
...
|
1392
|
+
|
1393
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1394
|
+
"""
|
1395
|
+
Specifies what flows belong to the same project.
|
1396
|
+
|
1397
|
+
A project-specific namespace is created for all flows that
|
1398
|
+
use the same `@project(name)`.
|
1399
|
+
|
1400
|
+
Parameters
|
1401
|
+
----------
|
1402
|
+
name : str
|
1403
|
+
Project name. Make sure that the name is unique amongst all
|
1404
|
+
projects that use the same production scheduler. The name may
|
1405
|
+
contain only lowercase alphanumeric characters and underscores.
|
1406
|
+
|
1407
|
+
|
1408
|
+
"""
|
1409
|
+
...
|
1410
|
+
|
1411
|
+
@typing.overload
|
1412
|
+
def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[str, str], None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1413
|
+
"""
|
1414
|
+
Specifies the flow(s) that this flow depends on.
|
1415
|
+
|
1416
|
+
```
|
1417
|
+
@trigger_on_finish(flow='FooFlow')
|
1418
|
+
```
|
1419
|
+
or
|
1420
|
+
```
|
1421
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1422
|
+
```
|
1423
|
+
This decorator respects the @project decorator and triggers the flow
|
1424
|
+
when upstream runs within the same namespace complete successfully
|
1425
|
+
|
1426
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1427
|
+
by specifying the fully qualified project_flow_name.
|
1428
|
+
```
|
1429
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1430
|
+
```
|
1431
|
+
or
|
1432
|
+
```
|
1433
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1434
|
+
```
|
1435
|
+
|
1436
|
+
You can also specify just the project or project branch (other values will be
|
1437
|
+
inferred from the current project or project branch):
|
1438
|
+
```
|
1439
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1440
|
+
```
|
1441
|
+
|
1442
|
+
Note that `branch` is typically one of:
|
1443
|
+
- `prod`
|
1444
|
+
- `user.bob`
|
1445
|
+
- `test.my_experiment`
|
1446
|
+
- `prod.staging`
|
1447
|
+
|
1448
|
+
Parameters
|
1449
|
+
----------
|
1450
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1451
|
+
Upstream flow dependency for this flow.
|
1452
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1453
|
+
Upstream flow dependencies for this flow.
|
1454
|
+
options : Dict[str, Any], default {}
|
1455
|
+
Backend-specific configuration for tuning eventing behavior.
|
1456
|
+
|
1457
|
+
|
1458
|
+
"""
|
1459
|
+
...
|
1460
|
+
|
1461
|
+
@typing.overload
|
1462
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1463
|
+
...
|
1464
|
+
|
1465
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[str, typing.Dict[str, str], None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1466
|
+
"""
|
1467
|
+
Specifies the flow(s) that this flow depends on.
|
1468
|
+
|
1469
|
+
```
|
1470
|
+
@trigger_on_finish(flow='FooFlow')
|
1471
|
+
```
|
1472
|
+
or
|
1473
|
+
```
|
1474
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1475
|
+
```
|
1476
|
+
This decorator respects the @project decorator and triggers the flow
|
1477
|
+
when upstream runs within the same namespace complete successfully
|
1478
|
+
|
1479
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1480
|
+
by specifying the fully qualified project_flow_name.
|
1481
|
+
```
|
1482
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1483
|
+
```
|
1484
|
+
or
|
1485
|
+
```
|
1486
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1487
|
+
```
|
1488
|
+
|
1489
|
+
You can also specify just the project or project branch (other values will be
|
1490
|
+
inferred from the current project or project branch):
|
1491
|
+
```
|
1492
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1493
|
+
```
|
1494
|
+
|
1495
|
+
Note that `branch` is typically one of:
|
1496
|
+
- `prod`
|
1497
|
+
- `user.bob`
|
1498
|
+
- `test.my_experiment`
|
1499
|
+
- `prod.staging`
|
1500
|
+
|
1501
|
+
Parameters
|
1502
|
+
----------
|
1503
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1504
|
+
Upstream flow dependency for this flow.
|
1505
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1506
|
+
Upstream flow dependencies for this flow.
|
1507
|
+
options : Dict[str, Any], default {}
|
1508
|
+
Backend-specific configuration for tuning eventing behavior.
|
1509
|
+
|
1510
|
+
|
1511
|
+
"""
|
1512
|
+
...
|
1513
|
+
|
1514
|
+
@typing.overload
|
1515
|
+
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]]:
|
1516
|
+
"""
|
1517
|
+
Specifies the event(s) that this flow depends on.
|
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
|
+
```
|
1546
|
+
|
1547
|
+
Parameters
|
1548
|
+
----------
|
1549
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1550
|
+
Event dependency for this flow.
|
1551
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1552
|
+
Events dependency for this flow.
|
1553
|
+
options : Dict[str, Any], default {}
|
1554
|
+
Backend-specific configuration for tuning eventing behavior.
|
1555
|
+
|
1556
|
+
|
1557
|
+
"""
|
1558
|
+
...
|
1559
|
+
|
1560
|
+
@typing.overload
|
1561
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1562
|
+
...
|
1563
|
+
|
1564
|
+
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] = {}):
|
1565
|
+
"""
|
1566
|
+
Specifies the event(s) that this flow depends on.
|
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
|
+
```
|
1595
|
+
|
1596
|
+
Parameters
|
1597
|
+
----------
|
1598
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1599
|
+
Event dependency for this flow.
|
1600
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1601
|
+
Events dependency for this flow.
|
1602
|
+
options : Dict[str, Any], default {}
|
1603
|
+
Backend-specific configuration for tuning eventing behavior.
|
1604
|
+
|
1605
|
+
|
1431
1606
|
"""
|
1432
1607
|
...
|
1433
1608
|
|
@@ -1529,24 +1704,6 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1529
1704
|
"""
|
1530
1705
|
...
|
1531
1706
|
|
1532
|
-
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1533
|
-
"""
|
1534
|
-
Specifies what flows belong to the same project.
|
1535
|
-
|
1536
|
-
A project-specific namespace is created for all flows that
|
1537
|
-
use the same `@project(name)`.
|
1538
|
-
|
1539
|
-
Parameters
|
1540
|
-
----------
|
1541
|
-
name : str
|
1542
|
-
Project name. Make sure that the name is unique amongst all
|
1543
|
-
projects that use the same production scheduler. The name may
|
1544
|
-
contain only lowercase alphanumeric characters and underscores.
|
1545
|
-
|
1546
|
-
|
1547
|
-
"""
|
1548
|
-
...
|
1549
|
-
|
1550
1707
|
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]]:
|
1551
1708
|
"""
|
1552
1709
|
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.
|
@@ -1589,98 +1746,45 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
1589
1746
|
"""
|
1590
1747
|
...
|
1591
1748
|
|
1592
|
-
|
1593
|
-
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]]:
|
1594
|
-
"""
|
1595
|
-
Specifies the event(s) that this flow depends on.
|
1596
|
-
|
1597
|
-
```
|
1598
|
-
@trigger(event='foo')
|
1599
|
-
```
|
1600
|
-
or
|
1601
|
-
```
|
1602
|
-
@trigger(events=['foo', 'bar'])
|
1603
|
-
```
|
1604
|
-
|
1605
|
-
Additionally, you can specify the parameter mappings
|
1606
|
-
to map event payload to Metaflow parameters for the flow.
|
1607
|
-
```
|
1608
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1609
|
-
```
|
1610
|
-
or
|
1611
|
-
```
|
1612
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1613
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1614
|
-
```
|
1615
|
-
|
1616
|
-
'parameters' can also be a list of strings and tuples like so:
|
1617
|
-
```
|
1618
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1619
|
-
```
|
1620
|
-
This is equivalent to:
|
1621
|
-
```
|
1622
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1623
|
-
```
|
1624
|
-
|
1625
|
-
Parameters
|
1626
|
-
----------
|
1627
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1628
|
-
Event dependency for this flow.
|
1629
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1630
|
-
Events dependency for this flow.
|
1631
|
-
options : Dict[str, Any], default {}
|
1632
|
-
Backend-specific configuration for tuning eventing behavior.
|
1633
|
-
|
1634
|
-
|
1635
|
-
"""
|
1636
|
-
...
|
1637
|
-
|
1638
|
-
@typing.overload
|
1639
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1640
|
-
...
|
1641
|
-
|
1642
|
-
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] = {}):
|
1749
|
+
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]]:
|
1643
1750
|
"""
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1649
|
-
or
|
1650
|
-
```
|
1651
|
-
@trigger(events=['foo', 'bar'])
|
1652
|
-
```
|
1653
|
-
|
1654
|
-
Additionally, you can specify the parameter mappings
|
1655
|
-
to map event payload to Metaflow parameters for the flow.
|
1656
|
-
```
|
1657
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1658
|
-
```
|
1659
|
-
or
|
1660
|
-
```
|
1661
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1662
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1663
|
-
```
|
1664
|
-
|
1665
|
-
'parameters' can also be a list of strings and tuples like so:
|
1666
|
-
```
|
1667
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1668
|
-
```
|
1669
|
-
This is equivalent to:
|
1670
|
-
```
|
1671
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1672
|
-
```
|
1751
|
+
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)
|
1752
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1753
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1754
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1755
|
+
starts only after all sensors finish.
|
1673
1756
|
|
1674
1757
|
Parameters
|
1675
1758
|
----------
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1759
|
+
timeout : int
|
1760
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1761
|
+
poke_interval : int
|
1762
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1763
|
+
mode : str
|
1764
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1765
|
+
exponential_backoff : bool
|
1766
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1767
|
+
pool : str
|
1768
|
+
the slot pool this task should run in,
|
1769
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1770
|
+
soft_fail : bool
|
1771
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1772
|
+
name : str
|
1773
|
+
Name of the sensor on Airflow
|
1774
|
+
description : str
|
1775
|
+
Description of sensor in the Airflow UI
|
1776
|
+
bucket_key : Union[str, List[str]]
|
1777
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1778
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1779
|
+
bucket_name : str
|
1780
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1781
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1782
|
+
wildcard_match : bool
|
1783
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1784
|
+
aws_conn_id : str
|
1785
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1786
|
+
verify : bool
|
1787
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1684
1788
|
"""
|
1685
1789
|
...
|
1686
1790
|
|
@@ -1723,109 +1827,6 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
1723
1827
|
"""
|
1724
1828
|
...
|
1725
1829
|
|
1726
|
-
@typing.overload
|
1727
|
-
def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[str, str], None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1728
|
-
"""
|
1729
|
-
Specifies the flow(s) that this flow depends on.
|
1730
|
-
|
1731
|
-
```
|
1732
|
-
@trigger_on_finish(flow='FooFlow')
|
1733
|
-
```
|
1734
|
-
or
|
1735
|
-
```
|
1736
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1737
|
-
```
|
1738
|
-
This decorator respects the @project decorator and triggers the flow
|
1739
|
-
when upstream runs within the same namespace complete successfully
|
1740
|
-
|
1741
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1742
|
-
by specifying the fully qualified project_flow_name.
|
1743
|
-
```
|
1744
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1745
|
-
```
|
1746
|
-
or
|
1747
|
-
```
|
1748
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1749
|
-
```
|
1750
|
-
|
1751
|
-
You can also specify just the project or project branch (other values will be
|
1752
|
-
inferred from the current project or project branch):
|
1753
|
-
```
|
1754
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1755
|
-
```
|
1756
|
-
|
1757
|
-
Note that `branch` is typically one of:
|
1758
|
-
- `prod`
|
1759
|
-
- `user.bob`
|
1760
|
-
- `test.my_experiment`
|
1761
|
-
- `prod.staging`
|
1762
|
-
|
1763
|
-
Parameters
|
1764
|
-
----------
|
1765
|
-
flow : Union[str, Dict[str, str]], optional, default None
|
1766
|
-
Upstream flow dependency for this flow.
|
1767
|
-
flows : List[Union[str, Dict[str, str]]], default []
|
1768
|
-
Upstream flow dependencies for this flow.
|
1769
|
-
options : Dict[str, Any], default {}
|
1770
|
-
Backend-specific configuration for tuning eventing behavior.
|
1771
|
-
|
1772
|
-
|
1773
|
-
"""
|
1774
|
-
...
|
1775
|
-
|
1776
|
-
@typing.overload
|
1777
|
-
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1778
|
-
...
|
1779
|
-
|
1780
|
-
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[str, typing.Dict[str, str], None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1781
|
-
"""
|
1782
|
-
Specifies the flow(s) that this flow depends on.
|
1783
|
-
|
1784
|
-
```
|
1785
|
-
@trigger_on_finish(flow='FooFlow')
|
1786
|
-
```
|
1787
|
-
or
|
1788
|
-
```
|
1789
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1790
|
-
```
|
1791
|
-
This decorator respects the @project decorator and triggers the flow
|
1792
|
-
when upstream runs within the same namespace complete successfully
|
1793
|
-
|
1794
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1795
|
-
by specifying the fully qualified project_flow_name.
|
1796
|
-
```
|
1797
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1798
|
-
```
|
1799
|
-
or
|
1800
|
-
```
|
1801
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1802
|
-
```
|
1803
|
-
|
1804
|
-
You can also specify just the project or project branch (other values will be
|
1805
|
-
inferred from the current project or project branch):
|
1806
|
-
```
|
1807
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1808
|
-
```
|
1809
|
-
|
1810
|
-
Note that `branch` is typically one of:
|
1811
|
-
- `prod`
|
1812
|
-
- `user.bob`
|
1813
|
-
- `test.my_experiment`
|
1814
|
-
- `prod.staging`
|
1815
|
-
|
1816
|
-
Parameters
|
1817
|
-
----------
|
1818
|
-
flow : Union[str, Dict[str, str]], optional, default None
|
1819
|
-
Upstream flow dependency for this flow.
|
1820
|
-
flows : List[Union[str, Dict[str, str]]], default []
|
1821
|
-
Upstream flow dependencies for this flow.
|
1822
|
-
options : Dict[str, Any], default {}
|
1823
|
-
Backend-specific configuration for tuning eventing behavior.
|
1824
|
-
|
1825
|
-
|
1826
|
-
"""
|
1827
|
-
...
|
1828
|
-
|
1829
1830
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1830
1831
|
"""
|
1831
1832
|
Switch namespace to the one provided.
|