ob-metaflow-stubs 2.11.8.1__py2.py3-none-any.whl → 2.11.9.1__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.
Files changed (133) hide show
  1. metaflow-stubs/__init__.pyi +544 -544
  2. metaflow-stubs/cards.pyi +5 -5
  3. metaflow-stubs/cli.pyi +3 -3
  4. metaflow-stubs/client/__init__.pyi +3 -3
  5. metaflow-stubs/client/core.pyi +7 -7
  6. metaflow-stubs/client/filecache.pyi +3 -3
  7. metaflow-stubs/clone_util.pyi +2 -2
  8. metaflow-stubs/events.pyi +2 -2
  9. metaflow-stubs/exception.pyi +2 -2
  10. metaflow-stubs/flowspec.pyi +5 -5
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +5 -5
  13. metaflow-stubs/metadata/metadata.pyi +3 -3
  14. metaflow-stubs/metadata/util.pyi +2 -2
  15. metaflow-stubs/metaflow_config.pyi +2 -2
  16. metaflow-stubs/metaflow_current.pyi +17 -17
  17. metaflow-stubs/mflog/mflog.pyi +2 -2
  18. metaflow-stubs/multicore_utils.pyi +2 -2
  19. metaflow-stubs/parameters.pyi +3 -3
  20. metaflow-stubs/plugins/__init__.pyi +3 -3
  21. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  22. metaflow-stubs/plugins/airflow/airflow.pyi +3 -3
  23. metaflow-stubs/plugins/airflow/airflow_cli.pyi +3 -3
  24. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  29. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
  30. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
  31. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  32. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  33. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  34. metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
  35. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +4 -4
  36. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  37. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  38. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  39. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  40. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  41. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/batch_cli.pyi +2 -2
  43. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  44. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
  45. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  46. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  47. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  48. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  52. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  53. metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +4 -4
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  55. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  56. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  57. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  58. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  60. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  61. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  62. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  63. metaflow-stubs/plugins/cards/card_cli.pyi +5 -5
  64. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  65. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  67. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  69. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  70. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  71. metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
  73. metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
  74. metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  77. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  78. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  79. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  80. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  81. metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
  82. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  83. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  84. metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
  85. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  86. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  87. metaflow-stubs/plugins/datatools/s3/s3.pyi +6 -6
  88. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  89. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  90. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  91. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  92. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  93. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  94. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  95. metaflow-stubs/plugins/frameworks/pytorch.pyi +3 -3
  96. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  97. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  98. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  99. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  100. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  101. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  102. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  103. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +3 -3
  104. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
  105. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  106. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
  107. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  108. metaflow-stubs/plugins/package_cli.pyi +2 -2
  109. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  110. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  111. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  112. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  113. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  114. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  115. metaflow-stubs/plugins/pypi/pypi_environment.pyi +3 -3
  116. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  117. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  118. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  119. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  120. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
  121. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  122. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  123. metaflow-stubs/plugins/tag_cli.pyi +5 -5
  124. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  125. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  126. metaflow-stubs/procpoll.pyi +2 -2
  127. metaflow-stubs/pylint_wrapper.pyi +2 -2
  128. metaflow-stubs/tagging_util.pyi +2 -2
  129. {ob_metaflow_stubs-2.11.8.1.dist-info → ob_metaflow_stubs-2.11.9.1.dist-info}/METADATA +2 -2
  130. ob_metaflow_stubs-2.11.9.1.dist-info/RECORD +133 -0
  131. ob_metaflow_stubs-2.11.8.1.dist-info/RECORD +0 -133
  132. {ob_metaflow_stubs-2.11.8.1.dist-info → ob_metaflow_stubs-2.11.9.1.dist-info}/WHEEL +0 -0
  133. {ob_metaflow_stubs-2.11.8.1.dist-info → ob_metaflow_stubs-2.11.9.1.dist-info}/top_level.txt +0 -0
@@ -1,23 +1,23 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.11.8.1 #
4
- # Generated on 2024-03-29T12:39:58.338796 #
3
+ # MF version: 2.11.9.1 #
4
+ # Generated on 2024-03-30T09:14:00.953272 #
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.metaflow_current
12
- import typing
13
- import io
14
- import metaflow.events
15
- import metaflow.plugins.datatools.s3.s3
11
+ import metaflow.parameters
16
12
  import metaflow.datastore.inputs
17
13
  import metaflow.client.core
18
- import metaflow._vendor.click.types
14
+ import metaflow.events
15
+ import metaflow.plugins.datatools.s3.s3
16
+ import io
19
17
  import datetime
20
- import metaflow.parameters
18
+ import typing
19
+ import metaflow._vendor.click.types
20
+ import metaflow.metaflow_current
21
21
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
22
22
  StepFlag = typing.NewType("StepFlag", bool)
23
23
 
@@ -726,92 +726,132 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
726
726
  ...
727
727
 
728
728
  @typing.overload
729
- 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]]]:
729
+ 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]]]:
730
730
  """
731
- Specifies environment variables to be set prior to the execution of a step.
731
+ Specifies the resources needed when executing this step.
732
+
733
+ Use `@resources` to specify the resource requirements
734
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
735
+
736
+ You can choose the compute layer on the command line by executing e.g.
737
+ ```
738
+ python myflow.py run --with batch
739
+ ```
740
+ or
741
+ ```
742
+ python myflow.py run --with kubernetes
743
+ ```
744
+ which executes the flow on the desired system using the
745
+ requirements specified in `@resources`.
732
746
 
733
747
  Parameters
734
748
  ----------
735
- vars : Dict[str, str], default {}
736
- Dictionary of environment variables to set.
749
+ cpu : int, default 1
750
+ Number of CPUs required for this step.
751
+ gpu : int, default 0
752
+ Number of GPUs required for this step.
753
+ disk : int, optional, default None
754
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
755
+ memory : int, default 4096
756
+ Memory size (in MB) required for this step.
757
+ shared_memory : int, optional, default None
758
+ The value for the size (in MiB) of the /dev/shm volume for this step.
759
+ This parameter maps to the `--shm-size` option in Docker.
737
760
  """
738
761
  ...
739
762
 
740
763
  @typing.overload
741
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
764
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
742
765
  ...
743
766
 
744
767
  @typing.overload
745
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
768
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
746
769
  ...
747
770
 
748
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
771
+ 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):
749
772
  """
750
- Specifies environment variables to be set prior to the execution of a step.
773
+ Specifies the resources needed when executing this step.
774
+
775
+ Use `@resources` to specify the resource requirements
776
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
777
+
778
+ You can choose the compute layer on the command line by executing e.g.
779
+ ```
780
+ python myflow.py run --with batch
781
+ ```
782
+ or
783
+ ```
784
+ python myflow.py run --with kubernetes
785
+ ```
786
+ which executes the flow on the desired system using the
787
+ requirements specified in `@resources`.
751
788
 
752
789
  Parameters
753
790
  ----------
754
- vars : Dict[str, str], default {}
755
- Dictionary of environment variables to set.
791
+ cpu : int, default 1
792
+ Number of CPUs required for this step.
793
+ gpu : int, default 0
794
+ Number of GPUs required for this step.
795
+ disk : int, optional, default None
796
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
797
+ memory : int, default 4096
798
+ Memory size (in MB) required for this step.
799
+ shared_memory : int, optional, default None
800
+ The value for the size (in MiB) of the /dev/shm volume for this step.
801
+ This parameter maps to the `--shm-size` option in Docker.
756
802
  """
757
803
  ...
758
804
 
759
- 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, port: typing.Optional[int] = None, 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]]]:
805
+ @typing.overload
806
+ 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]]]:
760
807
  """
761
- Specifies that this step should execute on Kubernetes.
808
+ Specifies the number of times the task corresponding
809
+ to a step needs to be retried.
810
+
811
+ This decorator is useful for handling transient errors, such as networking issues.
812
+ If your task contains operations that can't be retried safely, e.g. database updates,
813
+ it is advisable to annotate it with `@retry(times=0)`.
814
+
815
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
816
+ decorator will execute a no-op task after all retries have been exhausted,
817
+ ensuring that the flow execution can continue.
762
818
 
763
819
  Parameters
764
820
  ----------
765
- cpu : int, default 1
766
- Number of CPUs required for this step. If `@resources` is
767
- also present, the maximum value from all decorators is used.
768
- memory : int, default 4096
769
- Memory size (in MB) required for this step. If
770
- `@resources` is also present, the maximum value from all decorators is
771
- used.
772
- disk : int, default 10240
773
- Disk size (in MB) required for this step. If
774
- `@resources` is also present, the maximum value from all decorators is
775
- used.
776
- image : str, optional, default None
777
- Docker image to use when launching on Kubernetes. If not specified, and
778
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
779
- not, a default Docker image mapping to the current version of Python is used.
780
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
781
- If given, the imagePullPolicy to be applied to the Docker image of the step.
782
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
783
- Kubernetes service account to use when launching pod in Kubernetes.
784
- secrets : List[str], optional, default None
785
- Kubernetes secrets to use when launching pod in Kubernetes. These
786
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
787
- in Metaflow configuration.
788
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
789
- Kubernetes namespace to use when launching pod in Kubernetes.
790
- gpu : int, optional, default None
791
- Number of GPUs required for this step. A value of zero implies that
792
- the scheduled node should not have GPUs.
793
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
794
- The vendor of the GPUs to be used for this step.
795
- tolerations : List[str], default []
796
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
797
- Kubernetes tolerations to use when launching pod in Kubernetes.
798
- use_tmpfs : bool, default False
799
- This enables an explicit tmpfs mount for this step.
800
- tmpfs_tempdir : bool, default True
801
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
802
- tmpfs_size : int, optional, default: None
803
- The value for the size (in MiB) of the tmpfs mount for this step.
804
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
805
- memory allocated for this step.
806
- tmpfs_path : str, optional, default /metaflow_temp
807
- Path to tmpfs mount for this step.
808
- persistent_volume_claims : Dict[str, str], optional, default None
809
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
810
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
811
- port: int, optional
812
- Number of the port to specify in the Kubernetes job object
813
- shared_memory: int, optional
814
- Shared memory size (in MiB) required for this steps
821
+ times : int, default 3
822
+ Number of times to retry this task.
823
+ minutes_between_retries : int, default 2
824
+ Number of minutes between retries.
825
+ """
826
+ ...
827
+
828
+ @typing.overload
829
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
830
+ ...
831
+
832
+ @typing.overload
833
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
834
+ ...
835
+
836
+ 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):
837
+ """
838
+ Specifies the number of times the task corresponding
839
+ to a step needs to be retried.
840
+
841
+ This decorator is useful for handling transient errors, such as networking issues.
842
+ If your task contains operations that can't be retried safely, e.g. database updates,
843
+ it is advisable to annotate it with `@retry(times=0)`.
844
+
845
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
846
+ decorator will execute a no-op task after all retries have been exhausted,
847
+ ensuring that the flow execution can continue.
848
+
849
+ Parameters
850
+ ----------
851
+ times : int, default 3
852
+ Number of times to retry this task.
853
+ minutes_between_retries : int, default 2
854
+ Number of minutes between retries.
815
855
  """
816
856
  ...
817
857
 
@@ -873,149 +913,15 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
873
913
  ...
874
914
 
875
915
  @typing.overload
876
- 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]]]:
877
- """
878
- Specifies the Conda environment for the step.
879
-
880
- Information in this decorator will augment any
881
- attributes set in the `@conda_base` flow-level decorator. Hence,
882
- you can use `@conda_base` to set packages required by all
883
- steps and use `@conda` to specify step-specific overrides.
884
-
885
- Parameters
886
- ----------
887
- packages : Dict[str, str], default {}
888
- Packages to use for this step. The key is the name of the package
889
- and the value is the version to use.
890
- libraries : Dict[str, str], default {}
891
- Supported for backward compatibility. When used with packages, packages will take precedence.
892
- python : str, optional, default None
893
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
894
- that the version used will correspond to the version of the Python interpreter used to start the run.
895
- disabled : bool, default False
896
- If set to True, disables @conda.
897
- """
898
- ...
899
-
900
- @typing.overload
901
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
902
- ...
903
-
904
- @typing.overload
905
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
906
- ...
907
-
908
- 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):
909
- """
910
- Specifies the Conda environment for the step.
911
-
912
- Information in this decorator will augment any
913
- attributes set in the `@conda_base` flow-level decorator. Hence,
914
- you can use `@conda_base` to set packages required by all
915
- steps and use `@conda` to specify step-specific overrides.
916
-
917
- Parameters
918
- ----------
919
- packages : Dict[str, str], default {}
920
- Packages to use for this step. The key is the name of the package
921
- and the value is the version to use.
922
- libraries : Dict[str, str], default {}
923
- Supported for backward compatibility. When used with packages, packages will take precedence.
924
- python : str, optional, default None
925
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
926
- that the version used will correspond to the version of the Python interpreter used to start the run.
927
- disabled : bool, default False
928
- If set to True, disables @conda.
929
- """
930
- ...
931
-
932
- @typing.overload
933
- 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]]]:
916
+ 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]]]:
934
917
  """
935
- Specifies the resources needed when executing this step.
936
-
937
- Use `@resources` to specify the resource requirements
938
- independently of the specific compute layer (`@batch`, `@kubernetes`).
939
-
940
- You can choose the compute layer on the command line by executing e.g.
941
- ```
942
- python myflow.py run --with batch
943
- ```
944
- or
945
- ```
946
- python myflow.py run --with kubernetes
947
- ```
948
- which executes the flow on the desired system using the
949
- requirements specified in `@resources`.
918
+ Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
950
919
 
951
920
  Parameters
952
921
  ----------
953
922
  cpu : int, default 1
954
- Number of CPUs required for this step.
955
- gpu : int, default 0
956
- Number of GPUs required for this step.
957
- disk : int, optional, default None
958
- Disk size (in MB) required for this step. Only applies on Kubernetes.
959
- memory : int, default 4096
960
- Memory size (in MB) required for this step.
961
- shared_memory : int, optional, default None
962
- The value for the size (in MiB) of the /dev/shm volume for this step.
963
- This parameter maps to the `--shm-size` option in Docker.
964
- """
965
- ...
966
-
967
- @typing.overload
968
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
969
- ...
970
-
971
- @typing.overload
972
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
973
- ...
974
-
975
- 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):
976
- """
977
- Specifies the resources needed when executing this step.
978
-
979
- Use `@resources` to specify the resource requirements
980
- independently of the specific compute layer (`@batch`, `@kubernetes`).
981
-
982
- You can choose the compute layer on the command line by executing e.g.
983
- ```
984
- python myflow.py run --with batch
985
- ```
986
- or
987
- ```
988
- python myflow.py run --with kubernetes
989
- ```
990
- which executes the flow on the desired system using the
991
- requirements specified in `@resources`.
992
-
993
- Parameters
994
- ----------
995
- cpu : int, default 1
996
- Number of CPUs required for this step.
997
- gpu : int, default 0
998
- Number of GPUs required for this step.
999
- disk : int, optional, default None
1000
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1001
- memory : int, default 4096
1002
- Memory size (in MB) required for this step.
1003
- shared_memory : int, optional, default None
1004
- The value for the size (in MiB) of the /dev/shm volume for this step.
1005
- This parameter maps to the `--shm-size` option in Docker.
1006
- """
1007
- ...
1008
-
1009
- @typing.overload
1010
- 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]]]:
1011
- """
1012
- Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
1013
-
1014
- Parameters
1015
- ----------
1016
- cpu : int, default 1
1017
- Number of CPUs required for this step. If `@resources` is
1018
- also present, the maximum value from all decorators is used.
923
+ Number of CPUs required for this step. If `@resources` is
924
+ also present, the maximum value from all decorators is used.
1019
925
  gpu : int, default 0
1020
926
  Number of GPUs required for this step. If `@resources` is
1021
927
  also present, the maximum value from all decorators is used.
@@ -1153,108 +1059,6 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1153
1059
  """
1154
1060
  ...
1155
1061
 
1156
- @typing.overload
1157
- 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]]]:
1158
- """
1159
- Specifies the number of times the task corresponding
1160
- to a step needs to be retried.
1161
-
1162
- This decorator is useful for handling transient errors, such as networking issues.
1163
- If your task contains operations that can't be retried safely, e.g. database updates,
1164
- it is advisable to annotate it with `@retry(times=0)`.
1165
-
1166
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1167
- decorator will execute a no-op task after all retries have been exhausted,
1168
- ensuring that the flow execution can continue.
1169
-
1170
- Parameters
1171
- ----------
1172
- times : int, default 3
1173
- Number of times to retry this task.
1174
- minutes_between_retries : int, default 2
1175
- Number of minutes between retries.
1176
- """
1177
- ...
1178
-
1179
- @typing.overload
1180
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1181
- ...
1182
-
1183
- @typing.overload
1184
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1185
- ...
1186
-
1187
- 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):
1188
- """
1189
- Specifies the number of times the task corresponding
1190
- to a step needs to be retried.
1191
-
1192
- This decorator is useful for handling transient errors, such as networking issues.
1193
- If your task contains operations that can't be retried safely, e.g. database updates,
1194
- it is advisable to annotate it with `@retry(times=0)`.
1195
-
1196
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1197
- decorator will execute a no-op task after all retries have been exhausted,
1198
- ensuring that the flow execution can continue.
1199
-
1200
- Parameters
1201
- ----------
1202
- times : int, default 3
1203
- Number of times to retry this task.
1204
- minutes_between_retries : int, default 2
1205
- Number of minutes between retries.
1206
- """
1207
- ...
1208
-
1209
- @typing.overload
1210
- 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]]]:
1211
- """
1212
- Specifies the PyPI packages for the step.
1213
-
1214
- Information in this decorator will augment any
1215
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1216
- you can use `@pypi_base` to set packages required by all
1217
- steps and use `@pypi` to specify step-specific overrides.
1218
-
1219
- Parameters
1220
- ----------
1221
- packages : Dict[str, str], default: {}
1222
- Packages to use for this step. The key is the name of the package
1223
- and the value is the version to use.
1224
- python : str, optional, default: None
1225
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1226
- that the version used will correspond to the version of the Python interpreter used to start the run.
1227
- """
1228
- ...
1229
-
1230
- @typing.overload
1231
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1232
- ...
1233
-
1234
- @typing.overload
1235
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1236
- ...
1237
-
1238
- def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1239
- """
1240
- Specifies the PyPI packages for the step.
1241
-
1242
- Information in this decorator will augment any
1243
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1244
- you can use `@pypi_base` to set packages required by all
1245
- steps and use `@pypi` to specify step-specific overrides.
1246
-
1247
- Parameters
1248
- ----------
1249
- packages : Dict[str, str], default: {}
1250
- Packages to use for this step. The key is the name of the package
1251
- and the value is the version to use.
1252
- python : str, optional, default: None
1253
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1254
- that the version used will correspond to the version of the Python interpreter used to start the run.
1255
- """
1256
- ...
1257
-
1258
1062
  @typing.overload
1259
1063
  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]]]:
1260
1064
  """
@@ -1306,39 +1110,6 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
1306
1110
  """
1307
1111
  ...
1308
1112
 
1309
- @typing.overload
1310
- 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]]]:
1311
- """
1312
- Specifies secrets to be retrieved and injected as environment variables prior to
1313
- the execution of a step.
1314
-
1315
- Parameters
1316
- ----------
1317
- sources : List[Union[str, Dict[str, Any]]], default: []
1318
- List of secret specs, defining how the secrets are to be retrieved
1319
- """
1320
- ...
1321
-
1322
- @typing.overload
1323
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1324
- ...
1325
-
1326
- @typing.overload
1327
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1328
- ...
1329
-
1330
- 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]]] = []):
1331
- """
1332
- Specifies secrets to be retrieved and injected as environment variables prior to
1333
- the execution of a step.
1334
-
1335
- Parameters
1336
- ----------
1337
- sources : List[Union[str, Dict[str, Any]]], default: []
1338
- List of secret specs, defining how the secrets are to be retrieved
1339
- """
1340
- ...
1341
-
1342
1113
  @typing.overload
1343
1114
  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]]]:
1344
1115
  """
@@ -1389,97 +1160,273 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1389
1160
  ...
1390
1161
 
1391
1162
  @typing.overload
1392
- 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]]:
1163
+ 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]]]:
1393
1164
  """
1394
- Specifies the event(s) that this flow depends on.
1395
-
1396
- ```
1397
- @trigger(event='foo')
1398
- ```
1399
- or
1400
- ```
1401
- @trigger(events=['foo', 'bar'])
1402
- ```
1403
-
1404
- Additionally, you can specify the parameter mappings
1405
- to map event payload to Metaflow parameters for the flow.
1406
- ```
1407
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1408
- ```
1409
- or
1410
- ```
1411
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1412
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1413
- ```
1414
-
1415
- 'parameters' can also be a list of strings and tuples like so:
1416
- ```
1417
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1418
- ```
1419
- This is equivalent to:
1420
- ```
1421
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1422
- ```
1165
+ Specifies secrets to be retrieved and injected as environment variables prior to
1166
+ the execution of a step.
1423
1167
 
1424
1168
  Parameters
1425
1169
  ----------
1426
- event : Union[str, Dict[str, Any]], optional, default None
1427
- Event dependency for this flow.
1428
- events : List[Union[str, Dict[str, Any]]], default []
1429
- Events dependency for this flow.
1430
- options : Dict[str, Any], default {}
1431
- Backend-specific configuration for tuning eventing behavior.
1432
-
1433
-
1170
+ sources : List[Union[str, Dict[str, Any]]], default: []
1171
+ List of secret specs, defining how the secrets are to be retrieved
1434
1172
  """
1435
1173
  ...
1436
1174
 
1437
1175
  @typing.overload
1438
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1176
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1439
1177
  ...
1440
1178
 
1441
- 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] = {}):
1179
+ @typing.overload
1180
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1181
+ ...
1182
+
1183
+ 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]]] = []):
1442
1184
  """
1443
- Specifies the event(s) that this flow depends on.
1185
+ Specifies secrets to be retrieved and injected as environment variables prior to
1186
+ the execution of a step.
1444
1187
 
1445
- ```
1446
- @trigger(event='foo')
1447
- ```
1448
- or
1449
- ```
1450
- @trigger(events=['foo', 'bar'])
1451
- ```
1188
+ Parameters
1189
+ ----------
1190
+ sources : List[Union[str, Dict[str, Any]]], default: []
1191
+ List of secret specs, defining how the secrets are to be retrieved
1192
+ """
1193
+ ...
1194
+
1195
+ 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, port: typing.Optional[int] = None, 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]]]:
1196
+ """
1197
+ Specifies that this step should execute on Kubernetes.
1452
1198
 
1453
- Additionally, you can specify the parameter mappings
1454
- to map event payload to Metaflow parameters for the flow.
1455
- ```
1456
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1457
- ```
1458
- or
1459
- ```
1460
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1461
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1462
- ```
1199
+ Parameters
1200
+ ----------
1201
+ cpu : int, default 1
1202
+ Number of CPUs required for this step. If `@resources` is
1203
+ also present, the maximum value from all decorators is used.
1204
+ memory : int, default 4096
1205
+ Memory size (in MB) required for this step. If
1206
+ `@resources` is also present, the maximum value from all decorators is
1207
+ used.
1208
+ disk : int, default 10240
1209
+ Disk size (in MB) required for this step. If
1210
+ `@resources` is also present, the maximum value from all decorators is
1211
+ used.
1212
+ image : str, optional, default None
1213
+ Docker image to use when launching on Kubernetes. If not specified, and
1214
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
1215
+ not, a default Docker image mapping to the current version of Python is used.
1216
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
1217
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
1218
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
1219
+ Kubernetes service account to use when launching pod in Kubernetes.
1220
+ secrets : List[str], optional, default None
1221
+ Kubernetes secrets to use when launching pod in Kubernetes. These
1222
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
1223
+ in Metaflow configuration.
1224
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
1225
+ Kubernetes namespace to use when launching pod in Kubernetes.
1226
+ gpu : int, optional, default None
1227
+ Number of GPUs required for this step. A value of zero implies that
1228
+ the scheduled node should not have GPUs.
1229
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
1230
+ The vendor of the GPUs to be used for this step.
1231
+ tolerations : List[str], default []
1232
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
1233
+ Kubernetes tolerations to use when launching pod in Kubernetes.
1234
+ use_tmpfs : bool, default False
1235
+ This enables an explicit tmpfs mount for this step.
1236
+ tmpfs_tempdir : bool, default True
1237
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1238
+ tmpfs_size : int, optional, default: None
1239
+ The value for the size (in MiB) of the tmpfs mount for this step.
1240
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1241
+ memory allocated for this step.
1242
+ tmpfs_path : str, optional, default /metaflow_temp
1243
+ Path to tmpfs mount for this step.
1244
+ persistent_volume_claims : Dict[str, str], optional, default None
1245
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
1246
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
1247
+ port: int, optional
1248
+ Number of the port to specify in the Kubernetes job object
1249
+ shared_memory: int, optional
1250
+ Shared memory size (in MiB) required for this steps
1251
+ """
1252
+ ...
1253
+
1254
+ @typing.overload
1255
+ 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]]]:
1256
+ """
1257
+ Specifies the PyPI packages for the step.
1463
1258
 
1464
- 'parameters' can also be a list of strings and tuples like so:
1465
- ```
1466
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1467
- ```
1468
- This is equivalent to:
1469
- ```
1470
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1471
- ```
1259
+ Information in this decorator will augment any
1260
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1261
+ you can use `@pypi_base` to set packages required by all
1262
+ steps and use `@pypi` to specify step-specific overrides.
1472
1263
 
1473
1264
  Parameters
1474
1265
  ----------
1475
- event : Union[str, Dict[str, Any]], optional, default None
1476
- Event dependency for this flow.
1477
- events : List[Union[str, Dict[str, Any]]], default []
1478
- Events dependency for this flow.
1479
- options : Dict[str, Any], default {}
1480
- Backend-specific configuration for tuning eventing behavior.
1266
+ packages : Dict[str, str], default: {}
1267
+ Packages to use for this step. The key is the name of the package
1268
+ and the value is the version to use.
1269
+ python : str, optional, default: None
1270
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1271
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1272
+ """
1273
+ ...
1274
+
1275
+ @typing.overload
1276
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1277
+ ...
1278
+
1279
+ @typing.overload
1280
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1281
+ ...
1282
+
1283
+ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1284
+ """
1285
+ Specifies the PyPI packages for the step.
1286
+
1287
+ Information in this decorator will augment any
1288
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1289
+ you can use `@pypi_base` to set packages required by all
1290
+ steps and use `@pypi` to specify step-specific overrides.
1291
+
1292
+ Parameters
1293
+ ----------
1294
+ packages : Dict[str, str], default: {}
1295
+ Packages to use for this step. The key is the name of the package
1296
+ and the value is the version to use.
1297
+ python : str, optional, default: None
1298
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1299
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1300
+ """
1301
+ ...
1302
+
1303
+ @typing.overload
1304
+ 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]]]:
1305
+ """
1306
+ Specifies the Conda environment for the step.
1307
+
1308
+ Information in this decorator will augment any
1309
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1310
+ you can use `@conda_base` to set packages required by all
1311
+ steps and use `@conda` to specify step-specific overrides.
1312
+
1313
+ Parameters
1314
+ ----------
1315
+ packages : Dict[str, str], default {}
1316
+ Packages to use for this step. The key is the name of the package
1317
+ and the value is the version to use.
1318
+ libraries : Dict[str, str], default {}
1319
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1320
+ python : str, optional, default None
1321
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1322
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1323
+ disabled : bool, default False
1324
+ If set to True, disables @conda.
1325
+ """
1326
+ ...
1327
+
1328
+ @typing.overload
1329
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1330
+ ...
1331
+
1332
+ @typing.overload
1333
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1334
+ ...
1335
+
1336
+ 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):
1337
+ """
1338
+ Specifies the Conda environment for the step.
1339
+
1340
+ Information in this decorator will augment any
1341
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1342
+ you can use `@conda_base` to set packages required by all
1343
+ steps and use `@conda` to specify step-specific overrides.
1481
1344
 
1345
+ Parameters
1346
+ ----------
1347
+ packages : Dict[str, str], default {}
1348
+ Packages to use for this step. The key is the name of the package
1349
+ and the value is the version to use.
1350
+ libraries : Dict[str, str], default {}
1351
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1352
+ python : str, optional, default None
1353
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1354
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1355
+ disabled : bool, default False
1356
+ If set to True, disables @conda.
1357
+ """
1358
+ ...
1359
+
1360
+ @typing.overload
1361
+ def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1362
+ """
1363
+ Specifies environment variables to be set prior to the execution of a step.
1482
1364
 
1365
+ Parameters
1366
+ ----------
1367
+ vars : Dict[str, str], default {}
1368
+ Dictionary of environment variables to set.
1369
+ """
1370
+ ...
1371
+
1372
+ @typing.overload
1373
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1374
+ ...
1375
+
1376
+ @typing.overload
1377
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1378
+ ...
1379
+
1380
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1381
+ """
1382
+ Specifies environment variables to be set prior to the execution of a step.
1383
+
1384
+ Parameters
1385
+ ----------
1386
+ vars : Dict[str, str], default {}
1387
+ Dictionary of environment variables to set.
1388
+ """
1389
+ ...
1390
+
1391
+ 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]]:
1392
+ """
1393
+ 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.
1394
+ 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.
1395
+
1396
+ Parameters
1397
+ ----------
1398
+ timeout : int
1399
+ Time, in seconds before the task times out and fails. (Default: 3600)
1400
+ poke_interval : int
1401
+ Time in seconds that the job should wait in between each try. (Default: 60)
1402
+ mode : str
1403
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1404
+ exponential_backoff : bool
1405
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1406
+ pool : str
1407
+ the slot pool this task should run in,
1408
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1409
+ soft_fail : bool
1410
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1411
+ name : str
1412
+ Name of the sensor on Airflow
1413
+ description : str
1414
+ Description of sensor in the Airflow UI
1415
+ external_dag_id : str
1416
+ The dag_id that contains the task you want to wait for.
1417
+ external_task_ids : List[str]
1418
+ The list of task_ids that you want to wait for.
1419
+ If None (default value) the sensor waits for the DAG. (Default: None)
1420
+ allowed_states : List[str]
1421
+ Iterable of allowed states, (Default: ['success'])
1422
+ failed_states : List[str]
1423
+ Iterable of failed or dis-allowed states. (Default: None)
1424
+ execution_delta : datetime.timedelta
1425
+ time difference with the previous execution to look at,
1426
+ the default is the same logical date as the current task or DAG. (Default: None)
1427
+ check_existence: bool
1428
+ Set to True to check if the external task exists or check if
1429
+ the DAG to wait for exists. (Default: True)
1483
1430
  """
1484
1431
  ...
1485
1432
 
@@ -1502,48 +1449,83 @@ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typ
1502
1449
  ...
1503
1450
 
1504
1451
  @typing.overload
1505
- 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]]:
1452
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1506
1453
  """
1507
- Specifies the flow(s) that this flow depends on.
1454
+ Specifies the PyPI packages for all steps of the flow.
1455
+
1456
+ Use `@pypi_base` to set common packages required by all
1457
+ steps and use `@pypi` to specify step-specific overrides.
1458
+ Parameters
1459
+ ----------
1460
+ packages : Dict[str, str], default: {}
1461
+ Packages to use for this flow. The key is the name of the package
1462
+ and the value is the version to use.
1463
+ python : str, optional, default: None
1464
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1465
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1466
+ """
1467
+ ...
1468
+
1469
+ @typing.overload
1470
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1471
+ ...
1472
+
1473
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1474
+ """
1475
+ Specifies the PyPI packages for all steps of the flow.
1476
+
1477
+ Use `@pypi_base` to set common packages required by all
1478
+ steps and use `@pypi` to specify step-specific overrides.
1479
+ Parameters
1480
+ ----------
1481
+ packages : Dict[str, str], default: {}
1482
+ Packages to use for this flow. The key is the name of the package
1483
+ and the value is the version to use.
1484
+ python : str, optional, default: None
1485
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1486
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1487
+ """
1488
+ ...
1489
+
1490
+ @typing.overload
1491
+ 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]]:
1492
+ """
1493
+ Specifies the event(s) that this flow depends on.
1508
1494
 
1509
1495
  ```
1510
- @trigger_on_finish(flow='FooFlow')
1496
+ @trigger(event='foo')
1511
1497
  ```
1512
1498
  or
1513
1499
  ```
1514
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1500
+ @trigger(events=['foo', 'bar'])
1515
1501
  ```
1516
- This decorator respects the @project decorator and triggers the flow
1517
- when upstream runs within the same namespace complete successfully
1518
1502
 
1519
- Additionally, you can specify project aware upstream flow dependencies
1520
- by specifying the fully qualified project_flow_name.
1503
+ Additionally, you can specify the parameter mappings
1504
+ to map event payload to Metaflow parameters for the flow.
1521
1505
  ```
1522
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1506
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1523
1507
  ```
1524
1508
  or
1525
1509
  ```
1526
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1510
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1511
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1527
1512
  ```
1528
1513
 
1529
- You can also specify just the project or project branch (other values will be
1530
- inferred from the current project or project branch):
1514
+ 'parameters' can also be a list of strings and tuples like so:
1531
1515
  ```
1532
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1516
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1517
+ ```
1518
+ This is equivalent to:
1519
+ ```
1520
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1533
1521
  ```
1534
-
1535
- Note that `branch` is typically one of:
1536
- - `prod`
1537
- - `user.bob`
1538
- - `test.my_experiment`
1539
- - `prod.staging`
1540
1522
 
1541
1523
  Parameters
1542
1524
  ----------
1543
- flow : Union[str, Dict[str, str]], optional, default None
1544
- Upstream flow dependency for this flow.
1545
- flows : List[Union[str, Dict[str, str]]], default []
1546
- Upstream flow dependencies for this flow.
1525
+ event : Union[str, Dict[str, Any]], optional, default None
1526
+ Event dependency for this flow.
1527
+ events : List[Union[str, Dict[str, Any]]], default []
1528
+ Events dependency for this flow.
1547
1529
  options : Dict[str, Any], default {}
1548
1530
  Backend-specific configuration for tuning eventing behavior.
1549
1531
 
@@ -1552,51 +1534,47 @@ def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[str, str], None] =
1552
1534
  ...
1553
1535
 
1554
1536
  @typing.overload
1555
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1537
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1556
1538
  ...
1557
1539
 
1558
- 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] = {}):
1540
+ 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] = {}):
1559
1541
  """
1560
- Specifies the flow(s) that this flow depends on.
1542
+ Specifies the event(s) that this flow depends on.
1561
1543
 
1562
1544
  ```
1563
- @trigger_on_finish(flow='FooFlow')
1545
+ @trigger(event='foo')
1564
1546
  ```
1565
1547
  or
1566
1548
  ```
1567
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1549
+ @trigger(events=['foo', 'bar'])
1568
1550
  ```
1569
- This decorator respects the @project decorator and triggers the flow
1570
- when upstream runs within the same namespace complete successfully
1571
1551
 
1572
- Additionally, you can specify project aware upstream flow dependencies
1573
- by specifying the fully qualified project_flow_name.
1552
+ Additionally, you can specify the parameter mappings
1553
+ to map event payload to Metaflow parameters for the flow.
1574
1554
  ```
1575
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1555
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1576
1556
  ```
1577
1557
  or
1578
1558
  ```
1579
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1559
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1560
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1580
1561
  ```
1581
1562
 
1582
- You can also specify just the project or project branch (other values will be
1583
- inferred from the current project or project branch):
1563
+ 'parameters' can also be a list of strings and tuples like so:
1584
1564
  ```
1585
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1565
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1566
+ ```
1567
+ This is equivalent to:
1568
+ ```
1569
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1586
1570
  ```
1587
-
1588
- Note that `branch` is typically one of:
1589
- - `prod`
1590
- - `user.bob`
1591
- - `test.my_experiment`
1592
- - `prod.staging`
1593
1571
 
1594
1572
  Parameters
1595
1573
  ----------
1596
- flow : Union[str, Dict[str, str]], optional, default None
1597
- Upstream flow dependency for this flow.
1598
- flows : List[Union[str, Dict[str, str]]], default []
1599
- Upstream flow dependencies for this flow.
1574
+ event : Union[str, Dict[str, Any]], optional, default None
1575
+ Event dependency for this flow.
1576
+ events : List[Union[str, Dict[str, Any]]], default []
1577
+ Events dependency for this flow.
1600
1578
  options : Dict[str, Any], default {}
1601
1579
  Backend-specific configuration for tuning eventing behavior.
1602
1580
 
@@ -1653,87 +1631,6 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1653
1631
  """
1654
1632
  ...
1655
1633
 
1656
- @typing.overload
1657
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1658
- """
1659
- Specifies the PyPI packages for all steps of the flow.
1660
-
1661
- Use `@pypi_base` to set common packages required by all
1662
- steps and use `@pypi` to specify step-specific overrides.
1663
- Parameters
1664
- ----------
1665
- packages : Dict[str, str], default: {}
1666
- Packages to use for this flow. The key is the name of the package
1667
- and the value is the version to use.
1668
- python : str, optional, default: None
1669
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1670
- that the version used will correspond to the version of the Python interpreter used to start the run.
1671
- """
1672
- ...
1673
-
1674
- @typing.overload
1675
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1676
- ...
1677
-
1678
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1679
- """
1680
- Specifies the PyPI packages for all steps of the flow.
1681
-
1682
- Use `@pypi_base` to set common packages required by all
1683
- steps and use `@pypi` to specify step-specific overrides.
1684
- Parameters
1685
- ----------
1686
- packages : Dict[str, str], default: {}
1687
- Packages to use for this flow. The key is the name of the package
1688
- and the value is the version to use.
1689
- python : str, optional, default: None
1690
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1691
- that the version used will correspond to the version of the Python interpreter used to start the run.
1692
- """
1693
- ...
1694
-
1695
- 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]]:
1696
- """
1697
- 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.
1698
- 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.
1699
-
1700
- Parameters
1701
- ----------
1702
- timeout : int
1703
- Time, in seconds before the task times out and fails. (Default: 3600)
1704
- poke_interval : int
1705
- Time in seconds that the job should wait in between each try. (Default: 60)
1706
- mode : str
1707
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1708
- exponential_backoff : bool
1709
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1710
- pool : str
1711
- the slot pool this task should run in,
1712
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1713
- soft_fail : bool
1714
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1715
- name : str
1716
- Name of the sensor on Airflow
1717
- description : str
1718
- Description of sensor in the Airflow UI
1719
- external_dag_id : str
1720
- The dag_id that contains the task you want to wait for.
1721
- external_task_ids : List[str]
1722
- The list of task_ids that you want to wait for.
1723
- If None (default value) the sensor waits for the DAG. (Default: None)
1724
- allowed_states : List[str]
1725
- Iterable of allowed states, (Default: ['success'])
1726
- failed_states : List[str]
1727
- Iterable of failed or dis-allowed states. (Default: None)
1728
- execution_delta : datetime.timedelta
1729
- time difference with the previous execution to look at,
1730
- the default is the same logical date as the current task or DAG. (Default: None)
1731
- check_existence: bool
1732
- Set to True to check if the external task exists or check if
1733
- the DAG to wait for exists. (Default: True)
1734
- """
1735
- ...
1736
-
1737
1634
  @typing.overload
1738
1635
  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]]:
1739
1636
  """
@@ -1825,6 +1722,109 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1825
1722
  """
1826
1723
  ...
1827
1724
 
1725
+ @typing.overload
1726
+ 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]]:
1727
+ """
1728
+ Specifies the flow(s) that this flow depends on.
1729
+
1730
+ ```
1731
+ @trigger_on_finish(flow='FooFlow')
1732
+ ```
1733
+ or
1734
+ ```
1735
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1736
+ ```
1737
+ This decorator respects the @project decorator and triggers the flow
1738
+ when upstream runs within the same namespace complete successfully
1739
+
1740
+ Additionally, you can specify project aware upstream flow dependencies
1741
+ by specifying the fully qualified project_flow_name.
1742
+ ```
1743
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1744
+ ```
1745
+ or
1746
+ ```
1747
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1748
+ ```
1749
+
1750
+ You can also specify just the project or project branch (other values will be
1751
+ inferred from the current project or project branch):
1752
+ ```
1753
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1754
+ ```
1755
+
1756
+ Note that `branch` is typically one of:
1757
+ - `prod`
1758
+ - `user.bob`
1759
+ - `test.my_experiment`
1760
+ - `prod.staging`
1761
+
1762
+ Parameters
1763
+ ----------
1764
+ flow : Union[str, Dict[str, str]], optional, default None
1765
+ Upstream flow dependency for this flow.
1766
+ flows : List[Union[str, Dict[str, str]]], default []
1767
+ Upstream flow dependencies for this flow.
1768
+ options : Dict[str, Any], default {}
1769
+ Backend-specific configuration for tuning eventing behavior.
1770
+
1771
+
1772
+ """
1773
+ ...
1774
+
1775
+ @typing.overload
1776
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1777
+ ...
1778
+
1779
+ 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] = {}):
1780
+ """
1781
+ Specifies the flow(s) that this flow depends on.
1782
+
1783
+ ```
1784
+ @trigger_on_finish(flow='FooFlow')
1785
+ ```
1786
+ or
1787
+ ```
1788
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1789
+ ```
1790
+ This decorator respects the @project decorator and triggers the flow
1791
+ when upstream runs within the same namespace complete successfully
1792
+
1793
+ Additionally, you can specify project aware upstream flow dependencies
1794
+ by specifying the fully qualified project_flow_name.
1795
+ ```
1796
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1797
+ ```
1798
+ or
1799
+ ```
1800
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1801
+ ```
1802
+
1803
+ You can also specify just the project or project branch (other values will be
1804
+ inferred from the current project or project branch):
1805
+ ```
1806
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1807
+ ```
1808
+
1809
+ Note that `branch` is typically one of:
1810
+ - `prod`
1811
+ - `user.bob`
1812
+ - `test.my_experiment`
1813
+ - `prod.staging`
1814
+
1815
+ Parameters
1816
+ ----------
1817
+ flow : Union[str, Dict[str, str]], optional, default None
1818
+ Upstream flow dependency for this flow.
1819
+ flows : List[Union[str, Dict[str, str]]], default []
1820
+ Upstream flow dependencies for this flow.
1821
+ options : Dict[str, Any], default {}
1822
+ Backend-specific configuration for tuning eventing behavior.
1823
+
1824
+
1825
+ """
1826
+ ...
1827
+
1828
1828
  def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
1829
1829
  """
1830
1830
  Switch namespace to the one provided.