metaflow-stubs 2.11.14__py2.py3-none-any.whl → 2.11.16__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 (138) hide show
  1. metaflow-stubs/__init__.pyi +475 -475
  2. metaflow-stubs/cards.pyi +5 -5
  3. metaflow-stubs/cli.pyi +2 -2
  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 +3 -3
  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 +14 -2
  16. metaflow-stubs/metaflow_current.pyi +5 -5
  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 +11 -3
  21. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  22. metaflow-stubs/plugins/airflow/airflow.pyi +11 -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 +3 -3
  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 +4 -2
  33. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  34. metaflow-stubs/plugins/argo/argo_workflows.pyi +7 -3
  35. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +4 -4
  36. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
  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 +6 -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 +2 -2
  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 +5 -2
  57. metaflow-stubs/plugins/azure/azure_credential.pyi +28 -0
  58. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +58 -0
  60. metaflow-stubs/plugins/azure/azure_utils.pyi +5 -5
  61. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +5 -5
  62. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  63. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  64. metaflow-stubs/plugins/cards/card_cli.pyi +4 -4
  65. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  66. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  67. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
  69. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  71. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
  73. metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
  74. metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
  77. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  78. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  79. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  80. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +3 -3
  81. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  82. metaflow-stubs/plugins/cards/component_serializer.pyi +3 -3
  83. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  84. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  85. metaflow-stubs/plugins/datatools/__init__.pyi +4 -4
  86. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  87. metaflow-stubs/plugins/datatools/s3/__init__.pyi +4 -4
  88. metaflow-stubs/plugins/datatools/s3/s3.pyi +9 -6
  89. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  90. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  91. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  92. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  93. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  94. metaflow-stubs/plugins/events_decorator.pyi +3 -3
  95. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  96. metaflow-stubs/plugins/frameworks/pytorch.pyi +3 -3
  97. metaflow-stubs/plugins/gcp/__init__.pyi +5 -2
  98. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +73 -0
  99. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  100. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +16 -2
  101. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  102. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  103. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  104. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +15 -3
  105. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +16 -5
  106. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +13 -2
  107. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +22 -3
  108. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +15 -2
  109. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +127 -0
  110. metaflow-stubs/plugins/logs_cli.pyi +45 -0
  111. metaflow-stubs/plugins/package_cli.pyi +2 -2
  112. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  113. metaflow-stubs/plugins/project_decorator.pyi +3 -3
  114. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  115. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  116. metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
  117. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  118. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  119. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  120. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  121. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  122. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  123. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  124. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  125. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  126. metaflow-stubs/plugins/tag_cli.pyi +3 -3
  127. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  128. metaflow-stubs/plugins/timeout_decorator.pyi +5 -3
  129. metaflow-stubs/procpoll.pyi +2 -2
  130. metaflow-stubs/pylint_wrapper.pyi +2 -2
  131. metaflow-stubs/tagging_util.pyi +2 -2
  132. metaflow-stubs/tuple_util.pyi +14 -0
  133. metaflow-stubs/version.pyi +2 -2
  134. {metaflow_stubs-2.11.14.dist-info → metaflow_stubs-2.11.16.dist-info}/METADATA +2 -2
  135. metaflow_stubs-2.11.16.dist-info/RECORD +138 -0
  136. metaflow_stubs-2.11.14.dist-info/RECORD +0 -132
  137. {metaflow_stubs-2.11.14.dist-info → metaflow_stubs-2.11.16.dist-info}/WHEEL +0 -0
  138. {metaflow_stubs-2.11.14.dist-info → metaflow_stubs-2.11.16.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.14 #
4
- # Generated on 2024-05-06T23:56:19.351151 #
3
+ # MF version: 2.11.16 #
4
+ # Generated on 2024-05-22T00:31:19.988196 #
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 metaflow.datastore.inputs
11
+ import metaflow._vendor.click.types
13
12
  import metaflow.plugins.datatools.s3.s3
13
+ import metaflow.events
14
+ import metaflow.datastore.inputs
15
+ import typing
14
16
  import datetime
15
- import metaflow.parameters
16
17
  import metaflow.client.core
17
18
  import io
18
- import metaflow._vendor.click.types
19
- import metaflow.events
20
- import typing
19
+ import metaflow.metaflow_current
20
+ import metaflow.parameters
21
21
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
22
22
  StepFlag = typing.NewType("StepFlag", bool)
23
23
 
@@ -725,119 +725,131 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
725
725
  """
726
726
  ...
727
727
 
728
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
728
+ @typing.overload
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]]]:
729
730
  """
730
- Specifies that this step should execute on Kubernetes.
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`.
731
746
 
732
747
  Parameters
733
748
  ----------
734
749
  cpu : int, default 1
735
- Number of CPUs required for this step. If `@resources` is
736
- also present, the maximum value from all decorators is used.
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.
737
755
  memory : int, default 4096
738
- Memory size (in MB) required for this step. If
739
- `@resources` is also present, the maximum value from all decorators is
740
- used.
741
- disk : int, default 10240
742
- Disk size (in MB) required for this step. If
743
- `@resources` is also present, the maximum value from all decorators is
744
- used.
745
- image : str, optional, default None
746
- Docker image to use when launching on Kubernetes. If not specified, and
747
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
748
- not, a default Docker image mapping to the current version of Python is used.
749
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
750
- If given, the imagePullPolicy to be applied to the Docker image of the step.
751
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
752
- Kubernetes service account to use when launching pod in Kubernetes.
753
- secrets : List[str], optional, default None
754
- Kubernetes secrets to use when launching pod in Kubernetes. These
755
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
756
- in Metaflow configuration.
757
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
758
- Kubernetes namespace to use when launching pod in Kubernetes.
759
- gpu : int, optional, default None
760
- Number of GPUs required for this step. A value of zero implies that
761
- the scheduled node should not have GPUs.
762
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
763
- The vendor of the GPUs to be used for this step.
764
- tolerations : List[str], default []
765
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
766
- Kubernetes tolerations to use when launching pod in Kubernetes.
767
- use_tmpfs : bool, default False
768
- This enables an explicit tmpfs mount for this step.
769
- tmpfs_tempdir : bool, default True
770
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
771
- tmpfs_size : int, optional, default: None
772
- The value for the size (in MiB) of the tmpfs mount for this step.
773
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
774
- memory allocated for this step.
775
- tmpfs_path : str, optional, default /metaflow_temp
776
- Path to tmpfs mount for this step.
777
- persistent_volume_claims : Dict[str, str], optional, default None
778
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
779
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
780
- shared_memory: int, optional
781
- Shared memory size (in MiB) required for this step
782
- port: int, optional
783
- Port number to specify in the Kubernetes job object
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.
784
760
  """
785
761
  ...
786
762
 
787
763
  @typing.overload
788
- 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]]]:
764
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
765
+ ...
766
+
767
+ @typing.overload
768
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
769
+ ...
770
+
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):
789
772
  """
790
- Specifies a timeout for your step.
773
+ Specifies the resources needed when executing this step.
791
774
 
792
- This decorator is useful if this step may hang indefinitely.
775
+ Use `@resources` to specify the resource requirements
776
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
793
777
 
794
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
795
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
796
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
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`.
797
788
 
798
- Note that all the values specified in parameters are added together so if you specify
799
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
789
+ Parameters
790
+ ----------
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.
802
+ """
803
+ ...
804
+
805
+ @typing.overload
806
+ 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]]]:
807
+ """
808
+ Creates a human-readable report, a Metaflow Card, after this step completes.
809
+
810
+ Note that you may add multiple `@card` decorators in a step with different parameters.
800
811
 
801
812
  Parameters
802
813
  ----------
803
- seconds : int, default 0
804
- Number of seconds to wait prior to timing out.
805
- minutes : int, default 0
806
- Number of minutes to wait prior to timing out.
807
- hours : int, default 0
808
- Number of hours to wait prior to timing out.
814
+ type : str, default 'default'
815
+ Card type.
816
+ id : str, optional, default None
817
+ If multiple cards are present, use this id to identify this card.
818
+ options : Dict[str, Any], default {}
819
+ Options passed to the card. The contents depend on the card type.
820
+ timeout : int, default 45
821
+ Interrupt reporting if it takes more than this many seconds.
822
+
823
+
809
824
  """
810
825
  ...
811
826
 
812
827
  @typing.overload
813
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
828
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
814
829
  ...
815
830
 
816
831
  @typing.overload
817
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
832
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
818
833
  ...
819
834
 
820
- 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):
835
+ 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):
821
836
  """
822
- Specifies a timeout for your step.
823
-
824
- This decorator is useful if this step may hang indefinitely.
825
-
826
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
827
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
828
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
837
+ Creates a human-readable report, a Metaflow Card, after this step completes.
829
838
 
830
- Note that all the values specified in parameters are added together so if you specify
831
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
839
+ Note that you may add multiple `@card` decorators in a step with different parameters.
832
840
 
833
841
  Parameters
834
842
  ----------
835
- seconds : int, default 0
836
- Number of seconds to wait prior to timing out.
837
- minutes : int, default 0
838
- Number of minutes to wait prior to timing out.
839
- hours : int, default 0
840
- Number of hours to wait prior to timing out.
843
+ type : str, default 'default'
844
+ Card type.
845
+ id : str, optional, default None
846
+ If multiple cards are present, use this id to identify this card.
847
+ options : Dict[str, Any], default {}
848
+ Options passed to the card. The contents depend on the card type.
849
+ timeout : int, default 45
850
+ Interrupt reporting if it takes more than this many seconds.
851
+
852
+
841
853
  """
842
854
  ...
843
855
 
@@ -988,113 +1000,228 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
988
1000
  """
989
1001
  ...
990
1002
 
991
- @typing.overload
992
- 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]]]:
1003
+ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
993
1004
  """
994
- Specifies secrets to be retrieved and injected as environment variables prior to
995
- the execution of a step.
1005
+ Specifies that this step should execute on Kubernetes.
996
1006
 
997
1007
  Parameters
998
1008
  ----------
999
- sources : List[Union[str, Dict[str, Any]]], default: []
1000
- List of secret specs, defining how the secrets are to be retrieved
1009
+ cpu : int, default 1
1010
+ Number of CPUs required for this step. If `@resources` is
1011
+ also present, the maximum value from all decorators is used.
1012
+ memory : int, default 4096
1013
+ Memory size (in MB) required for this step. If
1014
+ `@resources` is also present, the maximum value from all decorators is
1015
+ used.
1016
+ disk : int, default 10240
1017
+ Disk size (in MB) required for this step. If
1018
+ `@resources` is also present, the maximum value from all decorators is
1019
+ used.
1020
+ image : str, optional, default None
1021
+ Docker image to use when launching on Kubernetes. If not specified, and
1022
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
1023
+ not, a default Docker image mapping to the current version of Python is used.
1024
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
1025
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
1026
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
1027
+ Kubernetes service account to use when launching pod in Kubernetes.
1028
+ secrets : List[str], optional, default None
1029
+ Kubernetes secrets to use when launching pod in Kubernetes. These
1030
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
1031
+ in Metaflow configuration.
1032
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
1033
+ Kubernetes namespace to use when launching pod in Kubernetes.
1034
+ gpu : int, optional, default None
1035
+ Number of GPUs required for this step. A value of zero implies that
1036
+ the scheduled node should not have GPUs.
1037
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
1038
+ The vendor of the GPUs to be used for this step.
1039
+ tolerations : List[str], default []
1040
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
1041
+ Kubernetes tolerations to use when launching pod in Kubernetes.
1042
+ use_tmpfs : bool, default False
1043
+ This enables an explicit tmpfs mount for this step.
1044
+ tmpfs_tempdir : bool, default True
1045
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1046
+ tmpfs_size : int, optional, default: None
1047
+ The value for the size (in MiB) of the tmpfs mount for this step.
1048
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1049
+ memory allocated for this step.
1050
+ tmpfs_path : str, optional, default /metaflow_temp
1051
+ Path to tmpfs mount for this step.
1052
+ persistent_volume_claims : Dict[str, str], optional, default None
1053
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
1054
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
1055
+ shared_memory: int, optional
1056
+ Shared memory size (in MiB) required for this step
1057
+ port: int, optional
1058
+ Port number to specify in the Kubernetes job object
1001
1059
  """
1002
1060
  ...
1003
1061
 
1004
1062
  @typing.overload
1005
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1063
+ 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]]]:
1064
+ """
1065
+ Specifies environment variables to be set prior to the execution of a step.
1066
+
1067
+ Parameters
1068
+ ----------
1069
+ vars : Dict[str, str], default {}
1070
+ Dictionary of environment variables to set.
1071
+ """
1006
1072
  ...
1007
1073
 
1008
1074
  @typing.overload
1009
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1075
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1010
1076
  ...
1011
1077
 
1012
- 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]]] = []):
1078
+ @typing.overload
1079
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1080
+ ...
1081
+
1082
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1013
1083
  """
1014
- Specifies secrets to be retrieved and injected as environment variables prior to
1015
- the execution of a step.
1084
+ Specifies environment variables to be set prior to the execution of a step.
1016
1085
 
1017
1086
  Parameters
1018
1087
  ----------
1019
- sources : List[Union[str, Dict[str, Any]]], default: []
1020
- List of secret specs, defining how the secrets are to be retrieved
1088
+ vars : Dict[str, str], default {}
1089
+ Dictionary of environment variables to set.
1021
1090
  """
1022
1091
  ...
1023
1092
 
1024
1093
  @typing.overload
1025
- 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]]]:
1094
+ 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]]]:
1026
1095
  """
1027
- Specifies the resources needed when executing this step.
1096
+ Specifies that the step will success under all circumstances.
1028
1097
 
1029
- Use `@resources` to specify the resource requirements
1030
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1098
+ The decorator will create an optional artifact, specified by `var`, which
1099
+ contains the exception raised. You can use it to detect the presence
1100
+ of errors, indicating that all happy-path artifacts produced by the step
1101
+ are missing.
1031
1102
 
1032
- You can choose the compute layer on the command line by executing e.g.
1033
- ```
1034
- python myflow.py run --with batch
1035
- ```
1036
- or
1037
- ```
1038
- python myflow.py run --with kubernetes
1039
- ```
1040
- which executes the flow on the desired system using the
1041
- requirements specified in `@resources`.
1103
+ Parameters
1104
+ ----------
1105
+ var : str, optional, default None
1106
+ Name of the artifact in which to store the caught exception.
1107
+ If not specified, the exception is not stored.
1108
+ print_exception : bool, default True
1109
+ Determines whether or not the exception is printed to
1110
+ stdout when caught.
1111
+ """
1112
+ ...
1113
+
1114
+ @typing.overload
1115
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1116
+ ...
1117
+
1118
+ @typing.overload
1119
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1120
+ ...
1121
+
1122
+ 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):
1123
+ """
1124
+ Specifies that the step will success under all circumstances.
1125
+
1126
+ The decorator will create an optional artifact, specified by `var`, which
1127
+ contains the exception raised. You can use it to detect the presence
1128
+ of errors, indicating that all happy-path artifacts produced by the step
1129
+ are missing.
1042
1130
 
1043
1131
  Parameters
1044
1132
  ----------
1045
- cpu : int, default 1
1046
- Number of CPUs required for this step.
1047
- gpu : int, default 0
1048
- Number of GPUs required for this step.
1049
- disk : int, optional, default None
1050
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1051
- memory : int, default 4096
1052
- Memory size (in MB) required for this step.
1053
- shared_memory : int, optional, default None
1054
- The value for the size (in MiB) of the /dev/shm volume for this step.
1055
- This parameter maps to the `--shm-size` option in Docker.
1133
+ var : str, optional, default None
1134
+ Name of the artifact in which to store the caught exception.
1135
+ If not specified, the exception is not stored.
1136
+ print_exception : bool, default True
1137
+ Determines whether or not the exception is printed to
1138
+ stdout when caught.
1056
1139
  """
1057
1140
  ...
1058
1141
 
1059
1142
  @typing.overload
1060
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1143
+ 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]]]:
1144
+ """
1145
+ Specifies the number of times the task corresponding
1146
+ to a step needs to be retried.
1147
+
1148
+ This decorator is useful for handling transient errors, such as networking issues.
1149
+ If your task contains operations that can't be retried safely, e.g. database updates,
1150
+ it is advisable to annotate it with `@retry(times=0)`.
1151
+
1152
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1153
+ decorator will execute a no-op task after all retries have been exhausted,
1154
+ ensuring that the flow execution can continue.
1155
+
1156
+ Parameters
1157
+ ----------
1158
+ times : int, default 3
1159
+ Number of times to retry this task.
1160
+ minutes_between_retries : int, default 2
1161
+ Number of minutes between retries.
1162
+ """
1061
1163
  ...
1062
1164
 
1063
1165
  @typing.overload
1064
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1166
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1065
1167
  ...
1066
1168
 
1067
- 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):
1169
+ @typing.overload
1170
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1171
+ ...
1172
+
1173
+ 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):
1068
1174
  """
1069
- Specifies the resources needed when executing this step.
1175
+ Specifies the number of times the task corresponding
1176
+ to a step needs to be retried.
1070
1177
 
1071
- Use `@resources` to specify the resource requirements
1072
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1178
+ This decorator is useful for handling transient errors, such as networking issues.
1179
+ If your task contains operations that can't be retried safely, e.g. database updates,
1180
+ it is advisable to annotate it with `@retry(times=0)`.
1073
1181
 
1074
- You can choose the compute layer on the command line by executing e.g.
1075
- ```
1076
- python myflow.py run --with batch
1077
- ```
1078
- or
1079
- ```
1080
- python myflow.py run --with kubernetes
1081
- ```
1082
- which executes the flow on the desired system using the
1083
- requirements specified in `@resources`.
1182
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1183
+ decorator will execute a no-op task after all retries have been exhausted,
1184
+ ensuring that the flow execution can continue.
1084
1185
 
1085
1186
  Parameters
1086
1187
  ----------
1087
- cpu : int, default 1
1088
- Number of CPUs required for this step.
1089
- gpu : int, default 0
1090
- Number of GPUs required for this step.
1091
- disk : int, optional, default None
1092
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1093
- memory : int, default 4096
1094
- Memory size (in MB) required for this step.
1095
- shared_memory : int, optional, default None
1096
- The value for the size (in MiB) of the /dev/shm volume for this step.
1097
- This parameter maps to the `--shm-size` option in Docker.
1188
+ times : int, default 3
1189
+ Number of times to retry this task.
1190
+ minutes_between_retries : int, default 2
1191
+ Number of minutes between retries.
1192
+ """
1193
+ ...
1194
+
1195
+ @typing.overload
1196
+ 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]]]:
1197
+ """
1198
+ Specifies secrets to be retrieved and injected as environment variables prior to
1199
+ the execution of a step.
1200
+
1201
+ Parameters
1202
+ ----------
1203
+ sources : List[Union[str, Dict[str, Any]]], default: []
1204
+ List of secret specs, defining how the secrets are to be retrieved
1205
+ """
1206
+ ...
1207
+
1208
+ @typing.overload
1209
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1210
+ ...
1211
+
1212
+ @typing.overload
1213
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1214
+ ...
1215
+
1216
+ 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]]] = []):
1217
+ """
1218
+ Specifies secrets to be retrieved and injected as environment variables prior to
1219
+ the execution of a step.
1220
+
1221
+ Parameters
1222
+ ----------
1223
+ sources : List[Union[str, Dict[str, Any]]], default: []
1224
+ List of secret specs, defining how the secrets are to be retrieved
1098
1225
  """
1099
1226
  ...
1100
1227
 
@@ -1156,53 +1283,59 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1156
1283
  ...
1157
1284
 
1158
1285
  @typing.overload
1159
- 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]]]:
1286
+ 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]]]:
1160
1287
  """
1161
- Creates a human-readable report, a Metaflow Card, after this step completes.
1288
+ Specifies a timeout for your step.
1162
1289
 
1163
- Note that you may add multiple `@card` decorators in a step with different parameters.
1290
+ This decorator is useful if this step may hang indefinitely.
1164
1291
 
1165
- Parameters
1166
- ----------
1167
- type : str, default 'default'
1168
- Card type.
1169
- id : str, optional, default None
1170
- If multiple cards are present, use this id to identify this card.
1171
- options : Dict[str, Any], default {}
1172
- Options passed to the card. The contents depend on the card type.
1173
- timeout : int, default 45
1174
- Interrupt reporting if it takes more than this many seconds.
1292
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1293
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1294
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1175
1295
 
1296
+ Note that all the values specified in parameters are added together so if you specify
1297
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1176
1298
 
1299
+ Parameters
1300
+ ----------
1301
+ seconds : int, default 0
1302
+ Number of seconds to wait prior to timing out.
1303
+ minutes : int, default 0
1304
+ Number of minutes to wait prior to timing out.
1305
+ hours : int, default 0
1306
+ Number of hours to wait prior to timing out.
1177
1307
  """
1178
1308
  ...
1179
1309
 
1180
1310
  @typing.overload
1181
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1311
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1182
1312
  ...
1183
1313
 
1184
1314
  @typing.overload
1185
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1315
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1186
1316
  ...
1187
1317
 
1188
- 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):
1318
+ 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):
1189
1319
  """
1190
- Creates a human-readable report, a Metaflow Card, after this step completes.
1320
+ Specifies a timeout for your step.
1191
1321
 
1192
- Note that you may add multiple `@card` decorators in a step with different parameters.
1322
+ This decorator is useful if this step may hang indefinitely.
1193
1323
 
1194
- Parameters
1195
- ----------
1196
- type : str, default 'default'
1197
- Card type.
1198
- id : str, optional, default None
1199
- If multiple cards are present, use this id to identify this card.
1200
- options : Dict[str, Any], default {}
1201
- Options passed to the card. The contents depend on the card type.
1202
- timeout : int, default 45
1203
- Interrupt reporting if it takes more than this many seconds.
1324
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1325
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1326
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1204
1327
 
1328
+ Note that all the values specified in parameters are added together so if you specify
1329
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1205
1330
 
1331
+ Parameters
1332
+ ----------
1333
+ seconds : int, default 0
1334
+ Number of seconds to wait prior to timing out.
1335
+ minutes : int, default 0
1336
+ Number of minutes to wait prior to timing out.
1337
+ hours : int, default 0
1338
+ Number of hours to wait prior to timing out.
1206
1339
  """
1207
1340
  ...
1208
1341
 
@@ -1256,174 +1389,174 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
1256
1389
  ...
1257
1390
 
1258
1391
  @typing.overload
1259
- 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]]]:
1392
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1260
1393
  """
1261
- Specifies that the step will success under all circumstances.
1262
-
1263
- The decorator will create an optional artifact, specified by `var`, which
1264
- contains the exception raised. You can use it to detect the presence
1265
- of errors, indicating that all happy-path artifacts produced by the step
1266
- are missing.
1394
+ Specifies the PyPI packages for all steps of the flow.
1267
1395
 
1396
+ Use `@pypi_base` to set common packages required by all
1397
+ steps and use `@pypi` to specify step-specific overrides.
1268
1398
  Parameters
1269
1399
  ----------
1270
- var : str, optional, default None
1271
- Name of the artifact in which to store the caught exception.
1272
- If not specified, the exception is not stored.
1273
- print_exception : bool, default True
1274
- Determines whether or not the exception is printed to
1275
- stdout when caught.
1400
+ packages : Dict[str, str], default: {}
1401
+ Packages to use for this flow. The key is the name of the package
1402
+ and the value is the version to use.
1403
+ python : str, optional, default: None
1404
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1405
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1276
1406
  """
1277
1407
  ...
1278
1408
 
1279
1409
  @typing.overload
1280
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1281
- ...
1282
-
1283
- @typing.overload
1284
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1410
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1285
1411
  ...
1286
1412
 
1287
- 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):
1413
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1288
1414
  """
1289
- Specifies that the step will success under all circumstances.
1290
-
1291
- The decorator will create an optional artifact, specified by `var`, which
1292
- contains the exception raised. You can use it to detect the presence
1293
- of errors, indicating that all happy-path artifacts produced by the step
1294
- are missing.
1415
+ Specifies the PyPI packages for all steps of the flow.
1295
1416
 
1417
+ Use `@pypi_base` to set common packages required by all
1418
+ steps and use `@pypi` to specify step-specific overrides.
1296
1419
  Parameters
1297
1420
  ----------
1298
- var : str, optional, default None
1299
- Name of the artifact in which to store the caught exception.
1300
- If not specified, the exception is not stored.
1301
- print_exception : bool, default True
1302
- Determines whether or not the exception is printed to
1303
- stdout when caught.
1421
+ packages : Dict[str, str], default: {}
1422
+ Packages to use for this flow. The key is the name of the package
1423
+ and the value is the version to use.
1424
+ python : str, optional, default: None
1425
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1426
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1304
1427
  """
1305
1428
  ...
1306
1429
 
1307
- @typing.overload
1308
- 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]]]:
1430
+ 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]]:
1309
1431
  """
1310
- Specifies the number of times the task corresponding
1311
- to a step needs to be retried.
1312
-
1313
- This decorator is useful for handling transient errors, such as networking issues.
1314
- If your task contains operations that can't be retried safely, e.g. database updates,
1315
- it is advisable to annotate it with `@retry(times=0)`.
1316
-
1317
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1318
- decorator will execute a no-op task after all retries have been exhausted,
1319
- ensuring that the flow execution can continue.
1432
+ 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)
1433
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1434
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1435
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1436
+ starts only after all sensors finish.
1320
1437
 
1321
1438
  Parameters
1322
1439
  ----------
1323
- times : int, default 3
1324
- Number of times to retry this task.
1325
- minutes_between_retries : int, default 2
1326
- Number of minutes between retries.
1440
+ timeout : int
1441
+ Time, in seconds before the task times out and fails. (Default: 3600)
1442
+ poke_interval : int
1443
+ Time in seconds that the job should wait in between each try. (Default: 60)
1444
+ mode : str
1445
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1446
+ exponential_backoff : bool
1447
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1448
+ pool : str
1449
+ the slot pool this task should run in,
1450
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1451
+ soft_fail : bool
1452
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1453
+ name : str
1454
+ Name of the sensor on Airflow
1455
+ description : str
1456
+ Description of sensor in the Airflow UI
1457
+ bucket_key : Union[str, List[str]]
1458
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1459
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1460
+ bucket_name : str
1461
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1462
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1463
+ wildcard_match : bool
1464
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1465
+ aws_conn_id : str
1466
+ a reference to the s3 connection on Airflow. (Default: None)
1467
+ verify : bool
1468
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1327
1469
  """
1328
1470
  ...
1329
1471
 
1330
1472
  @typing.overload
1331
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1332
- ...
1333
-
1334
- @typing.overload
1335
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1336
- ...
1337
-
1338
- 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):
1473
+ 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]]:
1339
1474
  """
1340
- Specifies the number of times the task corresponding
1341
- to a step needs to be retried.
1342
-
1343
- This decorator is useful for handling transient errors, such as networking issues.
1344
- If your task contains operations that can't be retried safely, e.g. database updates,
1345
- it is advisable to annotate it with `@retry(times=0)`.
1346
-
1347
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1348
- decorator will execute a no-op task after all retries have been exhausted,
1349
- ensuring that the flow execution can continue.
1475
+ Specifies the Conda environment for all steps of the flow.
1350
1476
 
1351
- Parameters
1352
- ----------
1353
- times : int, default 3
1354
- Number of times to retry this task.
1355
- minutes_between_retries : int, default 2
1356
- Number of minutes between retries.
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.
1477
+ Use `@conda_base` to set common libraries required by all
1478
+ steps and use `@conda` to specify step-specific additions.
1364
1479
 
1365
1480
  Parameters
1366
1481
  ----------
1367
- vars : Dict[str, str], default {}
1368
- Dictionary of environment variables to set.
1482
+ packages : Dict[str, str], default {}
1483
+ Packages to use for this flow. The key is the name of the package
1484
+ and the value is the version to use.
1485
+ libraries : Dict[str, str], default {}
1486
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1487
+ python : str, optional, default None
1488
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1489
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1490
+ disabled : bool, default False
1491
+ If set to True, disables Conda.
1369
1492
  """
1370
1493
  ...
1371
1494
 
1372
1495
  @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]:
1496
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1378
1497
  ...
1379
1498
 
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] = {}):
1499
+ 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):
1381
1500
  """
1382
- Specifies environment variables to be set prior to the execution of a step.
1501
+ Specifies the Conda environment for all steps of the flow.
1383
1502
 
1384
- Parameters
1385
- ----------
1386
- vars : Dict[str, str], default {}
1387
- Dictionary of environment variables to set.
1388
- """
1389
- ...
1390
-
1391
- @typing.overload
1392
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1393
- """
1394
- Specifies the PyPI packages for all steps of the flow.
1503
+ Use `@conda_base` to set common libraries required by all
1504
+ steps and use `@conda` to specify step-specific additions.
1395
1505
 
1396
- Use `@pypi_base` to set common packages required by all
1397
- steps and use `@pypi` to specify step-specific overrides.
1398
1506
  Parameters
1399
1507
  ----------
1400
- packages : Dict[str, str], default: {}
1508
+ packages : Dict[str, str], default {}
1401
1509
  Packages to use for this flow. The key is the name of the package
1402
1510
  and the value is the version to use.
1403
- python : str, optional, default: None
1511
+ libraries : Dict[str, str], default {}
1512
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1513
+ python : str, optional, default None
1404
1514
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1405
1515
  that the version used will correspond to the version of the Python interpreter used to start the run.
1516
+ disabled : bool, default False
1517
+ If set to True, disables Conda.
1406
1518
  """
1407
1519
  ...
1408
1520
 
1409
- @typing.overload
1410
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1411
- ...
1412
-
1413
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1521
+ 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]]:
1414
1522
  """
1415
- Specifies the PyPI packages for all steps of the flow.
1416
-
1417
- Use `@pypi_base` to set common packages required by all
1418
- steps and use `@pypi` to specify step-specific overrides.
1523
+ 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.
1524
+ 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.
1525
+
1419
1526
  Parameters
1420
1527
  ----------
1421
- packages : Dict[str, str], default: {}
1422
- Packages to use for this flow. The key is the name of the package
1423
- and the value is the version to use.
1424
- python : str, optional, default: None
1425
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1426
- that the version used will correspond to the version of the Python interpreter used to start the run.
1528
+ timeout : int
1529
+ Time, in seconds before the task times out and fails. (Default: 3600)
1530
+ poke_interval : int
1531
+ Time in seconds that the job should wait in between each try. (Default: 60)
1532
+ mode : str
1533
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1534
+ exponential_backoff : bool
1535
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1536
+ pool : str
1537
+ the slot pool this task should run in,
1538
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1539
+ soft_fail : bool
1540
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1541
+ name : str
1542
+ Name of the sensor on Airflow
1543
+ description : str
1544
+ Description of sensor in the Airflow UI
1545
+ external_dag_id : str
1546
+ The dag_id that contains the task you want to wait for.
1547
+ external_task_ids : List[str]
1548
+ The list of task_ids that you want to wait for.
1549
+ If None (default value) the sensor waits for the DAG. (Default: None)
1550
+ allowed_states : List[str]
1551
+ Iterable of allowed states, (Default: ['success'])
1552
+ failed_states : List[str]
1553
+ Iterable of failed or dis-allowed states. (Default: None)
1554
+ execution_delta : datetime.timedelta
1555
+ time difference with the previous execution to look at,
1556
+ the default is the same logical date as the current task or DAG. (Default: None)
1557
+ check_existence: bool
1558
+ Set to True to check if the external task exists or check if
1559
+ the DAG to wait for exists. (Default: True)
1427
1560
  """
1428
1561
  ...
1429
1562
 
@@ -1522,97 +1655,6 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1522
1655
  """
1523
1656
  ...
1524
1657
 
1525
- @typing.overload
1526
- def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1527
- """
1528
- Specifies the times when the flow should be run when running on a
1529
- production scheduler.
1530
-
1531
- Parameters
1532
- ----------
1533
- hourly : bool, default False
1534
- Run the workflow hourly.
1535
- daily : bool, default True
1536
- Run the workflow daily.
1537
- weekly : bool, default False
1538
- Run the workflow weekly.
1539
- cron : str, optional, default None
1540
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1541
- specified by this expression.
1542
- timezone : str, optional, default None
1543
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1544
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1545
- """
1546
- ...
1547
-
1548
- @typing.overload
1549
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1550
- ...
1551
-
1552
- def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1553
- """
1554
- Specifies the times when the flow should be run when running on a
1555
- production scheduler.
1556
-
1557
- Parameters
1558
- ----------
1559
- hourly : bool, default False
1560
- Run the workflow hourly.
1561
- daily : bool, default True
1562
- Run the workflow daily.
1563
- weekly : bool, default False
1564
- Run the workflow weekly.
1565
- cron : str, optional, default None
1566
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1567
- specified by this expression.
1568
- timezone : str, optional, default None
1569
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1570
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1571
- """
1572
- ...
1573
-
1574
- 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]]:
1575
- """
1576
- 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.
1577
- 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.
1578
-
1579
- Parameters
1580
- ----------
1581
- timeout : int
1582
- Time, in seconds before the task times out and fails. (Default: 3600)
1583
- poke_interval : int
1584
- Time in seconds that the job should wait in between each try. (Default: 60)
1585
- mode : str
1586
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1587
- exponential_backoff : bool
1588
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1589
- pool : str
1590
- the slot pool this task should run in,
1591
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1592
- soft_fail : bool
1593
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1594
- name : str
1595
- Name of the sensor on Airflow
1596
- description : str
1597
- Description of sensor in the Airflow UI
1598
- external_dag_id : str
1599
- The dag_id that contains the task you want to wait for.
1600
- external_task_ids : List[str]
1601
- The list of task_ids that you want to wait for.
1602
- If None (default value) the sensor waits for the DAG. (Default: None)
1603
- allowed_states : List[str]
1604
- Iterable of allowed states, (Default: ['success'])
1605
- failed_states : List[str]
1606
- Iterable of failed or dis-allowed states. (Default: None)
1607
- execution_delta : datetime.timedelta
1608
- time difference with the previous execution to look at,
1609
- the default is the same logical date as the current task or DAG. (Default: None)
1610
- check_existence: bool
1611
- Set to True to check if the external task exists or check if
1612
- the DAG to wait for exists. (Default: True)
1613
- """
1614
- ...
1615
-
1616
1658
  @typing.overload
1617
1659
  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]]:
1618
1660
  """
@@ -1716,112 +1758,70 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1716
1758
  """
1717
1759
  ...
1718
1760
 
1719
- @typing.overload
1720
- 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]]:
1761
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1721
1762
  """
1722
- Specifies the Conda environment for all steps of the flow.
1763
+ Specifies what flows belong to the same project.
1723
1764
 
1724
- Use `@conda_base` to set common libraries required by all
1725
- steps and use `@conda` to specify step-specific additions.
1765
+ A project-specific namespace is created for all flows that
1766
+ use the same `@project(name)`.
1726
1767
 
1727
1768
  Parameters
1728
1769
  ----------
1729
- packages : Dict[str, str], default {}
1730
- Packages to use for this flow. The key is the name of the package
1731
- and the value is the version to use.
1732
- libraries : Dict[str, str], default {}
1733
- Supported for backward compatibility. When used with packages, packages will take precedence.
1734
- python : str, optional, default None
1735
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1736
- that the version used will correspond to the version of the Python interpreter used to start the run.
1737
- disabled : bool, default False
1738
- If set to True, disables Conda.
1770
+ name : str
1771
+ Project name. Make sure that the name is unique amongst all
1772
+ projects that use the same production scheduler. The name may
1773
+ contain only lowercase alphanumeric characters and underscores.
1774
+
1775
+
1739
1776
  """
1740
1777
  ...
1741
1778
 
1742
1779
  @typing.overload
1743
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1744
- ...
1745
-
1746
- 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):
1780
+ def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1747
1781
  """
1748
- Specifies the Conda environment for all steps of the flow.
1749
-
1750
- Use `@conda_base` to set common libraries required by all
1751
- steps and use `@conda` to specify step-specific additions.
1782
+ Specifies the times when the flow should be run when running on a
1783
+ production scheduler.
1752
1784
 
1753
1785
  Parameters
1754
1786
  ----------
1755
- packages : Dict[str, str], default {}
1756
- Packages to use for this flow. The key is the name of the package
1757
- and the value is the version to use.
1758
- libraries : Dict[str, str], default {}
1759
- Supported for backward compatibility. When used with packages, packages will take precedence.
1760
- python : str, optional, default None
1761
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1762
- that the version used will correspond to the version of the Python interpreter used to start the run.
1763
- disabled : bool, default False
1764
- If set to True, disables Conda.
1787
+ hourly : bool, default False
1788
+ Run the workflow hourly.
1789
+ daily : bool, default True
1790
+ Run the workflow daily.
1791
+ weekly : bool, default False
1792
+ Run the workflow weekly.
1793
+ cron : str, optional, default None
1794
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1795
+ specified by this expression.
1796
+ timezone : str, optional, default None
1797
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1798
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1765
1799
  """
1766
1800
  ...
1767
1801
 
1768
- 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]]:
1769
- """
1770
- 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)
1771
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1772
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1773
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1774
- starts only after all sensors finish.
1775
-
1776
- Parameters
1777
- ----------
1778
- timeout : int
1779
- Time, in seconds before the task times out and fails. (Default: 3600)
1780
- poke_interval : int
1781
- Time in seconds that the job should wait in between each try. (Default: 60)
1782
- mode : str
1783
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1784
- exponential_backoff : bool
1785
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1786
- pool : str
1787
- the slot pool this task should run in,
1788
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1789
- soft_fail : bool
1790
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1791
- name : str
1792
- Name of the sensor on Airflow
1793
- description : str
1794
- Description of sensor in the Airflow UI
1795
- bucket_key : Union[str, List[str]]
1796
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1797
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1798
- bucket_name : str
1799
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1800
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1801
- wildcard_match : bool
1802
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1803
- aws_conn_id : str
1804
- a reference to the s3 connection on Airflow. (Default: None)
1805
- verify : bool
1806
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1807
- """
1802
+ @typing.overload
1803
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1808
1804
  ...
1809
1805
 
1810
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1806
+ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1811
1807
  """
1812
- Specifies what flows belong to the same project.
1813
-
1814
- A project-specific namespace is created for all flows that
1815
- use the same `@project(name)`.
1808
+ Specifies the times when the flow should be run when running on a
1809
+ production scheduler.
1816
1810
 
1817
1811
  Parameters
1818
1812
  ----------
1819
- name : str
1820
- Project name. Make sure that the name is unique amongst all
1821
- projects that use the same production scheduler. The name may
1822
- contain only lowercase alphanumeric characters and underscores.
1823
-
1824
-
1813
+ hourly : bool, default False
1814
+ Run the workflow hourly.
1815
+ daily : bool, default True
1816
+ Run the workflow daily.
1817
+ weekly : bool, default False
1818
+ Run the workflow weekly.
1819
+ cron : str, optional, default None
1820
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1821
+ specified by this expression.
1822
+ timezone : str, optional, default None
1823
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1824
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1825
1825
  """
1826
1826
  ...
1827
1827