metaflow-stubs 2.12.16__py2.py3-none-any.whl → 2.12.17__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 +498 -498
- metaflow-stubs/cards.pyi +5 -5
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +4 -4
- metaflow-stubs/client/core.pyi +6 -6
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/clone_util.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/metadata/metadata.pyi +2 -2
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +17 -17
- metaflow-stubs/mflog/mflog.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +4 -4
- metaflow-stubs/plugins/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_cli.pyi +3 -3
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +6 -6
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +6 -6
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_cli.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_cli.pyi +4 -4
- metaflow-stubs/plugins/cards/card_client.pyi +4 -4
- 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 +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +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 +4 -4
- metaflow-stubs/plugins/datatools/s3/s3.pyi +6 -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 +2 -2
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +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 +3 -3
- metaflow-stubs/plugins/project_decorator.pyi +3 -3
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/tag_cli.pyi +5 -5
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/procpoll.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +3 -3
- metaflow-stubs/runner/metaflow_runner.pyi +5 -5
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +3 -3
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.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.16.dist-info → metaflow_stubs-2.12.17.dist-info}/METADATA +2 -2
- metaflow_stubs-2.12.17.dist-info/RECORD +150 -0
- metaflow_stubs-2.12.16.dist-info/RECORD +0 -150
- {metaflow_stubs-2.12.16.dist-info → metaflow_stubs-2.12.17.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.12.16.dist-info → metaflow_stubs-2.12.17.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-08-
|
3
|
+
# MF version: 2.12.17 #
|
4
|
+
# Generated on 2024-08-27T00:52:58.058650 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import
|
12
|
-
import metaflow.client.core
|
13
|
-
import metaflow.flowspec
|
11
|
+
import metaflow.datastore.inputs
|
14
12
|
import metaflow._vendor.click.types
|
13
|
+
import metaflow.plugins.datatools.s3.s3
|
14
|
+
import metaflow.runner.metaflow_runner
|
15
|
+
import typing
|
15
16
|
import metaflow.parameters
|
16
17
|
import metaflow.metaflow_current
|
18
|
+
import metaflow.events
|
17
19
|
import io
|
20
|
+
import metaflow.flowspec
|
18
21
|
import datetime
|
19
|
-
import metaflow.
|
20
|
-
import metaflow.events
|
21
|
-
import metaflow.runner.metaflow_runner
|
22
|
-
import metaflow.plugins.datatools.s3.s3
|
22
|
+
import metaflow.client.core
|
23
23
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
24
24
|
StepFlag = typing.NewType("StepFlag", bool)
|
25
25
|
|
@@ -727,6 +727,173 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
727
727
|
"""
|
728
728
|
...
|
729
729
|
|
730
|
+
@typing.overload
|
731
|
+
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]]]:
|
732
|
+
"""
|
733
|
+
Specifies a timeout for your step.
|
734
|
+
|
735
|
+
This decorator is useful if this step may hang indefinitely.
|
736
|
+
|
737
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
738
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
739
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
740
|
+
|
741
|
+
Note that all the values specified in parameters are added together so if you specify
|
742
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
743
|
+
|
744
|
+
Parameters
|
745
|
+
----------
|
746
|
+
seconds : int, default 0
|
747
|
+
Number of seconds to wait prior to timing out.
|
748
|
+
minutes : int, default 0
|
749
|
+
Number of minutes to wait prior to timing out.
|
750
|
+
hours : int, default 0
|
751
|
+
Number of hours to wait prior to timing out.
|
752
|
+
"""
|
753
|
+
...
|
754
|
+
|
755
|
+
@typing.overload
|
756
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
757
|
+
...
|
758
|
+
|
759
|
+
@typing.overload
|
760
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
761
|
+
...
|
762
|
+
|
763
|
+
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):
|
764
|
+
"""
|
765
|
+
Specifies a timeout for your step.
|
766
|
+
|
767
|
+
This decorator is useful if this step may hang indefinitely.
|
768
|
+
|
769
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
770
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
771
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
772
|
+
|
773
|
+
Note that all the values specified in parameters are added together so if you specify
|
774
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
775
|
+
|
776
|
+
Parameters
|
777
|
+
----------
|
778
|
+
seconds : int, default 0
|
779
|
+
Number of seconds to wait prior to timing out.
|
780
|
+
minutes : int, default 0
|
781
|
+
Number of minutes to wait prior to timing out.
|
782
|
+
hours : int, default 0
|
783
|
+
Number of hours to wait prior to timing out.
|
784
|
+
"""
|
785
|
+
...
|
786
|
+
|
787
|
+
@typing.overload
|
788
|
+
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
789
|
+
"""
|
790
|
+
Specifies the Conda environment for the step.
|
791
|
+
|
792
|
+
Information in this decorator will augment any
|
793
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
794
|
+
you can use `@conda_base` to set packages required by all
|
795
|
+
steps and use `@conda` to specify step-specific overrides.
|
796
|
+
|
797
|
+
Parameters
|
798
|
+
----------
|
799
|
+
packages : Dict[str, str], default {}
|
800
|
+
Packages to use for this step. The key is the name of the package
|
801
|
+
and the value is the version to use.
|
802
|
+
libraries : Dict[str, str], default {}
|
803
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
804
|
+
python : str, optional, default None
|
805
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
806
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
807
|
+
disabled : bool, default False
|
808
|
+
If set to True, disables @conda.
|
809
|
+
"""
|
810
|
+
...
|
811
|
+
|
812
|
+
@typing.overload
|
813
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
814
|
+
...
|
815
|
+
|
816
|
+
@typing.overload
|
817
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
818
|
+
...
|
819
|
+
|
820
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
821
|
+
"""
|
822
|
+
Specifies the Conda environment for the step.
|
823
|
+
|
824
|
+
Information in this decorator will augment any
|
825
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
826
|
+
you can use `@conda_base` to set packages required by all
|
827
|
+
steps and use `@conda` to specify step-specific overrides.
|
828
|
+
|
829
|
+
Parameters
|
830
|
+
----------
|
831
|
+
packages : Dict[str, str], default {}
|
832
|
+
Packages to use for this step. The key is the name of the package
|
833
|
+
and the value is the version to use.
|
834
|
+
libraries : Dict[str, str], default {}
|
835
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
836
|
+
python : str, optional, default None
|
837
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
838
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
839
|
+
disabled : bool, default False
|
840
|
+
If set to True, disables @conda.
|
841
|
+
"""
|
842
|
+
...
|
843
|
+
|
844
|
+
@typing.overload
|
845
|
+
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]]]:
|
846
|
+
"""
|
847
|
+
Specifies the number of times the task corresponding
|
848
|
+
to a step needs to be retried.
|
849
|
+
|
850
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
851
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
852
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
853
|
+
|
854
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
855
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
856
|
+
ensuring that the flow execution can continue.
|
857
|
+
|
858
|
+
Parameters
|
859
|
+
----------
|
860
|
+
times : int, default 3
|
861
|
+
Number of times to retry this task.
|
862
|
+
minutes_between_retries : int, default 2
|
863
|
+
Number of minutes between retries.
|
864
|
+
"""
|
865
|
+
...
|
866
|
+
|
867
|
+
@typing.overload
|
868
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
869
|
+
...
|
870
|
+
|
871
|
+
@typing.overload
|
872
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
873
|
+
...
|
874
|
+
|
875
|
+
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):
|
876
|
+
"""
|
877
|
+
Specifies the number of times the task corresponding
|
878
|
+
to a step needs to be retried.
|
879
|
+
|
880
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
881
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
882
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
883
|
+
|
884
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
885
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
886
|
+
ensuring that the flow execution can continue.
|
887
|
+
|
888
|
+
Parameters
|
889
|
+
----------
|
890
|
+
times : int, default 3
|
891
|
+
Number of times to retry this task.
|
892
|
+
minutes_between_retries : int, default 2
|
893
|
+
Number of minutes between retries.
|
894
|
+
"""
|
895
|
+
...
|
896
|
+
|
730
897
|
@typing.overload
|
731
898
|
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]]]:
|
732
899
|
"""
|
@@ -874,87 +1041,114 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
874
1041
|
"""
|
875
1042
|
...
|
876
1043
|
|
877
|
-
|
878
|
-
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1044
|
+
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, compute_pool: 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]]]:
|
879
1045
|
"""
|
880
|
-
Specifies
|
881
|
-
the execution of a step.
|
1046
|
+
Specifies that this step should execute on Kubernetes.
|
882
1047
|
|
883
1048
|
Parameters
|
884
1049
|
----------
|
885
|
-
|
886
|
-
|
1050
|
+
cpu : int, default 1
|
1051
|
+
Number of CPUs required for this step. If `@resources` is
|
1052
|
+
also present, the maximum value from all decorators is used.
|
1053
|
+
memory : int, default 4096
|
1054
|
+
Memory size (in MB) required for this step. If
|
1055
|
+
`@resources` is also present, the maximum value from all decorators is
|
1056
|
+
used.
|
1057
|
+
disk : int, default 10240
|
1058
|
+
Disk size (in MB) required for this step. If
|
1059
|
+
`@resources` is also present, the maximum value from all decorators is
|
1060
|
+
used.
|
1061
|
+
image : str, optional, default None
|
1062
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
1063
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1064
|
+
not, a default Docker image mapping to the current version of Python is used.
|
1065
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1066
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1067
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1068
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
1069
|
+
secrets : List[str], optional, default None
|
1070
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1071
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1072
|
+
in Metaflow configuration.
|
1073
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1074
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
1075
|
+
gpu : int, optional, default None
|
1076
|
+
Number of GPUs required for this step. A value of zero implies that
|
1077
|
+
the scheduled node should not have GPUs.
|
1078
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1079
|
+
The vendor of the GPUs to be used for this step.
|
1080
|
+
tolerations : List[str], default []
|
1081
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1082
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1083
|
+
use_tmpfs : bool, default False
|
1084
|
+
This enables an explicit tmpfs mount for this step.
|
1085
|
+
tmpfs_tempdir : bool, default True
|
1086
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1087
|
+
tmpfs_size : int, optional, default: None
|
1088
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
1089
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1090
|
+
memory allocated for this step.
|
1091
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
1092
|
+
Path to tmpfs mount for this step.
|
1093
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
1094
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1095
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1096
|
+
shared_memory: int, optional
|
1097
|
+
Shared memory size (in MiB) required for this step
|
1098
|
+
port: int, optional
|
1099
|
+
Port number to specify in the Kubernetes job object
|
1100
|
+
compute_pool : str, optional, default None
|
1101
|
+
Compute pool to be used for for this step.
|
1102
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
887
1103
|
"""
|
888
1104
|
...
|
889
1105
|
|
890
1106
|
@typing.overload
|
891
|
-
def
|
892
|
-
...
|
893
|
-
|
894
|
-
@typing.overload
|
895
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
896
|
-
...
|
897
|
-
|
898
|
-
def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
|
1107
|
+
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]]]:
|
899
1108
|
"""
|
900
|
-
Specifies
|
901
|
-
the execution of a step.
|
1109
|
+
Specifies that the step will success under all circumstances.
|
902
1110
|
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
"""
|
908
|
-
...
|
909
|
-
|
910
|
-
@typing.overload
|
911
|
-
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]]]:
|
912
|
-
"""
|
913
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
914
|
-
|
915
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1111
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1112
|
+
contains the exception raised. You can use it to detect the presence
|
1113
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1114
|
+
are missing.
|
916
1115
|
|
917
1116
|
Parameters
|
918
1117
|
----------
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
timeout : int, default 45
|
926
|
-
Interrupt reporting if it takes more than this many seconds.
|
927
|
-
|
928
|
-
|
1118
|
+
var : str, optional, default None
|
1119
|
+
Name of the artifact in which to store the caught exception.
|
1120
|
+
If not specified, the exception is not stored.
|
1121
|
+
print_exception : bool, default True
|
1122
|
+
Determines whether or not the exception is printed to
|
1123
|
+
stdout when caught.
|
929
1124
|
"""
|
930
1125
|
...
|
931
1126
|
|
932
1127
|
@typing.overload
|
933
|
-
def
|
1128
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
934
1129
|
...
|
935
1130
|
|
936
1131
|
@typing.overload
|
937
|
-
def
|
1132
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
938
1133
|
...
|
939
1134
|
|
940
|
-
def
|
1135
|
+
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):
|
941
1136
|
"""
|
942
|
-
|
1137
|
+
Specifies that the step will success under all circumstances.
|
943
1138
|
|
944
|
-
|
1139
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1140
|
+
contains the exception raised. You can use it to detect the presence
|
1141
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1142
|
+
are missing.
|
945
1143
|
|
946
1144
|
Parameters
|
947
1145
|
----------
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
timeout : int, default 45
|
955
|
-
Interrupt reporting if it takes more than this many seconds.
|
956
|
-
|
957
|
-
|
1146
|
+
var : str, optional, default None
|
1147
|
+
Name of the artifact in which to store the caught exception.
|
1148
|
+
If not specified, the exception is not stored.
|
1149
|
+
print_exception : bool, default True
|
1150
|
+
Determines whether or not the exception is printed to
|
1151
|
+
stdout when caught.
|
958
1152
|
"""
|
959
1153
|
...
|
960
1154
|
|
@@ -1036,112 +1230,86 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
1036
1230
|
...
|
1037
1231
|
|
1038
1232
|
@typing.overload
|
1039
|
-
def
|
1233
|
+
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1040
1234
|
"""
|
1041
|
-
Specifies
|
1042
|
-
|
1043
|
-
|
1044
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1045
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1046
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1047
|
-
|
1048
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1049
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1050
|
-
ensuring that the flow execution can continue.
|
1235
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1236
|
+
the execution of a step.
|
1051
1237
|
|
1052
1238
|
Parameters
|
1053
1239
|
----------
|
1054
|
-
|
1055
|
-
|
1056
|
-
minutes_between_retries : int, default 2
|
1057
|
-
Number of minutes between retries.
|
1240
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1241
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1058
1242
|
"""
|
1059
1243
|
...
|
1060
1244
|
|
1061
1245
|
@typing.overload
|
1062
|
-
def
|
1246
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1063
1247
|
...
|
1064
1248
|
|
1065
1249
|
@typing.overload
|
1066
|
-
def
|
1250
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1067
1251
|
...
|
1068
1252
|
|
1069
|
-
def
|
1253
|
+
def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
|
1070
1254
|
"""
|
1071
|
-
Specifies
|
1072
|
-
|
1073
|
-
|
1074
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1075
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1076
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1077
|
-
|
1078
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1079
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1080
|
-
ensuring that the flow execution can continue.
|
1255
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1256
|
+
the execution of a step.
|
1081
1257
|
|
1082
1258
|
Parameters
|
1083
1259
|
----------
|
1084
|
-
|
1085
|
-
|
1086
|
-
minutes_between_retries : int, default 2
|
1087
|
-
Number of minutes between retries.
|
1260
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1261
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1088
1262
|
"""
|
1089
1263
|
...
|
1090
1264
|
|
1091
1265
|
@typing.overload
|
1092
|
-
def
|
1266
|
+
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]]]:
|
1093
1267
|
"""
|
1094
|
-
|
1095
|
-
|
1096
|
-
This decorator is useful if this step may hang indefinitely.
|
1097
|
-
|
1098
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1099
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1100
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1268
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1101
1269
|
|
1102
|
-
Note that
|
1103
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1270
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1104
1271
|
|
1105
1272
|
Parameters
|
1106
1273
|
----------
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1274
|
+
type : str, default 'default'
|
1275
|
+
Card type.
|
1276
|
+
id : str, optional, default None
|
1277
|
+
If multiple cards are present, use this id to identify this card.
|
1278
|
+
options : Dict[str, Any], default {}
|
1279
|
+
Options passed to the card. The contents depend on the card type.
|
1280
|
+
timeout : int, default 45
|
1281
|
+
Interrupt reporting if it takes more than this many seconds.
|
1282
|
+
|
1283
|
+
|
1113
1284
|
"""
|
1114
1285
|
...
|
1115
1286
|
|
1116
1287
|
@typing.overload
|
1117
|
-
def
|
1288
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1118
1289
|
...
|
1119
1290
|
|
1120
1291
|
@typing.overload
|
1121
|
-
def
|
1292
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1122
1293
|
...
|
1123
1294
|
|
1124
|
-
def
|
1295
|
+
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):
|
1125
1296
|
"""
|
1126
|
-
|
1127
|
-
|
1128
|
-
This decorator is useful if this step may hang indefinitely.
|
1129
|
-
|
1130
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1131
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1132
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1297
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1133
1298
|
|
1134
|
-
Note that
|
1135
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1299
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1136
1300
|
|
1137
1301
|
Parameters
|
1138
1302
|
----------
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1303
|
+
type : str, default 'default'
|
1304
|
+
Card type.
|
1305
|
+
id : str, optional, default None
|
1306
|
+
If multiple cards are present, use this id to identify this card.
|
1307
|
+
options : Dict[str, Any], default {}
|
1308
|
+
Options passed to the card. The contents depend on the card type.
|
1309
|
+
timeout : int, default 45
|
1310
|
+
Interrupt reporting if it takes more than this many seconds.
|
1311
|
+
|
1312
|
+
|
1145
1313
|
"""
|
1146
1314
|
...
|
1147
1315
|
|
@@ -1194,6 +1362,25 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
1194
1362
|
"""
|
1195
1363
|
...
|
1196
1364
|
|
1365
|
+
@typing.overload
|
1366
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1367
|
+
"""
|
1368
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1369
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1370
|
+
"""
|
1371
|
+
...
|
1372
|
+
|
1373
|
+
@typing.overload
|
1374
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1375
|
+
...
|
1376
|
+
|
1377
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1378
|
+
"""
|
1379
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1380
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1381
|
+
"""
|
1382
|
+
...
|
1383
|
+
|
1197
1384
|
@typing.overload
|
1198
1385
|
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]]]:
|
1199
1386
|
"""
|
@@ -1226,196 +1413,61 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
|
|
1226
1413
|
...
|
1227
1414
|
|
1228
1415
|
@typing.overload
|
1229
|
-
def
|
1416
|
+
def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1230
1417
|
"""
|
1231
|
-
Specifies
|
1418
|
+
Specifies the Conda environment for all steps of the flow.
|
1232
1419
|
|
1233
|
-
|
1234
|
-
|
1235
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1236
|
-
are missing.
|
1420
|
+
Use `@conda_base` to set common libraries required by all
|
1421
|
+
steps and use `@conda` to specify step-specific additions.
|
1237
1422
|
|
1238
1423
|
Parameters
|
1239
1424
|
----------
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1425
|
+
packages : Dict[str, str], default {}
|
1426
|
+
Packages to use for this flow. The key is the name of the package
|
1427
|
+
and the value is the version to use.
|
1428
|
+
libraries : Dict[str, str], default {}
|
1429
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1430
|
+
python : str, optional, default None
|
1431
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1432
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1433
|
+
disabled : bool, default False
|
1434
|
+
If set to True, disables Conda.
|
1246
1435
|
"""
|
1247
1436
|
...
|
1248
1437
|
|
1249
1438
|
@typing.overload
|
1250
|
-
def
|
1251
|
-
...
|
1252
|
-
|
1253
|
-
@typing.overload
|
1254
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1439
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1255
1440
|
...
|
1256
1441
|
|
1257
|
-
def
|
1442
|
+
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1258
1443
|
"""
|
1259
|
-
Specifies
|
1444
|
+
Specifies the Conda environment for all steps of the flow.
|
1260
1445
|
|
1261
|
-
|
1262
|
-
|
1263
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1264
|
-
are missing.
|
1446
|
+
Use `@conda_base` to set common libraries required by all
|
1447
|
+
steps and use `@conda` to specify step-specific additions.
|
1265
1448
|
|
1266
1449
|
Parameters
|
1267
1450
|
----------
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1451
|
+
packages : Dict[str, str], default {}
|
1452
|
+
Packages to use for this flow. The key is the name of the package
|
1453
|
+
and the value is the version to use.
|
1454
|
+
libraries : Dict[str, str], default {}
|
1455
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1456
|
+
python : str, optional, default None
|
1457
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1458
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1459
|
+
disabled : bool, default False
|
1460
|
+
If set to True, disables Conda.
|
1274
1461
|
"""
|
1275
1462
|
...
|
1276
1463
|
|
1277
|
-
def
|
1464
|
+
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]]:
|
1278
1465
|
"""
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
Number of CPUs required for this step. If `@resources` is
|
1285
|
-
also present, the maximum value from all decorators is used.
|
1286
|
-
memory : int, default 4096
|
1287
|
-
Memory size (in MB) required for this step. If
|
1288
|
-
`@resources` is also present, the maximum value from all decorators is
|
1289
|
-
used.
|
1290
|
-
disk : int, default 10240
|
1291
|
-
Disk size (in MB) required for this step. If
|
1292
|
-
`@resources` is also present, the maximum value from all decorators is
|
1293
|
-
used.
|
1294
|
-
image : str, optional, default None
|
1295
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
1296
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
1297
|
-
not, a default Docker image mapping to the current version of Python is used.
|
1298
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
1299
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
1300
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
1301
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
1302
|
-
secrets : List[str], optional, default None
|
1303
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
1304
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
1305
|
-
in Metaflow configuration.
|
1306
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
1307
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
1308
|
-
gpu : int, optional, default None
|
1309
|
-
Number of GPUs required for this step. A value of zero implies that
|
1310
|
-
the scheduled node should not have GPUs.
|
1311
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
1312
|
-
The vendor of the GPUs to be used for this step.
|
1313
|
-
tolerations : List[str], default []
|
1314
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
1315
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
1316
|
-
use_tmpfs : bool, default False
|
1317
|
-
This enables an explicit tmpfs mount for this step.
|
1318
|
-
tmpfs_tempdir : bool, default True
|
1319
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
1320
|
-
tmpfs_size : int, optional, default: None
|
1321
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
1322
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
1323
|
-
memory allocated for this step.
|
1324
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
1325
|
-
Path to tmpfs mount for this step.
|
1326
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
1327
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
1328
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
1329
|
-
shared_memory: int, optional
|
1330
|
-
Shared memory size (in MiB) required for this step
|
1331
|
-
port: int, optional
|
1332
|
-
Port number to specify in the Kubernetes job object
|
1333
|
-
compute_pool : str, optional, default None
|
1334
|
-
Compute pool to be used for for this step.
|
1335
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
1336
|
-
"""
|
1337
|
-
...
|
1338
|
-
|
1339
|
-
@typing.overload
|
1340
|
-
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1341
|
-
"""
|
1342
|
-
Specifies the Conda environment for the step.
|
1343
|
-
|
1344
|
-
Information in this decorator will augment any
|
1345
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1346
|
-
you can use `@conda_base` to set packages required by all
|
1347
|
-
steps and use `@conda` to specify step-specific overrides.
|
1348
|
-
|
1349
|
-
Parameters
|
1350
|
-
----------
|
1351
|
-
packages : Dict[str, str], default {}
|
1352
|
-
Packages to use for this step. The key is the name of the package
|
1353
|
-
and the value is the version to use.
|
1354
|
-
libraries : Dict[str, str], default {}
|
1355
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1356
|
-
python : str, optional, default None
|
1357
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1358
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1359
|
-
disabled : bool, default False
|
1360
|
-
If set to True, disables @conda.
|
1361
|
-
"""
|
1362
|
-
...
|
1363
|
-
|
1364
|
-
@typing.overload
|
1365
|
-
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1366
|
-
...
|
1367
|
-
|
1368
|
-
@typing.overload
|
1369
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1370
|
-
...
|
1371
|
-
|
1372
|
-
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1373
|
-
"""
|
1374
|
-
Specifies the Conda environment for the step.
|
1375
|
-
|
1376
|
-
Information in this decorator will augment any
|
1377
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1378
|
-
you can use `@conda_base` to set packages required by all
|
1379
|
-
steps and use `@conda` to specify step-specific overrides.
|
1380
|
-
|
1381
|
-
Parameters
|
1382
|
-
----------
|
1383
|
-
packages : Dict[str, str], default {}
|
1384
|
-
Packages to use for this step. The key is the name of the package
|
1385
|
-
and the value is the version to use.
|
1386
|
-
libraries : Dict[str, str], default {}
|
1387
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1388
|
-
python : str, optional, default None
|
1389
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1390
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1391
|
-
disabled : bool, default False
|
1392
|
-
If set to True, disables @conda.
|
1393
|
-
"""
|
1394
|
-
...
|
1395
|
-
|
1396
|
-
@typing.overload
|
1397
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1398
|
-
"""
|
1399
|
-
Decorator prototype for all step decorators. This function gets specialized
|
1400
|
-
and imported for all decorators types by _import_plugin_decorators().
|
1401
|
-
"""
|
1402
|
-
...
|
1403
|
-
|
1404
|
-
@typing.overload
|
1405
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1406
|
-
...
|
1407
|
-
|
1408
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1409
|
-
"""
|
1410
|
-
Decorator prototype for all step decorators. This function gets specialized
|
1411
|
-
and imported for all decorators types by _import_plugin_decorators().
|
1412
|
-
"""
|
1413
|
-
...
|
1414
|
-
|
1415
|
-
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]]:
|
1416
|
-
"""
|
1417
|
-
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.
|
1418
|
-
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.
|
1466
|
+
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)
|
1467
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1468
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1469
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1470
|
+
starts only after all sensors finish.
|
1419
1471
|
|
1420
1472
|
Parameters
|
1421
1473
|
----------
|
@@ -1436,120 +1488,64 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
1436
1488
|
Name of the sensor on Airflow
|
1437
1489
|
description : str
|
1438
1490
|
Description of sensor in the Airflow UI
|
1439
|
-
|
1440
|
-
The
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
check_existence: bool
|
1452
|
-
Set to True to check if the external task exists or check if
|
1453
|
-
the DAG to wait for exists. (Default: True)
|
1454
|
-
"""
|
1455
|
-
...
|
1456
|
-
|
1457
|
-
@typing.overload
|
1458
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1459
|
-
"""
|
1460
|
-
Specifies the PyPI packages for all steps of the flow.
|
1461
|
-
|
1462
|
-
Use `@pypi_base` to set common packages required by all
|
1463
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1464
|
-
Parameters
|
1465
|
-
----------
|
1466
|
-
packages : Dict[str, str], default: {}
|
1467
|
-
Packages to use for this flow. The key is the name of the package
|
1468
|
-
and the value is the version to use.
|
1469
|
-
python : str, optional, default: None
|
1470
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1471
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1472
|
-
"""
|
1473
|
-
...
|
1474
|
-
|
1475
|
-
@typing.overload
|
1476
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1477
|
-
...
|
1478
|
-
|
1479
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1480
|
-
"""
|
1481
|
-
Specifies the PyPI packages for all steps of the flow.
|
1482
|
-
|
1483
|
-
Use `@pypi_base` to set common packages required by all
|
1484
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1485
|
-
Parameters
|
1486
|
-
----------
|
1487
|
-
packages : Dict[str, str], default: {}
|
1488
|
-
Packages to use for this flow. The key is the name of the package
|
1489
|
-
and the value is the version to use.
|
1490
|
-
python : str, optional, default: None
|
1491
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1492
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1493
|
-
"""
|
1494
|
-
...
|
1495
|
-
|
1496
|
-
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1497
|
-
"""
|
1498
|
-
Specifies what flows belong to the same project.
|
1499
|
-
|
1500
|
-
A project-specific namespace is created for all flows that
|
1501
|
-
use the same `@project(name)`.
|
1502
|
-
|
1503
|
-
Parameters
|
1504
|
-
----------
|
1505
|
-
name : str
|
1506
|
-
Project name. Make sure that the name is unique amongst all
|
1507
|
-
projects that use the same production scheduler. The name may
|
1508
|
-
contain only lowercase alphanumeric characters and underscores.
|
1509
|
-
|
1510
|
-
|
1491
|
+
bucket_key : Union[str, List[str]]
|
1492
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1493
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1494
|
+
bucket_name : str
|
1495
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1496
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1497
|
+
wildcard_match : bool
|
1498
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1499
|
+
aws_conn_id : str
|
1500
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1501
|
+
verify : bool
|
1502
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1511
1503
|
"""
|
1512
1504
|
...
|
1513
1505
|
|
1514
1506
|
@typing.overload
|
1515
|
-
def
|
1507
|
+
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]]:
|
1516
1508
|
"""
|
1517
|
-
Specifies the
|
1509
|
+
Specifies the flow(s) that this flow depends on.
|
1518
1510
|
|
1519
1511
|
```
|
1520
|
-
@
|
1512
|
+
@trigger_on_finish(flow='FooFlow')
|
1521
1513
|
```
|
1522
1514
|
or
|
1523
1515
|
```
|
1524
|
-
@
|
1516
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1525
1517
|
```
|
1518
|
+
This decorator respects the @project decorator and triggers the flow
|
1519
|
+
when upstream runs within the same namespace complete successfully
|
1526
1520
|
|
1527
|
-
Additionally, you can specify
|
1528
|
-
|
1521
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1522
|
+
by specifying the fully qualified project_flow_name.
|
1529
1523
|
```
|
1530
|
-
@
|
1524
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1531
1525
|
```
|
1532
1526
|
or
|
1533
1527
|
```
|
1534
|
-
@
|
1535
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1528
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1536
1529
|
```
|
1537
1530
|
|
1538
|
-
|
1539
|
-
|
1540
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1541
|
-
```
|
1542
|
-
This is equivalent to:
|
1531
|
+
You can also specify just the project or project branch (other values will be
|
1532
|
+
inferred from the current project or project branch):
|
1543
1533
|
```
|
1544
|
-
@
|
1534
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1545
1535
|
```
|
1546
1536
|
|
1537
|
+
Note that `branch` is typically one of:
|
1538
|
+
- `prod`
|
1539
|
+
- `user.bob`
|
1540
|
+
- `test.my_experiment`
|
1541
|
+
- `prod.staging`
|
1542
|
+
|
1547
1543
|
Parameters
|
1548
1544
|
----------
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1545
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1546
|
+
Upstream flow dependency for this flow.
|
1547
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1548
|
+
Upstream flow dependencies for this flow.
|
1553
1549
|
options : Dict[str, Any], default {}
|
1554
1550
|
Backend-specific configuration for tuning eventing behavior.
|
1555
1551
|
|
@@ -1558,47 +1554,51 @@ def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = No
|
|
1558
1554
|
...
|
1559
1555
|
|
1560
1556
|
@typing.overload
|
1561
|
-
def
|
1557
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1562
1558
|
...
|
1563
1559
|
|
1564
|
-
def
|
1560
|
+
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] = {}):
|
1565
1561
|
"""
|
1566
|
-
Specifies the
|
1562
|
+
Specifies the flow(s) that this flow depends on.
|
1567
1563
|
|
1568
1564
|
```
|
1569
|
-
@
|
1565
|
+
@trigger_on_finish(flow='FooFlow')
|
1570
1566
|
```
|
1571
1567
|
or
|
1572
1568
|
```
|
1573
|
-
@
|
1569
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1574
1570
|
```
|
1571
|
+
This decorator respects the @project decorator and triggers the flow
|
1572
|
+
when upstream runs within the same namespace complete successfully
|
1575
1573
|
|
1576
|
-
Additionally, you can specify
|
1577
|
-
|
1574
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1575
|
+
by specifying the fully qualified project_flow_name.
|
1578
1576
|
```
|
1579
|
-
@
|
1577
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1580
1578
|
```
|
1581
1579
|
or
|
1582
1580
|
```
|
1583
|
-
@
|
1584
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1581
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1585
1582
|
```
|
1586
1583
|
|
1587
|
-
|
1588
|
-
|
1589
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1590
|
-
```
|
1591
|
-
This is equivalent to:
|
1584
|
+
You can also specify just the project or project branch (other values will be
|
1585
|
+
inferred from the current project or project branch):
|
1592
1586
|
```
|
1593
|
-
@
|
1587
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1594
1588
|
```
|
1595
1589
|
|
1590
|
+
Note that `branch` is typically one of:
|
1591
|
+
- `prod`
|
1592
|
+
- `user.bob`
|
1593
|
+
- `test.my_experiment`
|
1594
|
+
- `prod.staging`
|
1595
|
+
|
1596
1596
|
Parameters
|
1597
1597
|
----------
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1598
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1599
|
+
Upstream flow dependency for this flow.
|
1600
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1601
|
+
Upstream flow dependencies for this flow.
|
1602
1602
|
options : Dict[str, Any], default {}
|
1603
1603
|
Backend-specific configuration for tuning eventing behavior.
|
1604
1604
|
|
@@ -1606,6 +1606,24 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1606
1606
|
"""
|
1607
1607
|
...
|
1608
1608
|
|
1609
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1610
|
+
"""
|
1611
|
+
Specifies what flows belong to the same project.
|
1612
|
+
|
1613
|
+
A project-specific namespace is created for all flows that
|
1614
|
+
use the same `@project(name)`.
|
1615
|
+
|
1616
|
+
Parameters
|
1617
|
+
----------
|
1618
|
+
name : str
|
1619
|
+
Project name. Make sure that the name is unique amongst all
|
1620
|
+
projects that use the same production scheduler. The name may
|
1621
|
+
contain only lowercase alphanumeric characters and underscores.
|
1622
|
+
|
1623
|
+
|
1624
|
+
"""
|
1625
|
+
...
|
1626
|
+
|
1609
1627
|
@typing.overload
|
1610
1628
|
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]]:
|
1611
1629
|
"""
|
@@ -1656,48 +1674,44 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1656
1674
|
...
|
1657
1675
|
|
1658
1676
|
@typing.overload
|
1659
|
-
def
|
1677
|
+
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]]:
|
1660
1678
|
"""
|
1661
|
-
Specifies the
|
1679
|
+
Specifies the event(s) that this flow depends on.
|
1662
1680
|
|
1663
1681
|
```
|
1664
|
-
@
|
1682
|
+
@trigger(event='foo')
|
1665
1683
|
```
|
1666
1684
|
or
|
1667
1685
|
```
|
1668
|
-
@
|
1686
|
+
@trigger(events=['foo', 'bar'])
|
1669
1687
|
```
|
1670
|
-
This decorator respects the @project decorator and triggers the flow
|
1671
|
-
when upstream runs within the same namespace complete successfully
|
1672
1688
|
|
1673
|
-
Additionally, you can specify
|
1674
|
-
|
1689
|
+
Additionally, you can specify the parameter mappings
|
1690
|
+
to map event payload to Metaflow parameters for the flow.
|
1675
1691
|
```
|
1676
|
-
@
|
1692
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1677
1693
|
```
|
1678
1694
|
or
|
1679
1695
|
```
|
1680
|
-
@
|
1696
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1697
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1681
1698
|
```
|
1682
1699
|
|
1683
|
-
|
1684
|
-
inferred from the current project or project branch):
|
1700
|
+
'parameters' can also be a list of strings and tuples like so:
|
1685
1701
|
```
|
1686
|
-
@
|
1702
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1703
|
+
```
|
1704
|
+
This is equivalent to:
|
1705
|
+
```
|
1706
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1687
1707
|
```
|
1688
|
-
|
1689
|
-
Note that `branch` is typically one of:
|
1690
|
-
- `prod`
|
1691
|
-
- `user.bob`
|
1692
|
-
- `test.my_experiment`
|
1693
|
-
- `prod.staging`
|
1694
1708
|
|
1695
1709
|
Parameters
|
1696
1710
|
----------
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1711
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1712
|
+
Event dependency for this flow.
|
1713
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1714
|
+
Events dependency for this flow.
|
1701
1715
|
options : Dict[str, Any], default {}
|
1702
1716
|
Backend-specific configuration for tuning eventing behavior.
|
1703
1717
|
|
@@ -1706,51 +1720,47 @@ def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[str, str], None] =
|
|
1706
1720
|
...
|
1707
1721
|
|
1708
1722
|
@typing.overload
|
1709
|
-
def
|
1723
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1710
1724
|
...
|
1711
1725
|
|
1712
|
-
def
|
1726
|
+
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] = {}):
|
1713
1727
|
"""
|
1714
|
-
Specifies the
|
1728
|
+
Specifies the event(s) that this flow depends on.
|
1715
1729
|
|
1716
1730
|
```
|
1717
|
-
@
|
1731
|
+
@trigger(event='foo')
|
1718
1732
|
```
|
1719
1733
|
or
|
1720
1734
|
```
|
1721
|
-
@
|
1735
|
+
@trigger(events=['foo', 'bar'])
|
1722
1736
|
```
|
1723
|
-
This decorator respects the @project decorator and triggers the flow
|
1724
|
-
when upstream runs within the same namespace complete successfully
|
1725
1737
|
|
1726
|
-
Additionally, you can specify
|
1727
|
-
|
1738
|
+
Additionally, you can specify the parameter mappings
|
1739
|
+
to map event payload to Metaflow parameters for the flow.
|
1728
1740
|
```
|
1729
|
-
@
|
1741
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1730
1742
|
```
|
1731
1743
|
or
|
1732
1744
|
```
|
1733
|
-
@
|
1745
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1746
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1734
1747
|
```
|
1735
1748
|
|
1736
|
-
|
1737
|
-
inferred from the current project or project branch):
|
1749
|
+
'parameters' can also be a list of strings and tuples like so:
|
1738
1750
|
```
|
1739
|
-
@
|
1751
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1752
|
+
```
|
1753
|
+
This is equivalent to:
|
1754
|
+
```
|
1755
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1740
1756
|
```
|
1741
|
-
|
1742
|
-
Note that `branch` is typically one of:
|
1743
|
-
- `prod`
|
1744
|
-
- `user.bob`
|
1745
|
-
- `test.my_experiment`
|
1746
|
-
- `prod.staging`
|
1747
1757
|
|
1748
1758
|
Parameters
|
1749
1759
|
----------
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1760
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1761
|
+
Event dependency for this flow.
|
1762
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1763
|
+
Events dependency for this flow.
|
1754
1764
|
options : Dict[str, Any], default {}
|
1755
1765
|
Backend-specific configuration for tuning eventing behavior.
|
1756
1766
|
|
@@ -1758,13 +1768,10 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1758
1768
|
"""
|
1759
1769
|
...
|
1760
1770
|
|
1761
|
-
def
|
1771
|
+
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]]:
|
1762
1772
|
"""
|
1763
|
-
The `@
|
1764
|
-
|
1765
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1766
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1767
|
-
starts only after all sensors finish.
|
1773
|
+
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.
|
1774
|
+
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.
|
1768
1775
|
|
1769
1776
|
Parameters
|
1770
1777
|
----------
|
@@ -1785,67 +1792,60 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1785
1792
|
Name of the sensor on Airflow
|
1786
1793
|
description : str
|
1787
1794
|
Description of sensor in the Airflow UI
|
1788
|
-
|
1789
|
-
The
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1795
|
+
external_dag_id : str
|
1796
|
+
The dag_id that contains the task you want to wait for.
|
1797
|
+
external_task_ids : List[str]
|
1798
|
+
The list of task_ids that you want to wait for.
|
1799
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1800
|
+
allowed_states : List[str]
|
1801
|
+
Iterable of allowed states, (Default: ['success'])
|
1802
|
+
failed_states : List[str]
|
1803
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1804
|
+
execution_delta : datetime.timedelta
|
1805
|
+
time difference with the previous execution to look at,
|
1806
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1807
|
+
check_existence: bool
|
1808
|
+
Set to True to check if the external task exists or check if
|
1809
|
+
the DAG to wait for exists. (Default: True)
|
1800
1810
|
"""
|
1801
1811
|
...
|
1802
1812
|
|
1803
1813
|
@typing.overload
|
1804
|
-
def
|
1814
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1805
1815
|
"""
|
1806
|
-
Specifies the
|
1807
|
-
|
1808
|
-
Use `@conda_base` to set common libraries required by all
|
1809
|
-
steps and use `@conda` to specify step-specific additions.
|
1816
|
+
Specifies the PyPI packages for all steps of the flow.
|
1810
1817
|
|
1818
|
+
Use `@pypi_base` to set common packages required by all
|
1819
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1811
1820
|
Parameters
|
1812
1821
|
----------
|
1813
|
-
packages : Dict[str, str], default {}
|
1822
|
+
packages : Dict[str, str], default: {}
|
1814
1823
|
Packages to use for this flow. The key is the name of the package
|
1815
1824
|
and the value is the version to use.
|
1816
|
-
|
1817
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1818
|
-
python : str, optional, default None
|
1825
|
+
python : str, optional, default: None
|
1819
1826
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1820
1827
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1821
|
-
disabled : bool, default False
|
1822
|
-
If set to True, disables Conda.
|
1823
1828
|
"""
|
1824
1829
|
...
|
1825
1830
|
|
1826
1831
|
@typing.overload
|
1827
|
-
def
|
1832
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1828
1833
|
...
|
1829
1834
|
|
1830
|
-
def
|
1835
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1831
1836
|
"""
|
1832
|
-
Specifies the
|
1833
|
-
|
1834
|
-
Use `@conda_base` to set common libraries required by all
|
1835
|
-
steps and use `@conda` to specify step-specific additions.
|
1837
|
+
Specifies the PyPI packages for all steps of the flow.
|
1836
1838
|
|
1839
|
+
Use `@pypi_base` to set common packages required by all
|
1840
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1837
1841
|
Parameters
|
1838
1842
|
----------
|
1839
|
-
packages : Dict[str, str], default {}
|
1843
|
+
packages : Dict[str, str], default: {}
|
1840
1844
|
Packages to use for this flow. The key is the name of the package
|
1841
1845
|
and the value is the version to use.
|
1842
|
-
|
1843
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1844
|
-
python : str, optional, default None
|
1846
|
+
python : str, optional, default: None
|
1845
1847
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1846
1848
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1847
|
-
disabled : bool, default False
|
1848
|
-
If set to True, disables Conda.
|
1849
1849
|
"""
|
1850
1850
|
...
|
1851
1851
|
|