ob-metaflow-stubs 3.7__py2.py3-none-any.whl → 3.8__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 +740 -541
- metaflow-stubs/cards.pyi +5 -5
- metaflow-stubs/cli.pyi +45 -20
- metaflow-stubs/client/__init__.pyi +3 -3
- metaflow-stubs/client/core.pyi +7 -7
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/clone_util.pyi +2 -2
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/metadata/metadata.pyi +3 -3
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +4 -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 +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 +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +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 +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 +3 -3
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +4 -4
- metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
- 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_jobsets.pyi +2 -2
- metaflow-stubs/plugins/logs_cli.pyi +4 -4
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/perimeters.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 +3 -3
- 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 +2 -2
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/tag_cli.pyi +5 -5
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/procpoll.pyi +2 -2
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +9 -0
- metaflow-stubs/runner/metaflow_runner.pyi +696 -0
- metaflow-stubs/runner/nbrun.pyi +224 -0
- metaflow-stubs/runner/subprocess_manager.pyi +221 -0
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- {ob_metaflow_stubs-3.7.dist-info → ob_metaflow_stubs-3.8.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-3.8.dist-info/RECORD +142 -0
- ob_metaflow_stubs-3.7.dist-info/RECORD +0 -138
- {ob_metaflow_stubs-3.7.dist-info → ob_metaflow_stubs-3.8.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-3.7.dist-info → ob_metaflow_stubs-3.8.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.
|
4
|
-
# Generated on 2024-05-
|
3
|
+
# MF version: 2.12.0.1+ob(v1) #
|
4
|
+
# Generated on 2024-05-30T17:28:59.704529 #
|
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 metaflow.
|
11
|
+
import metaflow._vendor.click.types
|
12
|
+
import metaflow.parameters
|
13
13
|
import io
|
14
|
+
import metaflow.datastore.inputs
|
15
|
+
import metaflow.runner.metaflow_runner
|
14
16
|
import metaflow.events
|
17
|
+
import metaflow.client.core
|
15
18
|
import datetime
|
16
|
-
import metaflow.parameters
|
17
|
-
import metaflow.datastore.inputs
|
18
19
|
import typing
|
19
20
|
import metaflow.plugins.datatools.s3.s3
|
20
|
-
import metaflow.
|
21
|
+
import metaflow.metaflow_current
|
21
22
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
22
23
|
StepFlag = typing.NewType("StepFlag", bool)
|
23
24
|
|
@@ -725,248 +726,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
725
726
|
"""
|
726
727
|
...
|
727
728
|
|
728
|
-
@typing.overload
|
729
|
-
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]]]:
|
730
|
-
"""
|
731
|
-
Specifies a timeout for your step.
|
732
|
-
|
733
|
-
This decorator is useful if this step may hang indefinitely.
|
734
|
-
|
735
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
736
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
737
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
738
|
-
|
739
|
-
Note that all the values specified in parameters are added together so if you specify
|
740
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
741
|
-
|
742
|
-
Parameters
|
743
|
-
----------
|
744
|
-
seconds : int, default 0
|
745
|
-
Number of seconds to wait prior to timing out.
|
746
|
-
minutes : int, default 0
|
747
|
-
Number of minutes to wait prior to timing out.
|
748
|
-
hours : int, default 0
|
749
|
-
Number of hours to wait prior to timing out.
|
750
|
-
"""
|
751
|
-
...
|
752
|
-
|
753
|
-
@typing.overload
|
754
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
755
|
-
...
|
756
|
-
|
757
|
-
@typing.overload
|
758
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
759
|
-
...
|
760
|
-
|
761
|
-
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):
|
762
|
-
"""
|
763
|
-
Specifies a timeout for your step.
|
764
|
-
|
765
|
-
This decorator is useful if this step may hang indefinitely.
|
766
|
-
|
767
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
768
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
769
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
770
|
-
|
771
|
-
Note that all the values specified in parameters are added together so if you specify
|
772
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
773
|
-
|
774
|
-
Parameters
|
775
|
-
----------
|
776
|
-
seconds : int, default 0
|
777
|
-
Number of seconds to wait prior to timing out.
|
778
|
-
minutes : int, default 0
|
779
|
-
Number of minutes to wait prior to timing out.
|
780
|
-
hours : int, default 0
|
781
|
-
Number of hours to wait prior to timing out.
|
782
|
-
"""
|
783
|
-
...
|
784
|
-
|
785
|
-
@typing.overload
|
786
|
-
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]]]:
|
787
|
-
"""
|
788
|
-
Specifies the resources needed when executing this step.
|
789
|
-
|
790
|
-
Use `@resources` to specify the resource requirements
|
791
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
792
|
-
|
793
|
-
You can choose the compute layer on the command line by executing e.g.
|
794
|
-
```
|
795
|
-
python myflow.py run --with batch
|
796
|
-
```
|
797
|
-
or
|
798
|
-
```
|
799
|
-
python myflow.py run --with kubernetes
|
800
|
-
```
|
801
|
-
which executes the flow on the desired system using the
|
802
|
-
requirements specified in `@resources`.
|
803
|
-
|
804
|
-
Parameters
|
805
|
-
----------
|
806
|
-
cpu : int, default 1
|
807
|
-
Number of CPUs required for this step.
|
808
|
-
gpu : int, default 0
|
809
|
-
Number of GPUs required for this step.
|
810
|
-
disk : int, optional, default None
|
811
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
812
|
-
memory : int, default 4096
|
813
|
-
Memory size (in MB) required for this step.
|
814
|
-
shared_memory : int, optional, default None
|
815
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
816
|
-
This parameter maps to the `--shm-size` option in Docker.
|
817
|
-
"""
|
818
|
-
...
|
819
|
-
|
820
|
-
@typing.overload
|
821
|
-
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
822
|
-
...
|
823
|
-
|
824
|
-
@typing.overload
|
825
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
826
|
-
...
|
827
|
-
|
828
|
-
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):
|
829
|
-
"""
|
830
|
-
Specifies the resources needed when executing this step.
|
831
|
-
|
832
|
-
Use `@resources` to specify the resource requirements
|
833
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
834
|
-
|
835
|
-
You can choose the compute layer on the command line by executing e.g.
|
836
|
-
```
|
837
|
-
python myflow.py run --with batch
|
838
|
-
```
|
839
|
-
or
|
840
|
-
```
|
841
|
-
python myflow.py run --with kubernetes
|
842
|
-
```
|
843
|
-
which executes the flow on the desired system using the
|
844
|
-
requirements specified in `@resources`.
|
845
|
-
|
846
|
-
Parameters
|
847
|
-
----------
|
848
|
-
cpu : int, default 1
|
849
|
-
Number of CPUs required for this step.
|
850
|
-
gpu : int, default 0
|
851
|
-
Number of GPUs required for this step.
|
852
|
-
disk : int, optional, default None
|
853
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
854
|
-
memory : int, default 4096
|
855
|
-
Memory size (in MB) required for this step.
|
856
|
-
shared_memory : int, optional, default None
|
857
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
858
|
-
This parameter maps to the `--shm-size` option in Docker.
|
859
|
-
"""
|
860
|
-
...
|
861
|
-
|
862
|
-
@typing.overload
|
863
|
-
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]]]:
|
864
|
-
"""
|
865
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
866
|
-
|
867
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
868
|
-
|
869
|
-
Parameters
|
870
|
-
----------
|
871
|
-
type : str, default 'default'
|
872
|
-
Card type.
|
873
|
-
id : str, optional, default None
|
874
|
-
If multiple cards are present, use this id to identify this card.
|
875
|
-
options : Dict[str, Any], default {}
|
876
|
-
Options passed to the card. The contents depend on the card type.
|
877
|
-
timeout : int, default 45
|
878
|
-
Interrupt reporting if it takes more than this many seconds.
|
879
|
-
|
880
|
-
|
881
|
-
"""
|
882
|
-
...
|
883
|
-
|
884
|
-
@typing.overload
|
885
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
886
|
-
...
|
887
|
-
|
888
|
-
@typing.overload
|
889
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
890
|
-
...
|
891
|
-
|
892
|
-
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):
|
893
|
-
"""
|
894
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
895
|
-
|
896
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
897
|
-
|
898
|
-
Parameters
|
899
|
-
----------
|
900
|
-
type : str, default 'default'
|
901
|
-
Card type.
|
902
|
-
id : str, optional, default None
|
903
|
-
If multiple cards are present, use this id to identify this card.
|
904
|
-
options : Dict[str, Any], default {}
|
905
|
-
Options passed to the card. The contents depend on the card type.
|
906
|
-
timeout : int, default 45
|
907
|
-
Interrupt reporting if it takes more than this many seconds.
|
908
|
-
|
909
|
-
|
910
|
-
"""
|
911
|
-
...
|
912
|
-
|
913
|
-
@typing.overload
|
914
|
-
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]]]:
|
915
|
-
"""
|
916
|
-
Specifies the Conda environment for the step.
|
917
|
-
|
918
|
-
Information in this decorator will augment any
|
919
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
920
|
-
you can use `@conda_base` to set packages required by all
|
921
|
-
steps and use `@conda` to specify step-specific overrides.
|
922
|
-
|
923
|
-
Parameters
|
924
|
-
----------
|
925
|
-
packages : Dict[str, str], default {}
|
926
|
-
Packages to use for this step. The key is the name of the package
|
927
|
-
and the value is the version to use.
|
928
|
-
libraries : Dict[str, str], default {}
|
929
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
930
|
-
python : str, optional, default None
|
931
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
932
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
933
|
-
disabled : bool, default False
|
934
|
-
If set to True, disables @conda.
|
935
|
-
"""
|
936
|
-
...
|
937
|
-
|
938
|
-
@typing.overload
|
939
|
-
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
940
|
-
...
|
941
|
-
|
942
|
-
@typing.overload
|
943
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
944
|
-
...
|
945
|
-
|
946
|
-
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):
|
947
|
-
"""
|
948
|
-
Specifies the Conda environment for the step.
|
949
|
-
|
950
|
-
Information in this decorator will augment any
|
951
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
952
|
-
you can use `@conda_base` to set packages required by all
|
953
|
-
steps and use `@conda` to specify step-specific overrides.
|
954
|
-
|
955
|
-
Parameters
|
956
|
-
----------
|
957
|
-
packages : Dict[str, str], default {}
|
958
|
-
Packages to use for this step. The key is the name of the package
|
959
|
-
and the value is the version to use.
|
960
|
-
libraries : Dict[str, str], default {}
|
961
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
962
|
-
python : str, optional, default None
|
963
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
964
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
965
|
-
disabled : bool, default False
|
966
|
-
If set to True, disables @conda.
|
967
|
-
"""
|
968
|
-
...
|
969
|
-
|
970
729
|
@typing.overload
|
971
730
|
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]]]:
|
972
731
|
"""
|
@@ -1025,15 +784,15 @@ def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optio
|
|
1025
784
|
Alias for inferentia. Use only one of the two.
|
1026
785
|
efa : int, default 0
|
1027
786
|
Number of elastic fabric adapter network devices to attach to container
|
1028
|
-
ephemeral_storage: int, default None
|
1029
|
-
The total amount, in GiB, of ephemeral storage to set for the task
|
787
|
+
ephemeral_storage : int, default None
|
788
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
1030
789
|
This is only relevant for Fargate compute environments
|
1031
790
|
log_driver: str, optional, default None
|
1032
791
|
The log driver to use for the Amazon ECS container.
|
1033
792
|
log_options: List[str], optional, default None
|
1034
793
|
List of strings containing options for the chosen log driver. The configurable values
|
1035
794
|
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1036
|
-
Example
|
795
|
+
Example: [`awslogs-group:aws/batch/job`]
|
1037
796
|
"""
|
1038
797
|
...
|
1039
798
|
|
@@ -1102,23 +861,267 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1102
861
|
Alias for inferentia. Use only one of the two.
|
1103
862
|
efa : int, default 0
|
1104
863
|
Number of elastic fabric adapter network devices to attach to container
|
1105
|
-
ephemeral_storage: int, default None
|
1106
|
-
The total amount, in GiB, of ephemeral storage to set for the task
|
864
|
+
ephemeral_storage : int, default None
|
865
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
1107
866
|
This is only relevant for Fargate compute environments
|
1108
867
|
log_driver: str, optional, default None
|
1109
868
|
The log driver to use for the Amazon ECS container.
|
1110
869
|
log_options: List[str], optional, default None
|
1111
870
|
List of strings containing options for the chosen log driver. The configurable values
|
1112
871
|
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
1113
|
-
Example
|
872
|
+
Example: [`awslogs-group:aws/batch/job`]
|
1114
873
|
"""
|
1115
874
|
...
|
1116
875
|
|
1117
876
|
@typing.overload
|
1118
|
-
def
|
877
|
+
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]]]:
|
1119
878
|
"""
|
1120
|
-
Specifies
|
1121
|
-
|
879
|
+
Specifies the number of times the task corresponding
|
880
|
+
to a step needs to be retried.
|
881
|
+
|
882
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
883
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
884
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
885
|
+
|
886
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
887
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
888
|
+
ensuring that the flow execution can continue.
|
889
|
+
|
890
|
+
Parameters
|
891
|
+
----------
|
892
|
+
times : int, default 3
|
893
|
+
Number of times to retry this task.
|
894
|
+
minutes_between_retries : int, default 2
|
895
|
+
Number of minutes between retries.
|
896
|
+
"""
|
897
|
+
...
|
898
|
+
|
899
|
+
@typing.overload
|
900
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
901
|
+
...
|
902
|
+
|
903
|
+
@typing.overload
|
904
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
905
|
+
...
|
906
|
+
|
907
|
+
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):
|
908
|
+
"""
|
909
|
+
Specifies the number of times the task corresponding
|
910
|
+
to a step needs to be retried.
|
911
|
+
|
912
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
913
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
914
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
915
|
+
|
916
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
917
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
918
|
+
ensuring that the flow execution can continue.
|
919
|
+
|
920
|
+
Parameters
|
921
|
+
----------
|
922
|
+
times : int, default 3
|
923
|
+
Number of times to retry this task.
|
924
|
+
minutes_between_retries : int, default 2
|
925
|
+
Number of minutes between retries.
|
926
|
+
"""
|
927
|
+
...
|
928
|
+
|
929
|
+
@typing.overload
|
930
|
+
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]]]:
|
931
|
+
"""
|
932
|
+
Specifies a timeout for your step.
|
933
|
+
|
934
|
+
This decorator is useful if this step may hang indefinitely.
|
935
|
+
|
936
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
937
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
938
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
939
|
+
|
940
|
+
Note that all the values specified in parameters are added together so if you specify
|
941
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
942
|
+
|
943
|
+
Parameters
|
944
|
+
----------
|
945
|
+
seconds : int, default 0
|
946
|
+
Number of seconds to wait prior to timing out.
|
947
|
+
minutes : int, default 0
|
948
|
+
Number of minutes to wait prior to timing out.
|
949
|
+
hours : int, default 0
|
950
|
+
Number of hours to wait prior to timing out.
|
951
|
+
"""
|
952
|
+
...
|
953
|
+
|
954
|
+
@typing.overload
|
955
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
956
|
+
...
|
957
|
+
|
958
|
+
@typing.overload
|
959
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
960
|
+
...
|
961
|
+
|
962
|
+
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):
|
963
|
+
"""
|
964
|
+
Specifies a timeout for your step.
|
965
|
+
|
966
|
+
This decorator is useful if this step may hang indefinitely.
|
967
|
+
|
968
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
969
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
970
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
971
|
+
|
972
|
+
Note that all the values specified in parameters are added together so if you specify
|
973
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
974
|
+
|
975
|
+
Parameters
|
976
|
+
----------
|
977
|
+
seconds : int, default 0
|
978
|
+
Number of seconds to wait prior to timing out.
|
979
|
+
minutes : int, default 0
|
980
|
+
Number of minutes to wait prior to timing out.
|
981
|
+
hours : int, default 0
|
982
|
+
Number of hours to wait prior to timing out.
|
983
|
+
"""
|
984
|
+
...
|
985
|
+
|
986
|
+
@typing.overload
|
987
|
+
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]]]:
|
988
|
+
"""
|
989
|
+
Specifies the Conda environment for the step.
|
990
|
+
|
991
|
+
Information in this decorator will augment any
|
992
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
993
|
+
you can use `@conda_base` to set packages required by all
|
994
|
+
steps and use `@conda` to specify step-specific overrides.
|
995
|
+
|
996
|
+
Parameters
|
997
|
+
----------
|
998
|
+
packages : Dict[str, str], default {}
|
999
|
+
Packages to use for this step. The key is the name of the package
|
1000
|
+
and the value is the version to use.
|
1001
|
+
libraries : Dict[str, str], default {}
|
1002
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1003
|
+
python : str, optional, default None
|
1004
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1005
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1006
|
+
disabled : bool, default False
|
1007
|
+
If set to True, disables @conda.
|
1008
|
+
"""
|
1009
|
+
...
|
1010
|
+
|
1011
|
+
@typing.overload
|
1012
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1013
|
+
...
|
1014
|
+
|
1015
|
+
@typing.overload
|
1016
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1017
|
+
...
|
1018
|
+
|
1019
|
+
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):
|
1020
|
+
"""
|
1021
|
+
Specifies the Conda environment for the step.
|
1022
|
+
|
1023
|
+
Information in this decorator will augment any
|
1024
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
1025
|
+
you can use `@conda_base` to set packages required by all
|
1026
|
+
steps and use `@conda` to specify step-specific overrides.
|
1027
|
+
|
1028
|
+
Parameters
|
1029
|
+
----------
|
1030
|
+
packages : Dict[str, str], default {}
|
1031
|
+
Packages to use for this step. The key is the name of the package
|
1032
|
+
and the value is the version to use.
|
1033
|
+
libraries : Dict[str, str], default {}
|
1034
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1035
|
+
python : str, optional, default None
|
1036
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1037
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1038
|
+
disabled : bool, default False
|
1039
|
+
If set to True, disables @conda.
|
1040
|
+
"""
|
1041
|
+
...
|
1042
|
+
|
1043
|
+
@typing.overload
|
1044
|
+
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]]]:
|
1045
|
+
"""
|
1046
|
+
Specifies the resources needed when executing this step.
|
1047
|
+
|
1048
|
+
Use `@resources` to specify the resource requirements
|
1049
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1050
|
+
|
1051
|
+
You can choose the compute layer on the command line by executing e.g.
|
1052
|
+
```
|
1053
|
+
python myflow.py run --with batch
|
1054
|
+
```
|
1055
|
+
or
|
1056
|
+
```
|
1057
|
+
python myflow.py run --with kubernetes
|
1058
|
+
```
|
1059
|
+
which executes the flow on the desired system using the
|
1060
|
+
requirements specified in `@resources`.
|
1061
|
+
|
1062
|
+
Parameters
|
1063
|
+
----------
|
1064
|
+
cpu : int, default 1
|
1065
|
+
Number of CPUs required for this step.
|
1066
|
+
gpu : int, default 0
|
1067
|
+
Number of GPUs required for this step.
|
1068
|
+
disk : int, optional, default None
|
1069
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1070
|
+
memory : int, default 4096
|
1071
|
+
Memory size (in MB) required for this step.
|
1072
|
+
shared_memory : int, optional, default None
|
1073
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1074
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1075
|
+
"""
|
1076
|
+
...
|
1077
|
+
|
1078
|
+
@typing.overload
|
1079
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1080
|
+
...
|
1081
|
+
|
1082
|
+
@typing.overload
|
1083
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1084
|
+
...
|
1085
|
+
|
1086
|
+
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):
|
1087
|
+
"""
|
1088
|
+
Specifies the resources needed when executing this step.
|
1089
|
+
|
1090
|
+
Use `@resources` to specify the resource requirements
|
1091
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1092
|
+
|
1093
|
+
You can choose the compute layer on the command line by executing e.g.
|
1094
|
+
```
|
1095
|
+
python myflow.py run --with batch
|
1096
|
+
```
|
1097
|
+
or
|
1098
|
+
```
|
1099
|
+
python myflow.py run --with kubernetes
|
1100
|
+
```
|
1101
|
+
which executes the flow on the desired system using the
|
1102
|
+
requirements specified in `@resources`.
|
1103
|
+
|
1104
|
+
Parameters
|
1105
|
+
----------
|
1106
|
+
cpu : int, default 1
|
1107
|
+
Number of CPUs required for this step.
|
1108
|
+
gpu : int, default 0
|
1109
|
+
Number of GPUs required for this step.
|
1110
|
+
disk : int, optional, default None
|
1111
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1112
|
+
memory : int, default 4096
|
1113
|
+
Memory size (in MB) required for this step.
|
1114
|
+
shared_memory : int, optional, default None
|
1115
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1116
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1117
|
+
"""
|
1118
|
+
...
|
1119
|
+
|
1120
|
+
@typing.overload
|
1121
|
+
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]]]:
|
1122
|
+
"""
|
1123
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1124
|
+
the execution of a step.
|
1122
1125
|
|
1123
1126
|
Parameters
|
1124
1127
|
----------
|
@@ -1148,33 +1151,51 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
1148
1151
|
...
|
1149
1152
|
|
1150
1153
|
@typing.overload
|
1151
|
-
def
|
1154
|
+
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]]]:
|
1152
1155
|
"""
|
1153
|
-
Specifies
|
1156
|
+
Specifies that the step will success under all circumstances.
|
1157
|
+
|
1158
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1159
|
+
contains the exception raised. You can use it to detect the presence
|
1160
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1161
|
+
are missing.
|
1154
1162
|
|
1155
1163
|
Parameters
|
1156
1164
|
----------
|
1157
|
-
|
1158
|
-
|
1165
|
+
var : str, optional, default None
|
1166
|
+
Name of the artifact in which to store the caught exception.
|
1167
|
+
If not specified, the exception is not stored.
|
1168
|
+
print_exception : bool, default True
|
1169
|
+
Determines whether or not the exception is printed to
|
1170
|
+
stdout when caught.
|
1159
1171
|
"""
|
1160
1172
|
...
|
1161
1173
|
|
1162
1174
|
@typing.overload
|
1163
|
-
def
|
1175
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1164
1176
|
...
|
1165
1177
|
|
1166
1178
|
@typing.overload
|
1167
|
-
def
|
1179
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1168
1180
|
...
|
1169
1181
|
|
1170
|
-
def
|
1182
|
+
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):
|
1171
1183
|
"""
|
1172
|
-
Specifies
|
1184
|
+
Specifies that the step will success under all circumstances.
|
1185
|
+
|
1186
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1187
|
+
contains the exception raised. You can use it to detect the presence
|
1188
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1189
|
+
are missing.
|
1173
1190
|
|
1174
1191
|
Parameters
|
1175
1192
|
----------
|
1176
|
-
|
1177
|
-
|
1193
|
+
var : str, optional, default None
|
1194
|
+
Name of the artifact in which to store the caught exception.
|
1195
|
+
If not specified, the exception is not stored.
|
1196
|
+
print_exception : bool, default True
|
1197
|
+
Determines whether or not the exception is printed to
|
1198
|
+
stdout when caught.
|
1178
1199
|
"""
|
1179
1200
|
...
|
1180
1201
|
|
@@ -1237,6 +1258,57 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
1237
1258
|
"""
|
1238
1259
|
...
|
1239
1260
|
|
1261
|
+
@typing.overload
|
1262
|
+
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]]]:
|
1263
|
+
"""
|
1264
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1265
|
+
|
1266
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1267
|
+
|
1268
|
+
Parameters
|
1269
|
+
----------
|
1270
|
+
type : str, default 'default'
|
1271
|
+
Card type.
|
1272
|
+
id : str, optional, default None
|
1273
|
+
If multiple cards are present, use this id to identify this card.
|
1274
|
+
options : Dict[str, Any], default {}
|
1275
|
+
Options passed to the card. The contents depend on the card type.
|
1276
|
+
timeout : int, default 45
|
1277
|
+
Interrupt reporting if it takes more than this many seconds.
|
1278
|
+
|
1279
|
+
|
1280
|
+
"""
|
1281
|
+
...
|
1282
|
+
|
1283
|
+
@typing.overload
|
1284
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1285
|
+
...
|
1286
|
+
|
1287
|
+
@typing.overload
|
1288
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1289
|
+
...
|
1290
|
+
|
1291
|
+
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):
|
1292
|
+
"""
|
1293
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1294
|
+
|
1295
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1296
|
+
|
1297
|
+
Parameters
|
1298
|
+
----------
|
1299
|
+
type : str, default 'default'
|
1300
|
+
Card type.
|
1301
|
+
id : str, optional, default None
|
1302
|
+
If multiple cards are present, use this id to identify this card.
|
1303
|
+
options : Dict[str, Any], default {}
|
1304
|
+
Options passed to the card. The contents depend on the card type.
|
1305
|
+
timeout : int, default 45
|
1306
|
+
Interrupt reporting if it takes more than this many seconds.
|
1307
|
+
|
1308
|
+
|
1309
|
+
"""
|
1310
|
+
...
|
1311
|
+
|
1240
1312
|
@typing.overload
|
1241
1313
|
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]]]:
|
1242
1314
|
"""
|
@@ -1287,104 +1359,51 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
1287
1359
|
...
|
1288
1360
|
|
1289
1361
|
@typing.overload
|
1290
|
-
def
|
1291
|
-
"""
|
1292
|
-
Specifies that the step will success under all circumstances.
|
1293
|
-
|
1294
|
-
The decorator will create an optional artifact, specified by `var`, which
|
1295
|
-
contains the exception raised. You can use it to detect the presence
|
1296
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1297
|
-
are missing.
|
1298
|
-
|
1299
|
-
Parameters
|
1300
|
-
----------
|
1301
|
-
var : str, optional, default None
|
1302
|
-
Name of the artifact in which to store the caught exception.
|
1303
|
-
If not specified, the exception is not stored.
|
1304
|
-
print_exception : bool, default True
|
1305
|
-
Determines whether or not the exception is printed to
|
1306
|
-
stdout when caught.
|
1307
|
-
"""
|
1308
|
-
...
|
1309
|
-
|
1310
|
-
@typing.overload
|
1311
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1312
|
-
...
|
1313
|
-
|
1314
|
-
@typing.overload
|
1315
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1316
|
-
...
|
1317
|
-
|
1318
|
-
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):
|
1319
|
-
"""
|
1320
|
-
Specifies that the step will success under all circumstances.
|
1321
|
-
|
1322
|
-
The decorator will create an optional artifact, specified by `var`, which
|
1323
|
-
contains the exception raised. You can use it to detect the presence
|
1324
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1325
|
-
are missing.
|
1326
|
-
|
1327
|
-
Parameters
|
1328
|
-
----------
|
1329
|
-
var : str, optional, default None
|
1330
|
-
Name of the artifact in which to store the caught exception.
|
1331
|
-
If not specified, the exception is not stored.
|
1332
|
-
print_exception : bool, default True
|
1333
|
-
Determines whether or not the exception is printed to
|
1334
|
-
stdout when caught.
|
1335
|
-
"""
|
1336
|
-
...
|
1337
|
-
|
1338
|
-
@typing.overload
|
1339
|
-
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]]]:
|
1362
|
+
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]]]:
|
1340
1363
|
"""
|
1341
|
-
Specifies
|
1342
|
-
to a step needs to be retried.
|
1343
|
-
|
1344
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1345
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1346
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1347
|
-
|
1348
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
1349
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
1350
|
-
ensuring that the flow execution can continue.
|
1364
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1351
1365
|
|
1352
1366
|
Parameters
|
1353
1367
|
----------
|
1354
|
-
|
1355
|
-
|
1356
|
-
minutes_between_retries : int, default 2
|
1357
|
-
Number of minutes between retries.
|
1368
|
+
vars : Dict[str, str], default {}
|
1369
|
+
Dictionary of environment variables to set.
|
1358
1370
|
"""
|
1359
1371
|
...
|
1360
1372
|
|
1361
1373
|
@typing.overload
|
1362
|
-
def
|
1374
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1363
1375
|
...
|
1364
1376
|
|
1365
1377
|
@typing.overload
|
1366
|
-
def
|
1378
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1367
1379
|
...
|
1368
1380
|
|
1369
|
-
def
|
1381
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1370
1382
|
"""
|
1371
|
-
Specifies
|
1372
|
-
to a step needs to be retried.
|
1383
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1373
1384
|
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1385
|
+
Parameters
|
1386
|
+
----------
|
1387
|
+
vars : Dict[str, str], default {}
|
1388
|
+
Dictionary of environment variables to set.
|
1389
|
+
"""
|
1390
|
+
...
|
1391
|
+
|
1392
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1393
|
+
"""
|
1394
|
+
Specifies what flows belong to the same project.
|
1377
1395
|
|
1378
|
-
|
1379
|
-
|
1380
|
-
ensuring that the flow execution can continue.
|
1396
|
+
A project-specific namespace is created for all flows that
|
1397
|
+
use the same `@project(name)`.
|
1381
1398
|
|
1382
1399
|
Parameters
|
1383
1400
|
----------
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1401
|
+
name : str
|
1402
|
+
Project name. Make sure that the name is unique amongst all
|
1403
|
+
projects that use the same production scheduler. The name may
|
1404
|
+
contain only lowercase alphanumeric characters and underscores.
|
1405
|
+
|
1406
|
+
|
1388
1407
|
"""
|
1389
1408
|
...
|
1390
1409
|
|
@@ -1437,91 +1456,45 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1437
1456
|
"""
|
1438
1457
|
...
|
1439
1458
|
|
1440
|
-
|
1441
|
-
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]]:
|
1442
|
-
"""
|
1443
|
-
Specifies the Conda environment for all steps of the flow.
|
1444
|
-
|
1445
|
-
Use `@conda_base` to set common libraries required by all
|
1446
|
-
steps and use `@conda` to specify step-specific additions.
|
1447
|
-
|
1448
|
-
Parameters
|
1449
|
-
----------
|
1450
|
-
packages : Dict[str, str], default {}
|
1451
|
-
Packages to use for this flow. The key is the name of the package
|
1452
|
-
and the value is the version to use.
|
1453
|
-
libraries : Dict[str, str], default {}
|
1454
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1455
|
-
python : str, optional, default None
|
1456
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1457
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1458
|
-
disabled : bool, default False
|
1459
|
-
If set to True, disables Conda.
|
1460
|
-
"""
|
1461
|
-
...
|
1462
|
-
|
1463
|
-
@typing.overload
|
1464
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1465
|
-
...
|
1466
|
-
|
1467
|
-
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):
|
1468
|
-
"""
|
1469
|
-
Specifies the Conda environment for all steps of the flow.
|
1470
|
-
|
1471
|
-
Use `@conda_base` to set common libraries required by all
|
1472
|
-
steps and use `@conda` to specify step-specific additions.
|
1473
|
-
|
1474
|
-
Parameters
|
1475
|
-
----------
|
1476
|
-
packages : Dict[str, str], default {}
|
1477
|
-
Packages to use for this flow. The key is the name of the package
|
1478
|
-
and the value is the version to use.
|
1479
|
-
libraries : Dict[str, str], default {}
|
1480
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1481
|
-
python : str, optional, default None
|
1482
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1483
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1484
|
-
disabled : bool, default False
|
1485
|
-
If set to True, disables Conda.
|
1486
|
-
"""
|
1487
|
-
...
|
1488
|
-
|
1489
|
-
@typing.overload
|
1490
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1491
|
-
"""
|
1492
|
-
Specifies the PyPI packages for all steps of the flow.
|
1493
|
-
|
1494
|
-
Use `@pypi_base` to set common packages required by all
|
1495
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1496
|
-
Parameters
|
1497
|
-
----------
|
1498
|
-
packages : Dict[str, str], default: {}
|
1499
|
-
Packages to use for this flow. The key is the name of the package
|
1500
|
-
and the value is the version to use.
|
1501
|
-
python : str, optional, default: None
|
1502
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1503
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1504
|
-
"""
|
1505
|
-
...
|
1506
|
-
|
1507
|
-
@typing.overload
|
1508
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1509
|
-
...
|
1510
|
-
|
1511
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1459
|
+
def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1512
1460
|
"""
|
1513
|
-
|
1461
|
+
The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
|
1462
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1463
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1464
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1465
|
+
starts only after all sensors finish.
|
1514
1466
|
|
1515
|
-
Use `@pypi_base` to set common packages required by all
|
1516
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1517
1467
|
Parameters
|
1518
1468
|
----------
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1469
|
+
timeout : int
|
1470
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1471
|
+
poke_interval : int
|
1472
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1473
|
+
mode : str
|
1474
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1475
|
+
exponential_backoff : bool
|
1476
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1477
|
+
pool : str
|
1478
|
+
the slot pool this task should run in,
|
1479
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1480
|
+
soft_fail : bool
|
1481
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1482
|
+
name : str
|
1483
|
+
Name of the sensor on Airflow
|
1484
|
+
description : str
|
1485
|
+
Description of sensor in the Airflow UI
|
1486
|
+
bucket_key : Union[str, List[str]]
|
1487
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1488
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1489
|
+
bucket_name : str
|
1490
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1491
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1492
|
+
wildcard_match : bool
|
1493
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1494
|
+
aws_conn_id : str
|
1495
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1496
|
+
verify : bool
|
1497
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1525
1498
|
"""
|
1526
1499
|
...
|
1527
1500
|
|
@@ -1598,127 +1571,64 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1598
1571
|
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1599
1572
|
```
|
1600
1573
|
|
1601
|
-
'parameters' can also be a list of strings and tuples like so:
|
1602
|
-
```
|
1603
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1604
|
-
```
|
1605
|
-
This is equivalent to:
|
1606
|
-
```
|
1607
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1608
|
-
```
|
1609
|
-
|
1610
|
-
Parameters
|
1611
|
-
----------
|
1612
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1613
|
-
Event dependency for this flow.
|
1614
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1615
|
-
Events dependency for this flow.
|
1616
|
-
options : Dict[str, Any], default {}
|
1617
|
-
Backend-specific configuration for tuning eventing behavior.
|
1618
|
-
|
1619
|
-
|
1620
|
-
"""
|
1621
|
-
...
|
1622
|
-
|
1623
|
-
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]]:
|
1624
|
-
"""
|
1625
|
-
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)
|
1626
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1627
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1628
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1629
|
-
starts only after all sensors finish.
|
1630
|
-
|
1631
|
-
Parameters
|
1632
|
-
----------
|
1633
|
-
timeout : int
|
1634
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1635
|
-
poke_interval : int
|
1636
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1637
|
-
mode : str
|
1638
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1639
|
-
exponential_backoff : bool
|
1640
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1641
|
-
pool : str
|
1642
|
-
the slot pool this task should run in,
|
1643
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1644
|
-
soft_fail : bool
|
1645
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1646
|
-
name : str
|
1647
|
-
Name of the sensor on Airflow
|
1648
|
-
description : str
|
1649
|
-
Description of sensor in the Airflow UI
|
1650
|
-
bucket_key : Union[str, List[str]]
|
1651
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1652
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1653
|
-
bucket_name : str
|
1654
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1655
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1656
|
-
wildcard_match : bool
|
1657
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1658
|
-
aws_conn_id : str
|
1659
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1660
|
-
verify : bool
|
1661
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1662
|
-
"""
|
1663
|
-
...
|
1664
|
-
|
1665
|
-
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]]:
|
1666
|
-
"""
|
1667
|
-
The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
|
1668
|
-
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1669
|
-
|
1670
|
-
Parameters
|
1671
|
-
----------
|
1672
|
-
timeout : int
|
1673
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1674
|
-
poke_interval : int
|
1675
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1676
|
-
mode : str
|
1677
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1678
|
-
exponential_backoff : bool
|
1679
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1680
|
-
pool : str
|
1681
|
-
the slot pool this task should run in,
|
1682
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1683
|
-
soft_fail : bool
|
1684
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1685
|
-
name : str
|
1686
|
-
Name of the sensor on Airflow
|
1687
|
-
description : str
|
1688
|
-
Description of sensor in the Airflow UI
|
1689
|
-
external_dag_id : str
|
1690
|
-
The dag_id that contains the task you want to wait for.
|
1691
|
-
external_task_ids : List[str]
|
1692
|
-
The list of task_ids that you want to wait for.
|
1693
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1694
|
-
allowed_states : List[str]
|
1695
|
-
Iterable of allowed states, (Default: ['success'])
|
1696
|
-
failed_states : List[str]
|
1697
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1698
|
-
execution_delta : datetime.timedelta
|
1699
|
-
time difference with the previous execution to look at,
|
1700
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1701
|
-
check_existence: bool
|
1702
|
-
Set to True to check if the external task exists or check if
|
1703
|
-
the DAG to wait for exists. (Default: True)
|
1574
|
+
'parameters' can also be a list of strings and tuples like so:
|
1575
|
+
```
|
1576
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1577
|
+
```
|
1578
|
+
This is equivalent to:
|
1579
|
+
```
|
1580
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1581
|
+
```
|
1582
|
+
|
1583
|
+
Parameters
|
1584
|
+
----------
|
1585
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1586
|
+
Event dependency for this flow.
|
1587
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1588
|
+
Events dependency for this flow.
|
1589
|
+
options : Dict[str, Any], default {}
|
1590
|
+
Backend-specific configuration for tuning eventing behavior.
|
1591
|
+
|
1592
|
+
|
1704
1593
|
"""
|
1705
1594
|
...
|
1706
1595
|
|
1707
|
-
|
1596
|
+
@typing.overload
|
1597
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1708
1598
|
"""
|
1709
|
-
Specifies
|
1710
|
-
|
1711
|
-
A project-specific namespace is created for all flows that
|
1712
|
-
use the same `@project(name)`.
|
1599
|
+
Specifies the PyPI packages for all steps of the flow.
|
1713
1600
|
|
1601
|
+
Use `@pypi_base` to set common packages required by all
|
1602
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1714
1603
|
Parameters
|
1715
1604
|
----------
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1605
|
+
packages : Dict[str, str], default: {}
|
1606
|
+
Packages to use for this flow. The key is the name of the package
|
1607
|
+
and the value is the version to use.
|
1608
|
+
python : str, optional, default: None
|
1609
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1610
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1611
|
+
"""
|
1612
|
+
...
|
1613
|
+
|
1614
|
+
@typing.overload
|
1615
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1616
|
+
...
|
1617
|
+
|
1618
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1619
|
+
"""
|
1620
|
+
Specifies the PyPI packages for all steps of the flow.
|
1721
1621
|
|
1622
|
+
Use `@pypi_base` to set common packages required by all
|
1623
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1624
|
+
Parameters
|
1625
|
+
----------
|
1626
|
+
packages : Dict[str, str], default: {}
|
1627
|
+
Packages to use for this flow. The key is the name of the package
|
1628
|
+
and the value is the version to use.
|
1629
|
+
python : str, optional, default: None
|
1630
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1631
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1722
1632
|
"""
|
1723
1633
|
...
|
1724
1634
|
|
@@ -1825,6 +1735,97 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1825
1735
|
"""
|
1826
1736
|
...
|
1827
1737
|
|
1738
|
+
@typing.overload
|
1739
|
+
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]]:
|
1740
|
+
"""
|
1741
|
+
Specifies the Conda environment for all steps of the flow.
|
1742
|
+
|
1743
|
+
Use `@conda_base` to set common libraries required by all
|
1744
|
+
steps and use `@conda` to specify step-specific additions.
|
1745
|
+
|
1746
|
+
Parameters
|
1747
|
+
----------
|
1748
|
+
packages : Dict[str, str], default {}
|
1749
|
+
Packages to use for this flow. The key is the name of the package
|
1750
|
+
and the value is the version to use.
|
1751
|
+
libraries : Dict[str, str], default {}
|
1752
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1753
|
+
python : str, optional, default None
|
1754
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1755
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1756
|
+
disabled : bool, default False
|
1757
|
+
If set to True, disables Conda.
|
1758
|
+
"""
|
1759
|
+
...
|
1760
|
+
|
1761
|
+
@typing.overload
|
1762
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1763
|
+
...
|
1764
|
+
|
1765
|
+
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):
|
1766
|
+
"""
|
1767
|
+
Specifies the Conda environment for all steps of the flow.
|
1768
|
+
|
1769
|
+
Use `@conda_base` to set common libraries required by all
|
1770
|
+
steps and use `@conda` to specify step-specific additions.
|
1771
|
+
|
1772
|
+
Parameters
|
1773
|
+
----------
|
1774
|
+
packages : Dict[str, str], default {}
|
1775
|
+
Packages to use for this flow. The key is the name of the package
|
1776
|
+
and the value is the version to use.
|
1777
|
+
libraries : Dict[str, str], default {}
|
1778
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1779
|
+
python : str, optional, default None
|
1780
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1781
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1782
|
+
disabled : bool, default False
|
1783
|
+
If set to True, disables Conda.
|
1784
|
+
"""
|
1785
|
+
...
|
1786
|
+
|
1787
|
+
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]]:
|
1788
|
+
"""
|
1789
|
+
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.
|
1790
|
+
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.
|
1791
|
+
|
1792
|
+
Parameters
|
1793
|
+
----------
|
1794
|
+
timeout : int
|
1795
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1796
|
+
poke_interval : int
|
1797
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1798
|
+
mode : str
|
1799
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1800
|
+
exponential_backoff : bool
|
1801
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1802
|
+
pool : str
|
1803
|
+
the slot pool this task should run in,
|
1804
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1805
|
+
soft_fail : bool
|
1806
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1807
|
+
name : str
|
1808
|
+
Name of the sensor on Airflow
|
1809
|
+
description : str
|
1810
|
+
Description of sensor in the Airflow UI
|
1811
|
+
external_dag_id : str
|
1812
|
+
The dag_id that contains the task you want to wait for.
|
1813
|
+
external_task_ids : List[str]
|
1814
|
+
The list of task_ids that you want to wait for.
|
1815
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1816
|
+
allowed_states : List[str]
|
1817
|
+
Iterable of allowed states, (Default: ['success'])
|
1818
|
+
failed_states : List[str]
|
1819
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1820
|
+
execution_delta : datetime.timedelta
|
1821
|
+
time difference with the previous execution to look at,
|
1822
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1823
|
+
check_existence: bool
|
1824
|
+
Set to True to check if the external task exists or check if
|
1825
|
+
the DAG to wait for exists. (Default: True)
|
1826
|
+
"""
|
1827
|
+
...
|
1828
|
+
|
1828
1829
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1829
1830
|
"""
|
1830
1831
|
Switch namespace to the one provided.
|
@@ -2775,6 +2776,204 @@ class DataArtifact(metaflow.client.core.MetaflowObject, metaclass=type):
|
|
2775
2776
|
...
|
2776
2777
|
...
|
2777
2778
|
|
2779
|
+
class Runner(object, metaclass=type):
|
2780
|
+
def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, **kwargs):
|
2781
|
+
...
|
2782
|
+
def __enter__(self) -> metaflow.runner.metaflow_runner.Runner:
|
2783
|
+
...
|
2784
|
+
def __aenter__(self) -> metaflow.runner.metaflow_runner.Runner:
|
2785
|
+
...
|
2786
|
+
def _Runner__get_executing_run(self, tfp_runner_attribute, command_obj):
|
2787
|
+
...
|
2788
|
+
def run(self, **kwargs) -> metaflow.runner.metaflow_runner.ExecutingRun:
|
2789
|
+
"""
|
2790
|
+
Blocking execution of the run. This method will wait until
|
2791
|
+
the run has completed execution.
|
2792
|
+
|
2793
|
+
Parameters
|
2794
|
+
----------
|
2795
|
+
**kwargs : Any
|
2796
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2797
|
+
the `run` command, in particular, any parameters accepted by the flow.
|
2798
|
+
|
2799
|
+
Returns
|
2800
|
+
-------
|
2801
|
+
ExecutingRun
|
2802
|
+
ExecutingRun containing the results of the run.
|
2803
|
+
"""
|
2804
|
+
...
|
2805
|
+
def resume(self, **kwargs):
|
2806
|
+
"""
|
2807
|
+
Blocking resume execution of the run.
|
2808
|
+
This method will wait until the resumed run has completed execution.
|
2809
|
+
|
2810
|
+
Parameters
|
2811
|
+
----------
|
2812
|
+
**kwargs : Any
|
2813
|
+
Additional arguments that you would pass to `python ./myflow.py` after
|
2814
|
+
the `resume` command.
|
2815
|
+
|
2816
|
+
Returns
|
2817
|
+
-------
|
2818
|
+
ExecutingRun
|
2819
|
+
ExecutingRun containing the results of the resumed run.
|
2820
|
+
"""
|
2821
|
+
...
|
2822
|
+
def async_run(self, **kwargs) -> metaflow.runner.metaflow_runner.ExecutingRun:
|
2823
|
+
"""
|
2824
|
+
Non-blocking execution of the run. This method will return as soon as the
|
2825
|
+
run has launched.
|
2826
|
+
|
2827
|
+
Note that this method is asynchronous and needs to be `await`ed.
|
2828
|
+
|
2829
|
+
Parameters
|
2830
|
+
----------
|
2831
|
+
**kwargs : Any
|
2832
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2833
|
+
the `run` command, in particular, any parameters accepted by the flow.
|
2834
|
+
|
2835
|
+
Returns
|
2836
|
+
-------
|
2837
|
+
ExecutingRun
|
2838
|
+
ExecutingRun representing the run that was started.
|
2839
|
+
"""
|
2840
|
+
...
|
2841
|
+
def async_resume(self, **kwargs):
|
2842
|
+
"""
|
2843
|
+
Non-blocking resume execution of the run.
|
2844
|
+
This method will return as soon as the resume has launched.
|
2845
|
+
|
2846
|
+
Note that this method is asynchronous and needs to be `await`ed.
|
2847
|
+
|
2848
|
+
Parameters
|
2849
|
+
----------
|
2850
|
+
**kwargs : Any
|
2851
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2852
|
+
the `resume` command.
|
2853
|
+
|
2854
|
+
Returns
|
2855
|
+
-------
|
2856
|
+
ExecutingRun
|
2857
|
+
ExecutingRun representing the resumed run that was started.
|
2858
|
+
"""
|
2859
|
+
...
|
2860
|
+
def __exit__(self, exc_type, exc_value, traceback):
|
2861
|
+
...
|
2862
|
+
def __aexit__(self, exc_type, exc_value, traceback):
|
2863
|
+
...
|
2864
|
+
def cleanup(self):
|
2865
|
+
"""
|
2866
|
+
Delete any temporary files created during execution.
|
2867
|
+
"""
|
2868
|
+
...
|
2869
|
+
...
|
2870
|
+
|
2871
|
+
class NBRunner(object, metaclass=type):
|
2872
|
+
def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str = "/tmp", **kwargs):
|
2873
|
+
...
|
2874
|
+
def nbrun(self, **kwargs):
|
2875
|
+
"""
|
2876
|
+
Blocking execution of the run. This method will wait until
|
2877
|
+
the run has completed execution.
|
2878
|
+
|
2879
|
+
Note that in contrast to `run`, this method returns a
|
2880
|
+
`metaflow.Run` object directly and calls `cleanup()` internally
|
2881
|
+
to support a common notebook pattern of executing a flow and
|
2882
|
+
retrieving its results immediately.
|
2883
|
+
|
2884
|
+
Parameters
|
2885
|
+
----------
|
2886
|
+
**kwargs : Any
|
2887
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2888
|
+
the `run` command, in particular, any parameters accepted by the flow.
|
2889
|
+
|
2890
|
+
Returns
|
2891
|
+
-------
|
2892
|
+
Run
|
2893
|
+
A `metaflow.Run` object representing the finished run.
|
2894
|
+
"""
|
2895
|
+
...
|
2896
|
+
def nbresume(self, **kwargs):
|
2897
|
+
"""
|
2898
|
+
Blocking resuming of a run. This method will wait until
|
2899
|
+
the resumed run has completed execution.
|
2900
|
+
|
2901
|
+
Note that in contrast to `resume`, this method returns a
|
2902
|
+
`metaflow.Run` object directly and calls `cleanup()` internally
|
2903
|
+
to support a common notebook pattern of executing a flow and
|
2904
|
+
retrieving its results immediately.
|
2905
|
+
|
2906
|
+
Parameters
|
2907
|
+
----------
|
2908
|
+
**kwargs : Any
|
2909
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2910
|
+
the `resume` command.
|
2911
|
+
|
2912
|
+
Returns
|
2913
|
+
-------
|
2914
|
+
Run
|
2915
|
+
A `metaflow.Run` object representing the resumed run.
|
2916
|
+
"""
|
2917
|
+
...
|
2918
|
+
def run(self, **kwargs):
|
2919
|
+
"""
|
2920
|
+
Runs the flow.
|
2921
|
+
"""
|
2922
|
+
...
|
2923
|
+
def resume(self, **kwargs):
|
2924
|
+
"""
|
2925
|
+
Resumes the flow.
|
2926
|
+
"""
|
2927
|
+
...
|
2928
|
+
def async_run(self, **kwargs):
|
2929
|
+
"""
|
2930
|
+
Non-blocking execution of the run. This method will return as soon as the
|
2931
|
+
run has launched. This method is equivalent to `Runner.async_run`.
|
2932
|
+
|
2933
|
+
Note that this method is asynchronous and needs to be `await`ed.
|
2934
|
+
|
2935
|
+
|
2936
|
+
Parameters
|
2937
|
+
----------
|
2938
|
+
**kwargs : Any
|
2939
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2940
|
+
the `run` command, in particular, any parameters accepted by the flow.
|
2941
|
+
|
2942
|
+
Returns
|
2943
|
+
-------
|
2944
|
+
ExecutingRun
|
2945
|
+
ExecutingRun representing the run that was started.
|
2946
|
+
"""
|
2947
|
+
...
|
2948
|
+
def async_resume(self, **kwargs):
|
2949
|
+
"""
|
2950
|
+
Non-blocking execution of the run. This method will return as soon as the
|
2951
|
+
run has launched. This method is equivalent to `Runner.async_resume`.
|
2952
|
+
|
2953
|
+
Note that this method is asynchronous and needs to be `await`ed.
|
2954
|
+
|
2955
|
+
Parameters
|
2956
|
+
----------
|
2957
|
+
**kwargs : Any
|
2958
|
+
Additional arguments that you would pass to `python myflow.py` after
|
2959
|
+
the `run` command, in particular, any parameters accepted by the flow.
|
2960
|
+
|
2961
|
+
Returns
|
2962
|
+
-------
|
2963
|
+
ExecutingRun
|
2964
|
+
ExecutingRun representing the run that was started.
|
2965
|
+
"""
|
2966
|
+
...
|
2967
|
+
def cleanup(self):
|
2968
|
+
"""
|
2969
|
+
Delete any temporary files created during execution.
|
2970
|
+
|
2971
|
+
Call this method after using `async_run` or `async_resume`. You don't
|
2972
|
+
have to call this after `nbrun` or `nbresume`.
|
2973
|
+
"""
|
2974
|
+
...
|
2975
|
+
...
|
2976
|
+
|
2778
2977
|
def get_aws_client(module, with_error = False, role_arn = None, session_vars = None, client_params = None):
|
2779
2978
|
...
|
2780
2979
|
|