metaflow-stubs 2.12.19__py2.py3-none-any.whl → 2.12.20__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 (151) hide show
  1. metaflow-stubs/__init__.pyi +594 -590
  2. metaflow-stubs/cards.pyi +5 -5
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/client/__init__.pyi +4 -4
  5. metaflow-stubs/client/core.pyi +7 -7
  6. metaflow-stubs/client/filecache.pyi +2 -2
  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 +6 -6
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +4 -4
  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 +27 -25
  17. metaflow-stubs/mflog/mflog.pyi +2 -2
  18. metaflow-stubs/multicore_utils.pyi +2 -2
  19. metaflow-stubs/parameters.pyi +2 -2
  20. metaflow-stubs/plugins/__init__.pyi +2 -2
  21. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  22. metaflow-stubs/plugins/airflow/airflow.pyi +2 -2
  23. metaflow-stubs/plugins/airflow/airflow_cli.pyi +2 -2
  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 +2 -2
  30. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  31. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  32. metaflow-stubs/plugins/argo/argo_client.pyi +6 -2
  33. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  34. metaflow-stubs/plugins/argo/argo_workflows.pyi +5 -5
  35. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +6 -6
  36. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +6 -6
  37. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +6 -4
  38. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  39. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  40. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  41. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  43. metaflow-stubs/plugins/aws/batch/batch_cli.pyi +2 -2
  44. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  45. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  46. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  47. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
  48. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
  52. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  53. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +3 -3
  55. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  56. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  57. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +5 -3
  58. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  60. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  61. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
  62. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  63. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  64. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  65. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_cli.pyi +5 -5
  67. metaflow-stubs/plugins/cards/card_client.pyi +4 -4
  68. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  69. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  71. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  73. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  74. metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
  77. metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
  78. metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
  79. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  80. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  81. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  82. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  83. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  84. metaflow-stubs/plugins/cards/component_serializer.pyi +3 -3
  85. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  86. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  87. metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
  88. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  89. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  90. metaflow-stubs/plugins/datatools/s3/s3.pyi +6 -6
  91. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  92. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  93. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  94. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  95. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  96. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  97. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  98. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  99. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  100. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
  101. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  102. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  103. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  104. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  105. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  106. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +18 -0
  107. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +6 -2
  108. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +25 -3
  109. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +8 -2
  110. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  111. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  112. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  113. metaflow-stubs/plugins/logs_cli.pyi +3 -3
  114. metaflow-stubs/plugins/package_cli.pyi +2 -2
  115. metaflow-stubs/plugins/parallel_decorator.pyi +4 -4
  116. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  117. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  118. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  119. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  120. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  121. metaflow-stubs/plugins/pypi/pypi_environment.pyi +3 -3
  122. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  123. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  124. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  125. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  126. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  127. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  128. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  129. metaflow-stubs/plugins/tag_cli.pyi +4 -4
  130. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  131. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  132. metaflow-stubs/procpoll.pyi +2 -2
  133. metaflow-stubs/pylint_wrapper.pyi +2 -2
  134. metaflow-stubs/runner/__init__.pyi +2 -2
  135. metaflow-stubs/runner/deployer.pyi +8 -6
  136. metaflow-stubs/runner/metaflow_runner.pyi +6 -6
  137. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  138. metaflow-stubs/runner/nbrun.pyi +2 -2
  139. metaflow-stubs/runner/subprocess_manager.pyi +4 -4
  140. metaflow-stubs/runner/utils.pyi +5 -3
  141. metaflow-stubs/system/__init__.pyi +3 -3
  142. metaflow-stubs/system/system_logger.pyi +3 -3
  143. metaflow-stubs/system/system_monitor.pyi +3 -3
  144. metaflow-stubs/tagging_util.pyi +2 -2
  145. metaflow-stubs/tuple_util.pyi +2 -2
  146. metaflow-stubs/version.pyi +2 -2
  147. {metaflow_stubs-2.12.19.dist-info → metaflow_stubs-2.12.20.dist-info}/METADATA +2 -2
  148. metaflow_stubs-2.12.20.dist-info/RECORD +151 -0
  149. {metaflow_stubs-2.12.19.dist-info → metaflow_stubs-2.12.20.dist-info}/WHEEL +1 -1
  150. metaflow_stubs-2.12.19.dist-info/RECORD +0 -150
  151. {metaflow_stubs-2.12.19.dist-info → metaflow_stubs-2.12.20.dist-info}/top_level.txt +0 -0
@@ -1,25 +1,25 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.19 #
4
- # Generated on 2024-09-04T23:07:02.410930 #
3
+ # MF version: 2.12.20 #
4
+ # Generated on 2024-09-16T18:11:29.503408 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import typing
12
- import metaflow.client.core
13
- import metaflow.flowspec
14
- import metaflow.metaflow_current
15
11
  import metaflow.parameters
16
- import io
17
12
  import datetime
18
- import metaflow.runner.metaflow_runner
19
- import metaflow.events
20
13
  import metaflow.plugins.datatools.s3.s3
21
- import metaflow.datastore.inputs
14
+ import metaflow.flowspec
15
+ import typing
22
16
  import metaflow._vendor.click.types
17
+ import metaflow.metaflow_current
18
+ import metaflow.events
19
+ import metaflow.runner.metaflow_runner
20
+ import metaflow.client.core
21
+ import metaflow.datastore.inputs
22
+ import io
23
23
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
24
24
  StepFlag = typing.NewType("StepFlag", bool)
25
25
 
@@ -728,465 +728,136 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
728
728
  ...
729
729
 
730
730
  @typing.overload
731
- 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]]]:
731
+ 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]]]:
732
732
  """
733
- Specifies that the step will success under all circumstances.
734
-
735
- The decorator will create an optional artifact, specified by `var`, which
736
- contains the exception raised. You can use it to detect the presence
737
- of errors, indicating that all happy-path artifacts produced by the step
738
- are missing.
733
+ Specifies environment variables to be set prior to the execution of a step.
739
734
 
740
735
  Parameters
741
736
  ----------
742
- var : str, optional, default None
743
- Name of the artifact in which to store the caught exception.
744
- If not specified, the exception is not stored.
745
- print_exception : bool, default True
746
- Determines whether or not the exception is printed to
747
- stdout when caught.
737
+ vars : Dict[str, str], default {}
738
+ Dictionary of environment variables to set.
748
739
  """
749
740
  ...
750
741
 
751
742
  @typing.overload
752
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
743
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
753
744
  ...
754
745
 
755
746
  @typing.overload
756
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
757
- ...
758
-
759
- 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):
760
- """
761
- Specifies that the step will success under all circumstances.
762
-
763
- The decorator will create an optional artifact, specified by `var`, which
764
- contains the exception raised. You can use it to detect the presence
765
- of errors, indicating that all happy-path artifacts produced by the step
766
- are missing.
767
-
768
- Parameters
769
- ----------
770
- var : str, optional, default None
771
- Name of the artifact in which to store the caught exception.
772
- If not specified, the exception is not stored.
773
- print_exception : bool, default True
774
- Determines whether or not the exception is printed to
775
- stdout when caught.
776
- """
747
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
777
748
  ...
778
749
 
779
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
750
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
780
751
  """
781
- Specifies that this step should execute on Kubernetes.
752
+ Specifies environment variables to be set prior to the execution of a step.
782
753
 
783
754
  Parameters
784
755
  ----------
785
- cpu : int, default 1
786
- Number of CPUs required for this step. If `@resources` is
787
- also present, the maximum value from all decorators is used.
788
- memory : int, default 4096
789
- Memory size (in MB) required for this step. If
790
- `@resources` is also present, the maximum value from all decorators is
791
- used.
792
- disk : int, default 10240
793
- Disk size (in MB) required for this step. If
794
- `@resources` is also present, the maximum value from all decorators is
795
- used.
796
- image : str, optional, default None
797
- Docker image to use when launching on Kubernetes. If not specified, and
798
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
799
- not, a default Docker image mapping to the current version of Python is used.
800
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
801
- If given, the imagePullPolicy to be applied to the Docker image of the step.
802
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
803
- Kubernetes service account to use when launching pod in Kubernetes.
804
- secrets : List[str], optional, default None
805
- Kubernetes secrets to use when launching pod in Kubernetes. These
806
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
807
- in Metaflow configuration.
808
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
809
- Kubernetes namespace to use when launching pod in Kubernetes.
810
- gpu : int, optional, default None
811
- Number of GPUs required for this step. A value of zero implies that
812
- the scheduled node should not have GPUs.
813
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
814
- The vendor of the GPUs to be used for this step.
815
- tolerations : List[str], default []
816
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
817
- Kubernetes tolerations to use when launching pod in Kubernetes.
818
- use_tmpfs : bool, default False
819
- This enables an explicit tmpfs mount for this step.
820
- tmpfs_tempdir : bool, default True
821
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
822
- tmpfs_size : int, optional, default: None
823
- The value for the size (in MiB) of the tmpfs mount for this step.
824
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
825
- memory allocated for this step.
826
- tmpfs_path : str, optional, default /metaflow_temp
827
- Path to tmpfs mount for this step.
828
- persistent_volume_claims : Dict[str, str], optional, default None
829
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
830
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
831
- shared_memory: int, optional
832
- Shared memory size (in MiB) required for this step
833
- port: int, optional
834
- Port number to specify in the Kubernetes job object
835
- compute_pool : str, optional, default None
836
- Compute pool to be used for for this step.
837
- If not specified, any accessible compute pool within the perimeter is used.
756
+ vars : Dict[str, str], default {}
757
+ Dictionary of environment variables to set.
838
758
  """
839
759
  ...
840
760
 
841
761
  @typing.overload
842
- 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]]]:
762
+ 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]]]:
843
763
  """
844
- Specifies a timeout for your step.
845
-
846
- This decorator is useful if this step may hang indefinitely.
764
+ Specifies the resources needed when executing this step.
847
765
 
848
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
849
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
850
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
766
+ Use `@resources` to specify the resource requirements
767
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
851
768
 
852
- Note that all the values specified in parameters are added together so if you specify
853
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
769
+ You can choose the compute layer on the command line by executing e.g.
770
+ ```
771
+ python myflow.py run --with batch
772
+ ```
773
+ or
774
+ ```
775
+ python myflow.py run --with kubernetes
776
+ ```
777
+ which executes the flow on the desired system using the
778
+ requirements specified in `@resources`.
854
779
 
855
780
  Parameters
856
781
  ----------
857
- seconds : int, default 0
858
- Number of seconds to wait prior to timing out.
859
- minutes : int, default 0
860
- Number of minutes to wait prior to timing out.
861
- hours : int, default 0
862
- Number of hours to wait prior to timing out.
782
+ cpu : int, default 1
783
+ Number of CPUs required for this step.
784
+ gpu : int, default 0
785
+ Number of GPUs required for this step.
786
+ disk : int, optional, default None
787
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
788
+ memory : int, default 4096
789
+ Memory size (in MB) required for this step.
790
+ shared_memory : int, optional, default None
791
+ The value for the size (in MiB) of the /dev/shm volume for this step.
792
+ This parameter maps to the `--shm-size` option in Docker.
863
793
  """
864
794
  ...
865
795
 
866
796
  @typing.overload
867
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
797
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
868
798
  ...
869
799
 
870
800
  @typing.overload
871
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
801
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
872
802
  ...
873
803
 
874
- 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):
804
+ 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):
875
805
  """
876
- Specifies a timeout for your step.
877
-
878
- This decorator is useful if this step may hang indefinitely.
806
+ Specifies the resources needed when executing this step.
879
807
 
880
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
881
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
882
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
808
+ Use `@resources` to specify the resource requirements
809
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
883
810
 
884
- Note that all the values specified in parameters are added together so if you specify
885
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
811
+ You can choose the compute layer on the command line by executing e.g.
812
+ ```
813
+ python myflow.py run --with batch
814
+ ```
815
+ or
816
+ ```
817
+ python myflow.py run --with kubernetes
818
+ ```
819
+ which executes the flow on the desired system using the
820
+ requirements specified in `@resources`.
886
821
 
887
822
  Parameters
888
823
  ----------
889
- seconds : int, default 0
890
- Number of seconds to wait prior to timing out.
891
- minutes : int, default 0
892
- Number of minutes to wait prior to timing out.
893
- hours : int, default 0
894
- Number of hours to wait prior to timing out.
824
+ cpu : int, default 1
825
+ Number of CPUs required for this step.
826
+ gpu : int, default 0
827
+ Number of GPUs required for this step.
828
+ disk : int, optional, default None
829
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
830
+ memory : int, default 4096
831
+ Memory size (in MB) required for this step.
832
+ shared_memory : int, optional, default None
833
+ The value for the size (in MiB) of the /dev/shm volume for this step.
834
+ This parameter maps to the `--shm-size` option in Docker.
895
835
  """
896
836
  ...
897
837
 
898
838
  @typing.overload
899
- 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]]]:
839
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
900
840
  """
901
- Specifies the Conda environment for the step.
902
-
903
- Information in this decorator will augment any
904
- attributes set in the `@conda_base` flow-level decorator. Hence,
905
- you can use `@conda_base` to set packages required by all
906
- steps and use `@conda` to specify step-specific overrides.
907
-
908
- Parameters
909
- ----------
910
- packages : Dict[str, str], default {}
911
- Packages to use for this step. The key is the name of the package
912
- and the value is the version to use.
913
- libraries : Dict[str, str], default {}
914
- Supported for backward compatibility. When used with packages, packages will take precedence.
915
- python : str, optional, default None
916
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
917
- that the version used will correspond to the version of the Python interpreter used to start the run.
918
- disabled : bool, default False
919
- If set to True, disables @conda.
841
+ Decorator prototype for all step decorators. This function gets specialized
842
+ and imported for all decorators types by _import_plugin_decorators().
920
843
  """
921
844
  ...
922
845
 
923
846
  @typing.overload
924
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
925
- ...
926
-
927
- @typing.overload
928
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
847
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
929
848
  ...
930
849
 
931
- 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):
850
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
932
851
  """
933
- Specifies the Conda environment for the step.
934
-
935
- Information in this decorator will augment any
936
- attributes set in the `@conda_base` flow-level decorator. Hence,
937
- you can use `@conda_base` to set packages required by all
938
- steps and use `@conda` to specify step-specific overrides.
939
-
940
- Parameters
941
- ----------
942
- packages : Dict[str, str], default {}
943
- Packages to use for this step. The key is the name of the package
944
- and the value is the version to use.
945
- libraries : Dict[str, str], default {}
946
- Supported for backward compatibility. When used with packages, packages will take precedence.
947
- python : str, optional, default None
948
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
949
- that the version used will correspond to the version of the Python interpreter used to start the run.
950
- disabled : bool, default False
951
- If set to True, disables @conda.
852
+ Decorator prototype for all step decorators. This function gets specialized
853
+ and imported for all decorators types by _import_plugin_decorators().
952
854
  """
953
855
  ...
954
856
 
955
857
  @typing.overload
956
- 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]]]:
858
+ 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]]]:
957
859
  """
958
- Creates a human-readable report, a Metaflow Card, after this step completes.
959
-
960
- Note that you may add multiple `@card` decorators in a step with different parameters.
961
-
962
- Parameters
963
- ----------
964
- type : str, default 'default'
965
- Card type.
966
- id : str, optional, default None
967
- If multiple cards are present, use this id to identify this card.
968
- options : Dict[str, Any], default {}
969
- Options passed to the card. The contents depend on the card type.
970
- timeout : int, default 45
971
- Interrupt reporting if it takes more than this many seconds.
972
-
973
-
974
- """
975
- ...
976
-
977
- @typing.overload
978
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
979
- ...
980
-
981
- @typing.overload
982
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
983
- ...
984
-
985
- 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):
986
- """
987
- Creates a human-readable report, a Metaflow Card, after this step completes.
988
-
989
- Note that you may add multiple `@card` decorators in a step with different parameters.
990
-
991
- Parameters
992
- ----------
993
- type : str, default 'default'
994
- Card type.
995
- id : str, optional, default None
996
- If multiple cards are present, use this id to identify this card.
997
- options : Dict[str, Any], default {}
998
- Options passed to the card. The contents depend on the card type.
999
- timeout : int, default 45
1000
- Interrupt reporting if it takes more than this many seconds.
1001
-
1002
-
1003
- """
1004
- ...
1005
-
1006
- @typing.overload
1007
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1008
- """
1009
- Decorator prototype for all step decorators. This function gets specialized
1010
- and imported for all decorators types by _import_plugin_decorators().
1011
- """
1012
- ...
1013
-
1014
- @typing.overload
1015
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1016
- ...
1017
-
1018
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1019
- """
1020
- Decorator prototype for all step decorators. This function gets specialized
1021
- and imported for all decorators types by _import_plugin_decorators().
1022
- """
1023
- ...
1024
-
1025
- @typing.overload
1026
- 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]]]:
1027
- """
1028
- Specifies the number of times the task corresponding
1029
- to a step needs to be retried.
1030
-
1031
- This decorator is useful for handling transient errors, such as networking issues.
1032
- If your task contains operations that can't be retried safely, e.g. database updates,
1033
- it is advisable to annotate it with `@retry(times=0)`.
1034
-
1035
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1036
- decorator will execute a no-op task after all retries have been exhausted,
1037
- ensuring that the flow execution can continue.
1038
-
1039
- Parameters
1040
- ----------
1041
- times : int, default 3
1042
- Number of times to retry this task.
1043
- minutes_between_retries : int, default 2
1044
- Number of minutes between retries.
1045
- """
1046
- ...
1047
-
1048
- @typing.overload
1049
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1050
- ...
1051
-
1052
- @typing.overload
1053
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1054
- ...
1055
-
1056
- 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):
1057
- """
1058
- Specifies the number of times the task corresponding
1059
- to a step needs to be retried.
1060
-
1061
- This decorator is useful for handling transient errors, such as networking issues.
1062
- If your task contains operations that can't be retried safely, e.g. database updates,
1063
- it is advisable to annotate it with `@retry(times=0)`.
1064
-
1065
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1066
- decorator will execute a no-op task after all retries have been exhausted,
1067
- ensuring that the flow execution can continue.
1068
-
1069
- Parameters
1070
- ----------
1071
- times : int, default 3
1072
- Number of times to retry this task.
1073
- minutes_between_retries : int, default 2
1074
- Number of minutes between retries.
1075
- """
1076
- ...
1077
-
1078
- @typing.overload
1079
- def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1080
- """
1081
- Specifies environment variables to be set prior to the execution of a step.
1082
-
1083
- Parameters
1084
- ----------
1085
- vars : Dict[str, str], default {}
1086
- Dictionary of environment variables to set.
1087
- """
1088
- ...
1089
-
1090
- @typing.overload
1091
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1092
- ...
1093
-
1094
- @typing.overload
1095
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1096
- ...
1097
-
1098
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1099
- """
1100
- Specifies environment variables to be set prior to the execution of a step.
1101
-
1102
- Parameters
1103
- ----------
1104
- vars : Dict[str, str], default {}
1105
- Dictionary of environment variables to set.
1106
- """
1107
- ...
1108
-
1109
- @typing.overload
1110
- 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]]]:
1111
- """
1112
- Specifies the resources needed when executing this step.
1113
-
1114
- Use `@resources` to specify the resource requirements
1115
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1116
-
1117
- You can choose the compute layer on the command line by executing e.g.
1118
- ```
1119
- python myflow.py run --with batch
1120
- ```
1121
- or
1122
- ```
1123
- python myflow.py run --with kubernetes
1124
- ```
1125
- which executes the flow on the desired system using the
1126
- requirements specified in `@resources`.
1127
-
1128
- Parameters
1129
- ----------
1130
- cpu : int, default 1
1131
- Number of CPUs required for this step.
1132
- gpu : int, default 0
1133
- Number of GPUs required for this step.
1134
- disk : int, optional, default None
1135
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1136
- memory : int, default 4096
1137
- Memory size (in MB) required for this step.
1138
- shared_memory : int, optional, default None
1139
- The value for the size (in MiB) of the /dev/shm volume for this step.
1140
- This parameter maps to the `--shm-size` option in Docker.
1141
- """
1142
- ...
1143
-
1144
- @typing.overload
1145
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1146
- ...
1147
-
1148
- @typing.overload
1149
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1150
- ...
1151
-
1152
- 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):
1153
- """
1154
- Specifies the resources needed when executing this step.
1155
-
1156
- Use `@resources` to specify the resource requirements
1157
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1158
-
1159
- You can choose the compute layer on the command line by executing e.g.
1160
- ```
1161
- python myflow.py run --with batch
1162
- ```
1163
- or
1164
- ```
1165
- python myflow.py run --with kubernetes
1166
- ```
1167
- which executes the flow on the desired system using the
1168
- requirements specified in `@resources`.
1169
-
1170
- Parameters
1171
- ----------
1172
- cpu : int, default 1
1173
- Number of CPUs required for this step.
1174
- gpu : int, default 0
1175
- Number of GPUs required for this step.
1176
- disk : int, optional, default None
1177
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1178
- memory : int, default 4096
1179
- Memory size (in MB) required for this step.
1180
- shared_memory : int, optional, default None
1181
- The value for the size (in MiB) of the /dev/shm volume for this step.
1182
- This parameter maps to the `--shm-size` option in Docker.
1183
- """
1184
- ...
1185
-
1186
- @typing.overload
1187
- 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]]]:
1188
- """
1189
- Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
860
+ Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
1190
861
 
1191
862
  Parameters
1192
863
  ----------
@@ -1412,45 +1083,488 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
1412
1083
  """
1413
1084
  ...
1414
1085
 
1415
- 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]]:
1086
+ @typing.overload
1087
+ 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]]]:
1416
1088
  """
1417
- 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)
1418
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1419
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1420
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1421
- starts only after all sensors finish.
1089
+ Specifies that the step will success under all circumstances.
1090
+
1091
+ The decorator will create an optional artifact, specified by `var`, which
1092
+ contains the exception raised. You can use it to detect the presence
1093
+ of errors, indicating that all happy-path artifacts produced by the step
1094
+ are missing.
1422
1095
 
1423
1096
  Parameters
1424
1097
  ----------
1425
- timeout : int
1426
- Time, in seconds before the task times out and fails. (Default: 3600)
1427
- poke_interval : int
1428
- Time in seconds that the job should wait in between each try. (Default: 60)
1429
- mode : str
1430
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1431
- exponential_backoff : bool
1432
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1433
- pool : str
1434
- the slot pool this task should run in,
1435
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1436
- soft_fail : bool
1437
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1438
- name : str
1439
- Name of the sensor on Airflow
1440
- description : str
1441
- Description of sensor in the Airflow UI
1442
- bucket_key : Union[str, List[str]]
1443
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1444
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1445
- bucket_name : str
1446
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1447
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1448
- wildcard_match : bool
1449
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1450
- aws_conn_id : str
1451
- a reference to the s3 connection on Airflow. (Default: None)
1452
- verify : bool
1453
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1098
+ var : str, optional, default None
1099
+ Name of the artifact in which to store the caught exception.
1100
+ If not specified, the exception is not stored.
1101
+ print_exception : bool, default True
1102
+ Determines whether or not the exception is printed to
1103
+ stdout when caught.
1104
+ """
1105
+ ...
1106
+
1107
+ @typing.overload
1108
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1109
+ ...
1110
+
1111
+ @typing.overload
1112
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1113
+ ...
1114
+
1115
+ 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):
1116
+ """
1117
+ Specifies that the step will success under all circumstances.
1118
+
1119
+ The decorator will create an optional artifact, specified by `var`, which
1120
+ contains the exception raised. You can use it to detect the presence
1121
+ of errors, indicating that all happy-path artifacts produced by the step
1122
+ are missing.
1123
+
1124
+ Parameters
1125
+ ----------
1126
+ var : str, optional, default None
1127
+ Name of the artifact in which to store the caught exception.
1128
+ If not specified, the exception is not stored.
1129
+ print_exception : bool, default True
1130
+ Determines whether or not the exception is printed to
1131
+ stdout when caught.
1132
+ """
1133
+ ...
1134
+
1135
+ @typing.overload
1136
+ 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]]]:
1137
+ """
1138
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1139
+
1140
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1141
+
1142
+ Parameters
1143
+ ----------
1144
+ type : str, default 'default'
1145
+ Card type.
1146
+ id : str, optional, default None
1147
+ If multiple cards are present, use this id to identify this card.
1148
+ options : Dict[str, Any], default {}
1149
+ Options passed to the card. The contents depend on the card type.
1150
+ timeout : int, default 45
1151
+ Interrupt reporting if it takes more than this many seconds.
1152
+
1153
+
1154
+ """
1155
+ ...
1156
+
1157
+ @typing.overload
1158
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1159
+ ...
1160
+
1161
+ @typing.overload
1162
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1163
+ ...
1164
+
1165
+ 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):
1166
+ """
1167
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1168
+
1169
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1170
+
1171
+ Parameters
1172
+ ----------
1173
+ type : str, default 'default'
1174
+ Card type.
1175
+ id : str, optional, default None
1176
+ If multiple cards are present, use this id to identify this card.
1177
+ options : Dict[str, Any], default {}
1178
+ Options passed to the card. The contents depend on the card type.
1179
+ timeout : int, default 45
1180
+ Interrupt reporting if it takes more than this many seconds.
1181
+
1182
+
1183
+ """
1184
+ ...
1185
+
1186
+ @typing.overload
1187
+ 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]]]:
1188
+ """
1189
+ Specifies a timeout for your step.
1190
+
1191
+ This decorator is useful if this step may hang indefinitely.
1192
+
1193
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1194
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1195
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1196
+
1197
+ Note that all the values specified in parameters are added together so if you specify
1198
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1199
+
1200
+ Parameters
1201
+ ----------
1202
+ seconds : int, default 0
1203
+ Number of seconds to wait prior to timing out.
1204
+ minutes : int, default 0
1205
+ Number of minutes to wait prior to timing out.
1206
+ hours : int, default 0
1207
+ Number of hours to wait prior to timing out.
1208
+ """
1209
+ ...
1210
+
1211
+ @typing.overload
1212
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1213
+ ...
1214
+
1215
+ @typing.overload
1216
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1217
+ ...
1218
+
1219
+ 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):
1220
+ """
1221
+ Specifies a timeout for your step.
1222
+
1223
+ This decorator is useful if this step may hang indefinitely.
1224
+
1225
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1226
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1227
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1228
+
1229
+ Note that all the values specified in parameters are added together so if you specify
1230
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1231
+
1232
+ Parameters
1233
+ ----------
1234
+ seconds : int, default 0
1235
+ Number of seconds to wait prior to timing out.
1236
+ minutes : int, default 0
1237
+ Number of minutes to wait prior to timing out.
1238
+ hours : int, default 0
1239
+ Number of hours to wait prior to timing out.
1240
+ """
1241
+ ...
1242
+
1243
+ @typing.overload
1244
+ 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]]]:
1245
+ """
1246
+ Specifies the Conda environment for the step.
1247
+
1248
+ Information in this decorator will augment any
1249
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1250
+ you can use `@conda_base` to set packages required by all
1251
+ steps and use `@conda` to specify step-specific overrides.
1252
+
1253
+ Parameters
1254
+ ----------
1255
+ packages : Dict[str, str], default {}
1256
+ Packages to use for this step. The key is the name of the package
1257
+ and the value is the version to use.
1258
+ libraries : Dict[str, str], default {}
1259
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1260
+ python : str, optional, default None
1261
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1262
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1263
+ disabled : bool, default False
1264
+ If set to True, disables @conda.
1265
+ """
1266
+ ...
1267
+
1268
+ @typing.overload
1269
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1270
+ ...
1271
+
1272
+ @typing.overload
1273
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1274
+ ...
1275
+
1276
+ 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):
1277
+ """
1278
+ Specifies the Conda environment for the step.
1279
+
1280
+ Information in this decorator will augment any
1281
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1282
+ you can use `@conda_base` to set packages required by all
1283
+ steps and use `@conda` to specify step-specific overrides.
1284
+
1285
+ Parameters
1286
+ ----------
1287
+ packages : Dict[str, str], default {}
1288
+ Packages to use for this step. The key is the name of the package
1289
+ and the value is the version to use.
1290
+ libraries : Dict[str, str], default {}
1291
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1292
+ python : str, optional, default None
1293
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1294
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1295
+ disabled : bool, default False
1296
+ If set to True, disables @conda.
1297
+ """
1298
+ ...
1299
+
1300
+ 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, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1301
+ """
1302
+ Specifies that this step should execute on Kubernetes.
1303
+
1304
+ Parameters
1305
+ ----------
1306
+ cpu : int, default 1
1307
+ Number of CPUs required for this step. If `@resources` is
1308
+ also present, the maximum value from all decorators is used.
1309
+ memory : int, default 4096
1310
+ Memory size (in MB) required for this step. If
1311
+ `@resources` is also present, the maximum value from all decorators is
1312
+ used.
1313
+ disk : int, default 10240
1314
+ Disk size (in MB) required for this step. If
1315
+ `@resources` is also present, the maximum value from all decorators is
1316
+ used.
1317
+ image : str, optional, default None
1318
+ Docker image to use when launching on Kubernetes. If not specified, and
1319
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
1320
+ not, a default Docker image mapping to the current version of Python is used.
1321
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
1322
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
1323
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
1324
+ Kubernetes service account to use when launching pod in Kubernetes.
1325
+ secrets : List[str], optional, default None
1326
+ Kubernetes secrets to use when launching pod in Kubernetes. These
1327
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
1328
+ in Metaflow configuration.
1329
+ node_selector: Union[Dict[str,str], str], optional, default None
1330
+ Kubernetes node selector(s) to apply to the pod running the task.
1331
+ Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
1332
+ or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
1333
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
1334
+ Kubernetes namespace to use when launching pod in Kubernetes.
1335
+ gpu : int, optional, default None
1336
+ Number of GPUs required for this step. A value of zero implies that
1337
+ the scheduled node should not have GPUs.
1338
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
1339
+ The vendor of the GPUs to be used for this step.
1340
+ tolerations : List[str], default []
1341
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
1342
+ Kubernetes tolerations to use when launching pod in Kubernetes.
1343
+ use_tmpfs : bool, default False
1344
+ This enables an explicit tmpfs mount for this step.
1345
+ tmpfs_tempdir : bool, default True
1346
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1347
+ tmpfs_size : int, optional, default: None
1348
+ The value for the size (in MiB) of the tmpfs mount for this step.
1349
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1350
+ memory allocated for this step.
1351
+ tmpfs_path : str, optional, default /metaflow_temp
1352
+ Path to tmpfs mount for this step.
1353
+ persistent_volume_claims : Dict[str, str], optional, default None
1354
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
1355
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
1356
+ shared_memory: int, optional
1357
+ Shared memory size (in MiB) required for this step
1358
+ port: int, optional
1359
+ Port number to specify in the Kubernetes job object
1360
+ compute_pool : str, optional, default None
1361
+ Compute pool to be used for for this step.
1362
+ If not specified, any accessible compute pool within the perimeter is used.
1363
+ """
1364
+ ...
1365
+
1366
+ @typing.overload
1367
+ 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]]]:
1368
+ """
1369
+ Specifies the number of times the task corresponding
1370
+ to a step needs to be retried.
1371
+
1372
+ This decorator is useful for handling transient errors, such as networking issues.
1373
+ If your task contains operations that can't be retried safely, e.g. database updates,
1374
+ it is advisable to annotate it with `@retry(times=0)`.
1375
+
1376
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1377
+ decorator will execute a no-op task after all retries have been exhausted,
1378
+ ensuring that the flow execution can continue.
1379
+
1380
+ Parameters
1381
+ ----------
1382
+ times : int, default 3
1383
+ Number of times to retry this task.
1384
+ minutes_between_retries : int, default 2
1385
+ Number of minutes between retries.
1386
+ """
1387
+ ...
1388
+
1389
+ @typing.overload
1390
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1391
+ ...
1392
+
1393
+ @typing.overload
1394
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1395
+ ...
1396
+
1397
+ 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):
1398
+ """
1399
+ Specifies the number of times the task corresponding
1400
+ to a step needs to be retried.
1401
+
1402
+ This decorator is useful for handling transient errors, such as networking issues.
1403
+ If your task contains operations that can't be retried safely, e.g. database updates,
1404
+ it is advisable to annotate it with `@retry(times=0)`.
1405
+
1406
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1407
+ decorator will execute a no-op task after all retries have been exhausted,
1408
+ ensuring that the flow execution can continue.
1409
+
1410
+ Parameters
1411
+ ----------
1412
+ times : int, default 3
1413
+ Number of times to retry this task.
1414
+ minutes_between_retries : int, default 2
1415
+ Number of minutes between retries.
1416
+ """
1417
+ ...
1418
+
1419
+ @typing.overload
1420
+ def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, 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]]:
1421
+ """
1422
+ Specifies the flow(s) that this flow depends on.
1423
+
1424
+ ```
1425
+ @trigger_on_finish(flow='FooFlow')
1426
+ ```
1427
+ or
1428
+ ```
1429
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1430
+ ```
1431
+ This decorator respects the @project decorator and triggers the flow
1432
+ when upstream runs within the same namespace complete successfully
1433
+
1434
+ Additionally, you can specify project aware upstream flow dependencies
1435
+ by specifying the fully qualified project_flow_name.
1436
+ ```
1437
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1438
+ ```
1439
+ or
1440
+ ```
1441
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1442
+ ```
1443
+
1444
+ You can also specify just the project or project branch (other values will be
1445
+ inferred from the current project or project branch):
1446
+ ```
1447
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1448
+ ```
1449
+
1450
+ Note that `branch` is typically one of:
1451
+ - `prod`
1452
+ - `user.bob`
1453
+ - `test.my_experiment`
1454
+ - `prod.staging`
1455
+
1456
+ Parameters
1457
+ ----------
1458
+ flow : Union[str, Dict[str, str]], optional, default None
1459
+ Upstream flow dependency for this flow.
1460
+ flows : List[Union[str, Dict[str, str]]], default []
1461
+ Upstream flow dependencies for this flow.
1462
+ options : Dict[str, Any], default {}
1463
+ Backend-specific configuration for tuning eventing behavior.
1464
+
1465
+
1466
+ """
1467
+ ...
1468
+
1469
+ @typing.overload
1470
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1471
+ ...
1472
+
1473
+ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
1474
+ """
1475
+ Specifies the flow(s) that this flow depends on.
1476
+
1477
+ ```
1478
+ @trigger_on_finish(flow='FooFlow')
1479
+ ```
1480
+ or
1481
+ ```
1482
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1483
+ ```
1484
+ This decorator respects the @project decorator and triggers the flow
1485
+ when upstream runs within the same namespace complete successfully
1486
+
1487
+ Additionally, you can specify project aware upstream flow dependencies
1488
+ by specifying the fully qualified project_flow_name.
1489
+ ```
1490
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1491
+ ```
1492
+ or
1493
+ ```
1494
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1495
+ ```
1496
+
1497
+ You can also specify just the project or project branch (other values will be
1498
+ inferred from the current project or project branch):
1499
+ ```
1500
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1501
+ ```
1502
+
1503
+ Note that `branch` is typically one of:
1504
+ - `prod`
1505
+ - `user.bob`
1506
+ - `test.my_experiment`
1507
+ - `prod.staging`
1508
+
1509
+ Parameters
1510
+ ----------
1511
+ flow : Union[str, Dict[str, str]], optional, default None
1512
+ Upstream flow dependency for this flow.
1513
+ flows : List[Union[str, Dict[str, str]]], default []
1514
+ Upstream flow dependencies for this flow.
1515
+ options : Dict[str, Any], default {}
1516
+ Backend-specific configuration for tuning eventing behavior.
1517
+
1518
+
1519
+ """
1520
+ ...
1521
+
1522
+ @typing.overload
1523
+ 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]]:
1524
+ """
1525
+ Specifies the Conda environment for all steps of the flow.
1526
+
1527
+ Use `@conda_base` to set common libraries required by all
1528
+ steps and use `@conda` to specify step-specific additions.
1529
+
1530
+ Parameters
1531
+ ----------
1532
+ packages : Dict[str, str], default {}
1533
+ Packages to use for this flow. The key is the name of the package
1534
+ and the value is the version to use.
1535
+ libraries : Dict[str, str], default {}
1536
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1537
+ python : str, optional, default None
1538
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1539
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1540
+ disabled : bool, default False
1541
+ If set to True, disables Conda.
1542
+ """
1543
+ ...
1544
+
1545
+ @typing.overload
1546
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1547
+ ...
1548
+
1549
+ 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):
1550
+ """
1551
+ Specifies the Conda environment for all steps of the flow.
1552
+
1553
+ Use `@conda_base` to set common libraries required by all
1554
+ steps and use `@conda` to specify step-specific additions.
1555
+
1556
+ Parameters
1557
+ ----------
1558
+ packages : Dict[str, str], default {}
1559
+ Packages to use for this flow. The key is the name of the package
1560
+ and the value is the version to use.
1561
+ libraries : Dict[str, str], default {}
1562
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1563
+ python : str, optional, default None
1564
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1565
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1566
+ disabled : bool, default False
1567
+ If set to True, disables Conda.
1454
1568
  """
1455
1569
  ...
1456
1570
 
@@ -1606,109 +1720,6 @@ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typ
1606
1720
  """
1607
1721
  ...
1608
1722
 
1609
- @typing.overload
1610
- 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]]:
1611
- """
1612
- Specifies the flow(s) that this flow depends on.
1613
-
1614
- ```
1615
- @trigger_on_finish(flow='FooFlow')
1616
- ```
1617
- or
1618
- ```
1619
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1620
- ```
1621
- This decorator respects the @project decorator and triggers the flow
1622
- when upstream runs within the same namespace complete successfully
1623
-
1624
- Additionally, you can specify project aware upstream flow dependencies
1625
- by specifying the fully qualified project_flow_name.
1626
- ```
1627
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1628
- ```
1629
- or
1630
- ```
1631
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1632
- ```
1633
-
1634
- You can also specify just the project or project branch (other values will be
1635
- inferred from the current project or project branch):
1636
- ```
1637
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1638
- ```
1639
-
1640
- Note that `branch` is typically one of:
1641
- - `prod`
1642
- - `user.bob`
1643
- - `test.my_experiment`
1644
- - `prod.staging`
1645
-
1646
- Parameters
1647
- ----------
1648
- flow : Union[str, Dict[str, str]], optional, default None
1649
- Upstream flow dependency for this flow.
1650
- flows : List[Union[str, Dict[str, str]]], default []
1651
- Upstream flow dependencies for this flow.
1652
- options : Dict[str, Any], default {}
1653
- Backend-specific configuration for tuning eventing behavior.
1654
-
1655
-
1656
- """
1657
- ...
1658
-
1659
- @typing.overload
1660
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1661
- ...
1662
-
1663
- 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] = {}):
1664
- """
1665
- Specifies the flow(s) that this flow depends on.
1666
-
1667
- ```
1668
- @trigger_on_finish(flow='FooFlow')
1669
- ```
1670
- or
1671
- ```
1672
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1673
- ```
1674
- This decorator respects the @project decorator and triggers the flow
1675
- when upstream runs within the same namespace complete successfully
1676
-
1677
- Additionally, you can specify project aware upstream flow dependencies
1678
- by specifying the fully qualified project_flow_name.
1679
- ```
1680
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1681
- ```
1682
- or
1683
- ```
1684
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1685
- ```
1686
-
1687
- You can also specify just the project or project branch (other values will be
1688
- inferred from the current project or project branch):
1689
- ```
1690
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1691
- ```
1692
-
1693
- Note that `branch` is typically one of:
1694
- - `prod`
1695
- - `user.bob`
1696
- - `test.my_experiment`
1697
- - `prod.staging`
1698
-
1699
- Parameters
1700
- ----------
1701
- flow : Union[str, Dict[str, str]], optional, default None
1702
- Upstream flow dependency for this flow.
1703
- flows : List[Union[str, Dict[str, str]]], default []
1704
- Upstream flow dependencies for this flow.
1705
- options : Dict[str, Any], default {}
1706
- Backend-specific configuration for tuning eventing behavior.
1707
-
1708
-
1709
- """
1710
- ...
1711
-
1712
1723
  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]]:
1713
1724
  """
1714
1725
  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.
@@ -1751,52 +1762,45 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1751
1762
  """
1752
1763
  ...
1753
1764
 
1754
- @typing.overload
1755
- 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]]:
1756
- """
1757
- Specifies the Conda environment for all steps of the flow.
1758
-
1759
- Use `@conda_base` to set common libraries required by all
1760
- steps and use `@conda` to specify step-specific additions.
1761
-
1762
- Parameters
1763
- ----------
1764
- packages : Dict[str, str], default {}
1765
- Packages to use for this flow. The key is the name of the package
1766
- and the value is the version to use.
1767
- libraries : Dict[str, str], default {}
1768
- Supported for backward compatibility. When used with packages, packages will take precedence.
1769
- python : str, optional, default None
1770
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1771
- that the version used will correspond to the version of the Python interpreter used to start the run.
1772
- disabled : bool, default False
1773
- If set to True, disables Conda.
1774
- """
1775
- ...
1776
-
1777
- @typing.overload
1778
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1779
- ...
1780
-
1781
- 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):
1765
+ 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]]:
1782
1766
  """
1783
- Specifies the Conda environment for all steps of the flow.
1784
-
1785
- Use `@conda_base` to set common libraries required by all
1786
- steps and use `@conda` to specify step-specific additions.
1767
+ 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)
1768
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1769
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1770
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1771
+ starts only after all sensors finish.
1787
1772
 
1788
1773
  Parameters
1789
1774
  ----------
1790
- packages : Dict[str, str], default {}
1791
- Packages to use for this flow. The key is the name of the package
1792
- and the value is the version to use.
1793
- libraries : Dict[str, str], default {}
1794
- Supported for backward compatibility. When used with packages, packages will take precedence.
1795
- python : str, optional, default None
1796
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1797
- that the version used will correspond to the version of the Python interpreter used to start the run.
1798
- disabled : bool, default False
1799
- If set to True, disables Conda.
1775
+ timeout : int
1776
+ Time, in seconds before the task times out and fails. (Default: 3600)
1777
+ poke_interval : int
1778
+ Time in seconds that the job should wait in between each try. (Default: 60)
1779
+ mode : str
1780
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1781
+ exponential_backoff : bool
1782
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1783
+ pool : str
1784
+ the slot pool this task should run in,
1785
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1786
+ soft_fail : bool
1787
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1788
+ name : str
1789
+ Name of the sensor on Airflow
1790
+ description : str
1791
+ Description of sensor in the Airflow UI
1792
+ bucket_key : Union[str, List[str]]
1793
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1794
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1795
+ bucket_name : str
1796
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1797
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1798
+ wildcard_match : bool
1799
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1800
+ aws_conn_id : str
1801
+ a reference to the s3 connection on Airflow. (Default: None)
1802
+ verify : bool
1803
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1800
1804
  """
1801
1805
  ...
1802
1806