ob-metaflow-stubs 3.8__py2.py3-none-any.whl → 3.9__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 (142) hide show
  1. metaflow-stubs/__init__.pyi +561 -560
  2. metaflow-stubs/cards.pyi +5 -5
  3. metaflow-stubs/cli.pyi +2 -22
  4. metaflow-stubs/client/__init__.pyi +3 -3
  5. metaflow-stubs/client/core.pyi +6 -6
  6. metaflow-stubs/client/filecache.pyi +2 -2
  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 +6 -5
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +4 -4
  13. metaflow-stubs/metadata/metadata.pyi +2 -2
  14. metaflow-stubs/metadata/util.pyi +2 -2
  15. metaflow-stubs/metaflow_config.pyi +4 -4
  16. metaflow-stubs/metaflow_current.pyi +4 -4
  17. metaflow-stubs/mflog/mflog.pyi +2 -2
  18. metaflow-stubs/multicore_utils.pyi +2 -2
  19. metaflow-stubs/parameters.pyi +11 -5
  20. metaflow-stubs/plugins/__init__.pyi +3 -3
  21. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  22. metaflow-stubs/plugins/airflow/airflow.pyi +3 -3
  23. metaflow-stubs/plugins/airflow/airflow_cli.pyi +3 -3
  24. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +4 -4
  28. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
  29. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +6 -6
  30. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +6 -6
  31. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  32. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  33. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  34. metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -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 +2 -2
  43. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  44. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
  45. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  46. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +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 +2 -2
  57. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  58. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
  60. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  61. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  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 +3 -3
  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 +2 -2
  81. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  82. metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
  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 +3 -3
  86. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  87. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  88. metaflow-stubs/plugins/datatools/s3/s3.pyi +8 -7
  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 +2 -2
  98. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
  99. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  100. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -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 +2 -2
  105. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
  106. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  107. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
  108. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  109. metaflow-stubs/plugins/logs_cli.pyi +3 -3
  110. metaflow-stubs/plugins/package_cli.pyi +2 -2
  111. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  112. metaflow-stubs/plugins/perimeters.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 +3 -3
  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 +2 -2
  128. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  129. metaflow-stubs/procpoll.pyi +2 -2
  130. metaflow-stubs/profilers/__init__.pyi +2 -2
  131. metaflow-stubs/pylint_wrapper.pyi +2 -2
  132. metaflow-stubs/runner/__init__.pyi +2 -2
  133. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  134. metaflow-stubs/runner/nbrun.pyi +2 -2
  135. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  136. metaflow-stubs/tagging_util.pyi +2 -2
  137. metaflow-stubs/tuple_util.pyi +2 -2
  138. {ob_metaflow_stubs-3.8.dist-info → ob_metaflow_stubs-3.9.dist-info}/METADATA +1 -1
  139. ob_metaflow_stubs-3.9.dist-info/RECORD +142 -0
  140. ob_metaflow_stubs-3.8.dist-info/RECORD +0 -142
  141. {ob_metaflow_stubs-3.8.dist-info → ob_metaflow_stubs-3.9.dist-info}/WHEEL +0 -0
  142. {ob_metaflow_stubs-3.8.dist-info → ob_metaflow_stubs-3.9.dist-info}/top_level.txt +0 -0
@@ -1,24 +1,25 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.0.1+ob(v1) #
4
- # Generated on 2024-05-30T17:28:59.704529 #
3
+ # MF version: 2.12.4.2+ob(v1) #
4
+ # Generated on 2024-06-19T18:39:56.270719 #
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.plugins.datatools.s3.s3
11
12
  import metaflow._vendor.click.types
12
- import metaflow.parameters
13
- import io
14
- import metaflow.datastore.inputs
15
- import metaflow.runner.metaflow_runner
13
+ import typing
16
14
  import metaflow.events
15
+ import metaflow.metaflow_current
16
+ import metaflow.datastore.inputs
17
17
  import metaflow.client.core
18
+ import metaflow.runner.metaflow_runner
19
+ import metaflow.parameters
20
+ import metaflow.flowspec
18
21
  import datetime
19
- import typing
20
- import metaflow.plugins.datatools.s3.s3
21
- import metaflow.metaflow_current
22
+ import io
22
23
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
24
  StepFlag = typing.NewType("StepFlag", bool)
24
25
 
@@ -105,7 +106,7 @@ def metadata(ms: str) -> str:
105
106
  """
106
107
  ...
107
108
 
108
- class FlowSpec(object, metaclass=type):
109
+ class FlowSpec(object, metaclass=metaflow.flowspec._FlowSpecMeta):
109
110
  def __init__(self, use_cli = True):
110
111
  """
111
112
  Construct a FlowSpec
@@ -726,206 +727,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
726
727
  """
727
728
  ...
728
729
 
729
- @typing.overload
730
- def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
731
- """
732
- Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
733
-
734
- Parameters
735
- ----------
736
- cpu : int, default 1
737
- Number of CPUs required for this step. If `@resources` is
738
- also present, the maximum value from all decorators is used.
739
- gpu : int, default 0
740
- Number of GPUs required for this step. If `@resources` is
741
- also present, the maximum value from all decorators is used.
742
- memory : int, default 4096
743
- Memory size (in MB) required for this step. If
744
- `@resources` is also present, the maximum value from all decorators is
745
- used.
746
- image : str, optional, default None
747
- Docker image to use when launching on AWS Batch. If not specified, and
748
- METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
749
- not, a default Docker image mapping to the current version of Python is used.
750
- queue : str, default METAFLOW_BATCH_JOB_QUEUE
751
- AWS Batch Job Queue to submit the job to.
752
- iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
753
- AWS IAM role that AWS Batch container uses to access AWS cloud resources.
754
- execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
755
- AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
756
- (https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
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.
760
- max_swap : int, optional, default None
761
- The total amount of swap memory (in MiB) a container can use for this
762
- step. This parameter is translated to the `--memory-swap` option in
763
- Docker where the value is the sum of the container memory plus the
764
- `max_swap` value.
765
- swappiness : int, optional, default None
766
- This allows you to tune memory swappiness behavior for this step.
767
- A swappiness value of 0 causes swapping not to happen unless absolutely
768
- necessary. A swappiness value of 100 causes pages to be swapped very
769
- aggressively. Accepted values are whole numbers between 0 and 100.
770
- use_tmpfs : bool, default False
771
- This enables an explicit tmpfs mount for this step. Note that tmpfs is
772
- not available on Fargate compute environments
773
- tmpfs_tempdir : bool, default True
774
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
775
- tmpfs_size : int, optional, default None
776
- The value for the size (in MiB) of the tmpfs mount for this step.
777
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
778
- memory allocated for this step.
779
- tmpfs_path : str, optional, default None
780
- Path to tmpfs mount for this step. Defaults to /metaflow_temp.
781
- inferentia : int, default 0
782
- Number of Inferentia chips required for this step.
783
- trainium : int, default None
784
- Alias for inferentia. Use only one of the two.
785
- efa : int, default 0
786
- Number of elastic fabric adapter network devices to attach to container
787
- ephemeral_storage : int, default None
788
- The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
789
- This is only relevant for Fargate compute environments
790
- log_driver: str, optional, default None
791
- The log driver to use for the Amazon ECS container.
792
- log_options: List[str], optional, default None
793
- List of strings containing options for the chosen log driver. The configurable values
794
- depend on the `log driver` chosen. Validation of these options is not supported yet.
795
- Example: [`awslogs-group:aws/batch/job`]
796
- """
797
- ...
798
-
799
- @typing.overload
800
- def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
801
- ...
802
-
803
- @typing.overload
804
- def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
805
- ...
806
-
807
- def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, 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):
808
- """
809
- Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
810
-
811
- Parameters
812
- ----------
813
- cpu : int, default 1
814
- Number of CPUs required for this step. If `@resources` is
815
- also present, the maximum value from all decorators is used.
816
- gpu : int, default 0
817
- Number of GPUs required for this step. If `@resources` is
818
- also present, the maximum value from all decorators is used.
819
- memory : int, default 4096
820
- Memory size (in MB) required for this step. If
821
- `@resources` is also present, the maximum value from all decorators is
822
- used.
823
- image : str, optional, default None
824
- Docker image to use when launching on AWS Batch. If not specified, and
825
- METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
826
- not, a default Docker image mapping to the current version of Python is used.
827
- queue : str, default METAFLOW_BATCH_JOB_QUEUE
828
- AWS Batch Job Queue to submit the job to.
829
- iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
830
- AWS IAM role that AWS Batch container uses to access AWS cloud resources.
831
- execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
832
- AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
833
- (https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
834
- shared_memory : int, optional, default None
835
- The value for the size (in MiB) of the /dev/shm volume for this step.
836
- This parameter maps to the `--shm-size` option in Docker.
837
- max_swap : int, optional, default None
838
- The total amount of swap memory (in MiB) a container can use for this
839
- step. This parameter is translated to the `--memory-swap` option in
840
- Docker where the value is the sum of the container memory plus the
841
- `max_swap` value.
842
- swappiness : int, optional, default None
843
- This allows you to tune memory swappiness behavior for this step.
844
- A swappiness value of 0 causes swapping not to happen unless absolutely
845
- necessary. A swappiness value of 100 causes pages to be swapped very
846
- aggressively. Accepted values are whole numbers between 0 and 100.
847
- use_tmpfs : bool, default False
848
- This enables an explicit tmpfs mount for this step. Note that tmpfs is
849
- not available on Fargate compute environments
850
- tmpfs_tempdir : bool, default True
851
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
852
- tmpfs_size : int, optional, default None
853
- The value for the size (in MiB) of the tmpfs mount for this step.
854
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
855
- memory allocated for this step.
856
- tmpfs_path : str, optional, default None
857
- Path to tmpfs mount for this step. Defaults to /metaflow_temp.
858
- inferentia : int, default 0
859
- Number of Inferentia chips required for this step.
860
- trainium : int, default None
861
- Alias for inferentia. Use only one of the two.
862
- efa : int, default 0
863
- Number of elastic fabric adapter network devices to attach to container
864
- ephemeral_storage : int, default None
865
- The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
866
- This is only relevant for Fargate compute environments
867
- log_driver: str, optional, default None
868
- The log driver to use for the Amazon ECS container.
869
- log_options: List[str], optional, default None
870
- List of strings containing options for the chosen log driver. The configurable values
871
- depend on the `log driver` chosen. Validation of these options is not supported yet.
872
- Example: [`awslogs-group:aws/batch/job`]
873
- """
874
- ...
875
-
876
- @typing.overload
877
- def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
878
- """
879
- Specifies the number of times the task corresponding
880
- to a step needs to be retried.
881
-
882
- This decorator is useful for handling transient errors, such as networking issues.
883
- If your task contains operations that can't be retried safely, e.g. database updates,
884
- it is advisable to annotate it with `@retry(times=0)`.
885
-
886
- This can be used in conjunction with the `@catch` decorator. The `@catch`
887
- decorator will execute a no-op task after all retries have been exhausted,
888
- ensuring that the flow execution can continue.
889
-
890
- Parameters
891
- ----------
892
- times : int, default 3
893
- Number of times to retry this task.
894
- minutes_between_retries : int, default 2
895
- Number of minutes between retries.
896
- """
897
- ...
898
-
899
- @typing.overload
900
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
901
- ...
902
-
903
- @typing.overload
904
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
905
- ...
906
-
907
- def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
908
- """
909
- Specifies the number of times the task corresponding
910
- to a step needs to be retried.
911
-
912
- This decorator is useful for handling transient errors, such as networking issues.
913
- If your task contains operations that can't be retried safely, e.g. database updates,
914
- it is advisable to annotate it with `@retry(times=0)`.
915
-
916
- This can be used in conjunction with the `@catch` decorator. The `@catch`
917
- decorator will execute a no-op task after all retries have been exhausted,
918
- ensuring that the flow execution can continue.
919
-
920
- Parameters
921
- ----------
922
- times : int, default 3
923
- Number of times to retry this task.
924
- minutes_between_retries : int, default 2
925
- Number of minutes between retries.
926
- """
927
- ...
928
-
929
730
  @typing.overload
930
731
  def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
931
732
  """
@@ -984,48 +785,116 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
984
785
  ...
985
786
 
986
787
  @typing.overload
987
- def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
788
+ 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]]]:
988
789
  """
989
- Specifies the Conda environment for the step.
790
+ Specifies that the step will success under all circumstances.
990
791
 
991
- Information in this decorator will augment any
992
- attributes set in the `@conda_base` flow-level decorator. Hence,
993
- you can use `@conda_base` to set packages required by all
994
- steps and use `@conda` to specify step-specific overrides.
792
+ The decorator will create an optional artifact, specified by `var`, which
793
+ contains the exception raised. You can use it to detect the presence
794
+ of errors, indicating that all happy-path artifacts produced by the step
795
+ are missing.
995
796
 
996
797
  Parameters
997
798
  ----------
998
- packages : Dict[str, str], default {}
999
- Packages to use for this step. The key is the name of the package
1000
- and the value is the version to use.
1001
- libraries : Dict[str, str], default {}
1002
- Supported for backward compatibility. When used with packages, packages will take precedence.
1003
- python : str, optional, default None
1004
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1005
- that the version used will correspond to the version of the Python interpreter used to start the run.
1006
- disabled : bool, default False
1007
- If set to True, disables @conda.
799
+ var : str, optional, default None
800
+ Name of the artifact in which to store the caught exception.
801
+ If not specified, the exception is not stored.
802
+ print_exception : bool, default True
803
+ Determines whether or not the exception is printed to
804
+ stdout when caught.
1008
805
  """
1009
806
  ...
1010
807
 
1011
808
  @typing.overload
1012
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
809
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1013
810
  ...
1014
811
 
1015
812
  @typing.overload
1016
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
813
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1017
814
  ...
1018
815
 
1019
- def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
816
+ 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):
1020
817
  """
1021
- Specifies the Conda environment for the step.
1022
-
1023
- Information in this decorator will augment any
1024
- attributes set in the `@conda_base` flow-level decorator. Hence,
1025
- you can use `@conda_base` to set packages required by all
1026
- steps and use `@conda` to specify step-specific overrides.
818
+ Specifies that the step will success under all circumstances.
1027
819
 
1028
- Parameters
820
+ The decorator will create an optional artifact, specified by `var`, which
821
+ contains the exception raised. You can use it to detect the presence
822
+ of errors, indicating that all happy-path artifacts produced by the step
823
+ are missing.
824
+
825
+ Parameters
826
+ ----------
827
+ var : str, optional, default None
828
+ Name of the artifact in which to store the caught exception.
829
+ If not specified, the exception is not stored.
830
+ print_exception : bool, default True
831
+ Determines whether or not the exception is printed to
832
+ stdout when caught.
833
+ """
834
+ ...
835
+
836
+ @typing.overload
837
+ 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]]]:
838
+ """
839
+ Creates a human-readable report, a Metaflow Card, after this step completes.
840
+
841
+ Note that you may add multiple `@card` decorators in a step with different parameters.
842
+
843
+ Parameters
844
+ ----------
845
+ type : str, default 'default'
846
+ Card type.
847
+ id : str, optional, default None
848
+ If multiple cards are present, use this id to identify this card.
849
+ options : Dict[str, Any], default {}
850
+ Options passed to the card. The contents depend on the card type.
851
+ timeout : int, default 45
852
+ Interrupt reporting if it takes more than this many seconds.
853
+
854
+
855
+ """
856
+ ...
857
+
858
+ @typing.overload
859
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
860
+ ...
861
+
862
+ @typing.overload
863
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
864
+ ...
865
+
866
+ 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):
867
+ """
868
+ Creates a human-readable report, a Metaflow Card, after this step completes.
869
+
870
+ Note that you may add multiple `@card` decorators in a step with different parameters.
871
+
872
+ Parameters
873
+ ----------
874
+ type : str, default 'default'
875
+ Card type.
876
+ id : str, optional, default None
877
+ If multiple cards are present, use this id to identify this card.
878
+ options : Dict[str, Any], default {}
879
+ Options passed to the card. The contents depend on the card type.
880
+ timeout : int, default 45
881
+ Interrupt reporting if it takes more than this many seconds.
882
+
883
+
884
+ """
885
+ ...
886
+
887
+ @typing.overload
888
+ 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]]]:
889
+ """
890
+ Specifies the Conda environment for the step.
891
+
892
+ Information in this decorator will augment any
893
+ attributes set in the `@conda_base` flow-level decorator. Hence,
894
+ you can use `@conda_base` to set packages required by all
895
+ steps and use `@conda` to specify step-specific overrides.
896
+
897
+ Parameters
1029
898
  ----------
1030
899
  packages : Dict[str, str], default {}
1031
900
  Packages to use for this step. The key is the name of the package
@@ -1041,79 +910,87 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1041
910
  ...
1042
911
 
1043
912
  @typing.overload
1044
- def resources(*, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
913
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
914
+ ...
915
+
916
+ @typing.overload
917
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
918
+ ...
919
+
920
+ 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):
1045
921
  """
1046
- Specifies the resources needed when executing this step.
922
+ Specifies the Conda environment for the step.
1047
923
 
1048
- Use `@resources` to specify the resource requirements
1049
- independently of the specific compute layer (`@batch`, `@kubernetes`).
924
+ Information in this decorator will augment any
925
+ attributes set in the `@conda_base` flow-level decorator. Hence,
926
+ you can use `@conda_base` to set packages required by all
927
+ steps and use `@conda` to specify step-specific overrides.
1050
928
 
1051
- You can choose the compute layer on the command line by executing e.g.
1052
- ```
1053
- python myflow.py run --with batch
1054
- ```
1055
- or
1056
- ```
1057
- python myflow.py run --with kubernetes
1058
- ```
1059
- which executes the flow on the desired system using the
1060
- requirements specified in `@resources`.
929
+ Parameters
930
+ ----------
931
+ packages : Dict[str, str], default {}
932
+ Packages to use for this step. The key is the name of the package
933
+ and the value is the version to use.
934
+ libraries : Dict[str, str], default {}
935
+ Supported for backward compatibility. When used with packages, packages will take precedence.
936
+ python : str, optional, default None
937
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
938
+ that the version used will correspond to the version of the Python interpreter used to start the run.
939
+ disabled : bool, default False
940
+ If set to True, disables @conda.
941
+ """
942
+ ...
943
+
944
+ @typing.overload
945
+ 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]]]:
946
+ """
947
+ Specifies the number of times the task corresponding
948
+ to a step needs to be retried.
949
+
950
+ This decorator is useful for handling transient errors, such as networking issues.
951
+ If your task contains operations that can't be retried safely, e.g. database updates,
952
+ it is advisable to annotate it with `@retry(times=0)`.
953
+
954
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
955
+ decorator will execute a no-op task after all retries have been exhausted,
956
+ ensuring that the flow execution can continue.
1061
957
 
1062
958
  Parameters
1063
959
  ----------
1064
- cpu : int, default 1
1065
- Number of CPUs required for this step.
1066
- gpu : int, default 0
1067
- Number of GPUs required for this step.
1068
- disk : int, optional, default None
1069
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1070
- memory : int, default 4096
1071
- Memory size (in MB) required for this step.
1072
- shared_memory : int, optional, default None
1073
- The value for the size (in MiB) of the /dev/shm volume for this step.
1074
- This parameter maps to the `--shm-size` option in Docker.
960
+ times : int, default 3
961
+ Number of times to retry this task.
962
+ minutes_between_retries : int, default 2
963
+ Number of minutes between retries.
1075
964
  """
1076
965
  ...
1077
966
 
1078
967
  @typing.overload
1079
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
968
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1080
969
  ...
1081
970
 
1082
971
  @typing.overload
1083
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
972
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1084
973
  ...
1085
974
 
1086
- def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
975
+ 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):
1087
976
  """
1088
- Specifies the resources needed when executing this step.
977
+ Specifies the number of times the task corresponding
978
+ to a step needs to be retried.
1089
979
 
1090
- Use `@resources` to specify the resource requirements
1091
- independently of the specific compute layer (`@batch`, `@kubernetes`).
980
+ This decorator is useful for handling transient errors, such as networking issues.
981
+ If your task contains operations that can't be retried safely, e.g. database updates,
982
+ it is advisable to annotate it with `@retry(times=0)`.
1092
983
 
1093
- You can choose the compute layer on the command line by executing e.g.
1094
- ```
1095
- python myflow.py run --with batch
1096
- ```
1097
- or
1098
- ```
1099
- python myflow.py run --with kubernetes
1100
- ```
1101
- which executes the flow on the desired system using the
1102
- requirements specified in `@resources`.
984
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
985
+ decorator will execute a no-op task after all retries have been exhausted,
986
+ ensuring that the flow execution can continue.
1103
987
 
1104
988
  Parameters
1105
989
  ----------
1106
- cpu : int, default 1
1107
- Number of CPUs required for this step.
1108
- gpu : int, default 0
1109
- Number of GPUs required for this step.
1110
- disk : int, optional, default None
1111
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1112
- memory : int, default 4096
1113
- Memory size (in MB) required for this step.
1114
- shared_memory : int, optional, default None
1115
- The value for the size (in MiB) of the /dev/shm volume for this step.
1116
- This parameter maps to the `--shm-size` option in Docker.
990
+ times : int, default 3
991
+ Number of times to retry this task.
992
+ minutes_between_retries : int, default 2
993
+ Number of minutes between retries.
1117
994
  """
1118
995
  ...
1119
996
 
@@ -1151,51 +1028,51 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
1151
1028
  ...
1152
1029
 
1153
1030
  @typing.overload
1154
- def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1031
+ def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1155
1032
  """
1156
- Specifies that the step will success under all circumstances.
1033
+ Specifies the PyPI packages for the step.
1157
1034
 
1158
- The decorator will create an optional artifact, specified by `var`, which
1159
- contains the exception raised. You can use it to detect the presence
1160
- of errors, indicating that all happy-path artifacts produced by the step
1161
- are missing.
1035
+ Information in this decorator will augment any
1036
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1037
+ you can use `@pypi_base` to set packages required by all
1038
+ steps and use `@pypi` to specify step-specific overrides.
1162
1039
 
1163
1040
  Parameters
1164
1041
  ----------
1165
- var : str, optional, default None
1166
- Name of the artifact in which to store the caught exception.
1167
- If not specified, the exception is not stored.
1168
- print_exception : bool, default True
1169
- Determines whether or not the exception is printed to
1170
- stdout when caught.
1042
+ packages : Dict[str, str], default: {}
1043
+ Packages to use for this step. The key is the name of the package
1044
+ and the value is the version to use.
1045
+ python : str, optional, default: None
1046
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1047
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1171
1048
  """
1172
1049
  ...
1173
1050
 
1174
1051
  @typing.overload
1175
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1052
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1176
1053
  ...
1177
1054
 
1178
1055
  @typing.overload
1179
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1056
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1180
1057
  ...
1181
1058
 
1182
- def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
1059
+ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1183
1060
  """
1184
- Specifies that the step will success under all circumstances.
1061
+ Specifies the PyPI packages for the step.
1185
1062
 
1186
- The decorator will create an optional artifact, specified by `var`, which
1187
- contains the exception raised. You can use it to detect the presence
1188
- of errors, indicating that all happy-path artifacts produced by the step
1189
- are missing.
1063
+ Information in this decorator will augment any
1064
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1065
+ you can use `@pypi_base` to set packages required by all
1066
+ steps and use `@pypi` to specify step-specific overrides.
1190
1067
 
1191
1068
  Parameters
1192
1069
  ----------
1193
- var : str, optional, default None
1194
- Name of the artifact in which to store the caught exception.
1195
- If not specified, the exception is not stored.
1196
- print_exception : bool, default True
1197
- Determines whether or not the exception is printed to
1198
- stdout when caught.
1070
+ packages : Dict[str, str], default: {}
1071
+ Packages to use for this step. The key is the name of the package
1072
+ and the value is the version to use.
1073
+ python : str, optional, default: None
1074
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1075
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1199
1076
  """
1200
1077
  ...
1201
1078
 
@@ -1259,133 +1136,299 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
1259
1136
  ...
1260
1137
 
1261
1138
  @typing.overload
1262
- def card(*, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1139
+ 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]]]:
1263
1140
  """
1264
- Creates a human-readable report, a Metaflow Card, after this step completes.
1265
-
1266
- Note that you may add multiple `@card` decorators in a step with different parameters.
1141
+ Specifies environment variables to be set prior to the execution of a step.
1267
1142
 
1268
1143
  Parameters
1269
1144
  ----------
1270
- type : str, default 'default'
1271
- Card type.
1272
- id : str, optional, default None
1273
- If multiple cards are present, use this id to identify this card.
1274
- options : Dict[str, Any], default {}
1275
- Options passed to the card. The contents depend on the card type.
1276
- timeout : int, default 45
1277
- Interrupt reporting if it takes more than this many seconds.
1278
-
1279
-
1145
+ vars : Dict[str, str], default {}
1146
+ Dictionary of environment variables to set.
1280
1147
  """
1281
1148
  ...
1282
1149
 
1283
1150
  @typing.overload
1284
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1151
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1285
1152
  ...
1286
1153
 
1287
1154
  @typing.overload
1288
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1155
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1289
1156
  ...
1290
1157
 
1291
- def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
1158
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1292
1159
  """
1293
- Creates a human-readable report, a Metaflow Card, after this step completes.
1294
-
1295
- Note that you may add multiple `@card` decorators in a step with different parameters.
1160
+ Specifies environment variables to be set prior to the execution of a step.
1296
1161
 
1297
1162
  Parameters
1298
1163
  ----------
1299
- type : str, default 'default'
1300
- Card type.
1301
- id : str, optional, default None
1302
- If multiple cards are present, use this id to identify this card.
1303
- options : Dict[str, Any], default {}
1304
- Options passed to the card. The contents depend on the card type.
1305
- timeout : int, default 45
1306
- Interrupt reporting if it takes more than this many seconds.
1307
-
1308
-
1164
+ vars : Dict[str, str], default {}
1165
+ Dictionary of environment variables to set.
1309
1166
  """
1310
1167
  ...
1311
1168
 
1312
1169
  @typing.overload
1313
- def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1170
+ 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]]]:
1314
1171
  """
1315
- Specifies the PyPI packages for the step.
1172
+ Specifies the resources needed when executing this step.
1316
1173
 
1317
- Information in this decorator will augment any
1318
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1319
- you can use `@pypi_base` to set packages required by all
1320
- steps and use `@pypi` to specify step-specific overrides.
1174
+ Use `@resources` to specify the resource requirements
1175
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1176
+
1177
+ You can choose the compute layer on the command line by executing e.g.
1178
+ ```
1179
+ python myflow.py run --with batch
1180
+ ```
1181
+ or
1182
+ ```
1183
+ python myflow.py run --with kubernetes
1184
+ ```
1185
+ which executes the flow on the desired system using the
1186
+ requirements specified in `@resources`.
1321
1187
 
1322
1188
  Parameters
1323
1189
  ----------
1324
- packages : Dict[str, str], default: {}
1325
- Packages to use for this step. The key is the name of the package
1326
- and the value is the version to use.
1327
- python : str, optional, default: None
1328
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1329
- that the version used will correspond to the version of the Python interpreter used to start the run.
1190
+ cpu : int, default 1
1191
+ Number of CPUs required for this step.
1192
+ gpu : int, default 0
1193
+ Number of GPUs required for this step.
1194
+ disk : int, optional, default None
1195
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1196
+ memory : int, default 4096
1197
+ Memory size (in MB) required for this step.
1198
+ shared_memory : int, optional, default None
1199
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1200
+ This parameter maps to the `--shm-size` option in Docker.
1330
1201
  """
1331
1202
  ...
1332
1203
 
1333
1204
  @typing.overload
1334
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1205
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1335
1206
  ...
1336
1207
 
1337
1208
  @typing.overload
1338
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1209
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1339
1210
  ...
1340
1211
 
1341
- def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1212
+ 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):
1342
1213
  """
1343
- Specifies the PyPI packages for the step.
1214
+ Specifies the resources needed when executing this step.
1344
1215
 
1345
- Information in this decorator will augment any
1346
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1347
- you can use `@pypi_base` to set packages required by all
1348
- steps and use `@pypi` to specify step-specific overrides.
1216
+ Use `@resources` to specify the resource requirements
1217
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1218
+
1219
+ You can choose the compute layer on the command line by executing e.g.
1220
+ ```
1221
+ python myflow.py run --with batch
1222
+ ```
1223
+ or
1224
+ ```
1225
+ python myflow.py run --with kubernetes
1226
+ ```
1227
+ which executes the flow on the desired system using the
1228
+ requirements specified in `@resources`.
1349
1229
 
1350
1230
  Parameters
1351
1231
  ----------
1352
- packages : Dict[str, str], default: {}
1353
- Packages to use for this step. The key is the name of the package
1354
- and the value is the version to use.
1355
- python : str, optional, default: None
1356
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1357
- that the version used will correspond to the version of the Python interpreter used to start the run.
1232
+ cpu : int, default 1
1233
+ Number of CPUs required for this step.
1234
+ gpu : int, default 0
1235
+ Number of GPUs required for this step.
1236
+ disk : int, optional, default None
1237
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1238
+ memory : int, default 4096
1239
+ Memory size (in MB) required for this step.
1240
+ shared_memory : int, optional, default None
1241
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1242
+ This parameter maps to the `--shm-size` option in Docker.
1358
1243
  """
1359
1244
  ...
1360
1245
 
1361
1246
  @typing.overload
1362
- def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1247
+ 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]]]:
1363
1248
  """
1364
- Specifies environment variables to be set prior to the execution of a step.
1249
+ Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
1365
1250
 
1366
1251
  Parameters
1367
1252
  ----------
1368
- vars : Dict[str, str], default {}
1369
- Dictionary of environment variables to set.
1253
+ cpu : int, default 1
1254
+ Number of CPUs required for this step. If `@resources` is
1255
+ also present, the maximum value from all decorators is used.
1256
+ gpu : int, default 0
1257
+ Number of GPUs required for this step. If `@resources` is
1258
+ also present, the maximum value from all decorators is used.
1259
+ memory : int, default 4096
1260
+ Memory size (in MB) required for this step. If
1261
+ `@resources` is also present, the maximum value from all decorators is
1262
+ used.
1263
+ image : str, optional, default None
1264
+ Docker image to use when launching on AWS Batch. If not specified, and
1265
+ METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
1266
+ not, a default Docker image mapping to the current version of Python is used.
1267
+ queue : str, default METAFLOW_BATCH_JOB_QUEUE
1268
+ AWS Batch Job Queue to submit the job to.
1269
+ iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
1270
+ AWS IAM role that AWS Batch container uses to access AWS cloud resources.
1271
+ execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
1272
+ AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
1273
+ (https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
1274
+ shared_memory : int, optional, default None
1275
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1276
+ This parameter maps to the `--shm-size` option in Docker.
1277
+ max_swap : int, optional, default None
1278
+ The total amount of swap memory (in MiB) a container can use for this
1279
+ step. This parameter is translated to the `--memory-swap` option in
1280
+ Docker where the value is the sum of the container memory plus the
1281
+ `max_swap` value.
1282
+ swappiness : int, optional, default None
1283
+ This allows you to tune memory swappiness behavior for this step.
1284
+ A swappiness value of 0 causes swapping not to happen unless absolutely
1285
+ necessary. A swappiness value of 100 causes pages to be swapped very
1286
+ aggressively. Accepted values are whole numbers between 0 and 100.
1287
+ use_tmpfs : bool, default False
1288
+ This enables an explicit tmpfs mount for this step. Note that tmpfs is
1289
+ not available on Fargate compute environments
1290
+ tmpfs_tempdir : bool, default True
1291
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1292
+ tmpfs_size : int, optional, default None
1293
+ The value for the size (in MiB) of the tmpfs mount for this step.
1294
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1295
+ memory allocated for this step.
1296
+ tmpfs_path : str, optional, default None
1297
+ Path to tmpfs mount for this step. Defaults to /metaflow_temp.
1298
+ inferentia : int, default 0
1299
+ Number of Inferentia chips required for this step.
1300
+ trainium : int, default None
1301
+ Alias for inferentia. Use only one of the two.
1302
+ efa : int, default 0
1303
+ Number of elastic fabric adapter network devices to attach to container
1304
+ ephemeral_storage : int, default None
1305
+ The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
1306
+ This is only relevant for Fargate compute environments
1307
+ log_driver: str, optional, default None
1308
+ The log driver to use for the Amazon ECS container.
1309
+ log_options: List[str], optional, default None
1310
+ List of strings containing options for the chosen log driver. The configurable values
1311
+ depend on the `log driver` chosen. Validation of these options is not supported yet.
1312
+ Example: [`awslogs-group:aws/batch/job`]
1370
1313
  """
1371
1314
  ...
1372
1315
 
1373
1316
  @typing.overload
1374
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1317
+ def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1375
1318
  ...
1376
1319
 
1377
1320
  @typing.overload
1378
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1321
+ def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1379
1322
  ...
1380
1323
 
1381
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1324
+ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, 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):
1382
1325
  """
1383
- Specifies environment variables to be set prior to the execution of a step.
1326
+ Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
1384
1327
 
1385
1328
  Parameters
1386
1329
  ----------
1387
- vars : Dict[str, str], default {}
1388
- Dictionary of environment variables to set.
1330
+ cpu : int, default 1
1331
+ Number of CPUs required for this step. If `@resources` is
1332
+ also present, the maximum value from all decorators is used.
1333
+ gpu : int, default 0
1334
+ Number of GPUs required for this step. If `@resources` is
1335
+ also present, the maximum value from all decorators is used.
1336
+ memory : int, default 4096
1337
+ Memory size (in MB) required for this step. If
1338
+ `@resources` is also present, the maximum value from all decorators is
1339
+ used.
1340
+ image : str, optional, default None
1341
+ Docker image to use when launching on AWS Batch. If not specified, and
1342
+ METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
1343
+ not, a default Docker image mapping to the current version of Python is used.
1344
+ queue : str, default METAFLOW_BATCH_JOB_QUEUE
1345
+ AWS Batch Job Queue to submit the job to.
1346
+ iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
1347
+ AWS IAM role that AWS Batch container uses to access AWS cloud resources.
1348
+ execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
1349
+ AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
1350
+ (https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
1351
+ shared_memory : int, optional, default None
1352
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1353
+ This parameter maps to the `--shm-size` option in Docker.
1354
+ max_swap : int, optional, default None
1355
+ The total amount of swap memory (in MiB) a container can use for this
1356
+ step. This parameter is translated to the `--memory-swap` option in
1357
+ Docker where the value is the sum of the container memory plus the
1358
+ `max_swap` value.
1359
+ swappiness : int, optional, default None
1360
+ This allows you to tune memory swappiness behavior for this step.
1361
+ A swappiness value of 0 causes swapping not to happen unless absolutely
1362
+ necessary. A swappiness value of 100 causes pages to be swapped very
1363
+ aggressively. Accepted values are whole numbers between 0 and 100.
1364
+ use_tmpfs : bool, default False
1365
+ This enables an explicit tmpfs mount for this step. Note that tmpfs is
1366
+ not available on Fargate compute environments
1367
+ tmpfs_tempdir : bool, default True
1368
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1369
+ tmpfs_size : int, optional, default None
1370
+ The value for the size (in MiB) of the tmpfs mount for this step.
1371
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1372
+ memory allocated for this step.
1373
+ tmpfs_path : str, optional, default None
1374
+ Path to tmpfs mount for this step. Defaults to /metaflow_temp.
1375
+ inferentia : int, default 0
1376
+ Number of Inferentia chips required for this step.
1377
+ trainium : int, default None
1378
+ Alias for inferentia. Use only one of the two.
1379
+ efa : int, default 0
1380
+ Number of elastic fabric adapter network devices to attach to container
1381
+ ephemeral_storage : int, default None
1382
+ The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
1383
+ This is only relevant for Fargate compute environments
1384
+ log_driver: str, optional, default None
1385
+ The log driver to use for the Amazon ECS container.
1386
+ log_options: List[str], optional, default None
1387
+ List of strings containing options for the chosen log driver. The configurable values
1388
+ depend on the `log driver` chosen. Validation of these options is not supported yet.
1389
+ Example: [`awslogs-group:aws/batch/job`]
1390
+ """
1391
+ ...
1392
+
1393
+ 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]]:
1394
+ """
1395
+ 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)
1396
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1397
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1398
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1399
+ starts only after all sensors finish.
1400
+
1401
+ Parameters
1402
+ ----------
1403
+ timeout : int
1404
+ Time, in seconds before the task times out and fails. (Default: 3600)
1405
+ poke_interval : int
1406
+ Time in seconds that the job should wait in between each try. (Default: 60)
1407
+ mode : str
1408
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1409
+ exponential_backoff : bool
1410
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1411
+ pool : str
1412
+ the slot pool this task should run in,
1413
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1414
+ soft_fail : bool
1415
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1416
+ name : str
1417
+ Name of the sensor on Airflow
1418
+ description : str
1419
+ Description of sensor in the Airflow UI
1420
+ bucket_key : Union[str, List[str]]
1421
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1422
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1423
+ bucket_name : str
1424
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1425
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1426
+ wildcard_match : bool
1427
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1428
+ aws_conn_id : str
1429
+ a reference to the s3 connection on Airflow. (Default: None)
1430
+ verify : bool
1431
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1389
1432
  """
1390
1433
  ...
1391
1434
 
@@ -1407,94 +1450,133 @@ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typ
1407
1450
  """
1408
1451
  ...
1409
1452
 
1453
+ 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]]:
1454
+ """
1455
+ 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.
1456
+ 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.
1457
+
1458
+ Parameters
1459
+ ----------
1460
+ timeout : int
1461
+ Time, in seconds before the task times out and fails. (Default: 3600)
1462
+ poke_interval : int
1463
+ Time in seconds that the job should wait in between each try. (Default: 60)
1464
+ mode : str
1465
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1466
+ exponential_backoff : bool
1467
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1468
+ pool : str
1469
+ the slot pool this task should run in,
1470
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1471
+ soft_fail : bool
1472
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1473
+ name : str
1474
+ Name of the sensor on Airflow
1475
+ description : str
1476
+ Description of sensor in the Airflow UI
1477
+ external_dag_id : str
1478
+ The dag_id that contains the task you want to wait for.
1479
+ external_task_ids : List[str]
1480
+ The list of task_ids that you want to wait for.
1481
+ If None (default value) the sensor waits for the DAG. (Default: None)
1482
+ allowed_states : List[str]
1483
+ Iterable of allowed states, (Default: ['success'])
1484
+ failed_states : List[str]
1485
+ Iterable of failed or dis-allowed states. (Default: None)
1486
+ execution_delta : datetime.timedelta
1487
+ time difference with the previous execution to look at,
1488
+ the default is the same logical date as the current task or DAG. (Default: None)
1489
+ check_existence: bool
1490
+ Set to True to check if the external task exists or check if
1491
+ the DAG to wait for exists. (Default: True)
1492
+ """
1493
+ ...
1494
+
1495
+ @typing.overload
1496
+ 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]]:
1497
+ """
1498
+ Specifies the Conda environment for all steps of the flow.
1499
+
1500
+ Use `@conda_base` to set common libraries required by all
1501
+ steps and use `@conda` to specify step-specific additions.
1502
+
1503
+ Parameters
1504
+ ----------
1505
+ packages : Dict[str, str], default {}
1506
+ Packages to use for this flow. The key is the name of the package
1507
+ and the value is the version to use.
1508
+ libraries : Dict[str, str], default {}
1509
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1510
+ python : str, optional, default None
1511
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1512
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1513
+ disabled : bool, default False
1514
+ If set to True, disables Conda.
1515
+ """
1516
+ ...
1517
+
1410
1518
  @typing.overload
1411
- 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]]:
1519
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1520
+ ...
1521
+
1522
+ 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):
1412
1523
  """
1413
- Specifies the times when the flow should be run when running on a
1414
- production scheduler.
1524
+ Specifies the Conda environment for all steps of the flow.
1525
+
1526
+ Use `@conda_base` to set common libraries required by all
1527
+ steps and use `@conda` to specify step-specific additions.
1415
1528
 
1416
1529
  Parameters
1417
1530
  ----------
1418
- hourly : bool, default False
1419
- Run the workflow hourly.
1420
- daily : bool, default True
1421
- Run the workflow daily.
1422
- weekly : bool, default False
1423
- Run the workflow weekly.
1424
- cron : str, optional, default None
1425
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1426
- specified by this expression.
1427
- timezone : str, optional, default None
1428
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1429
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1531
+ packages : Dict[str, str], default {}
1532
+ Packages to use for this flow. The key is the name of the package
1533
+ and the value is the version to use.
1534
+ libraries : Dict[str, str], default {}
1535
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1536
+ python : str, optional, default None
1537
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1538
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1539
+ disabled : bool, default False
1540
+ If set to True, disables Conda.
1430
1541
  """
1431
1542
  ...
1432
1543
 
1433
1544
  @typing.overload
1434
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1435
- ...
1436
-
1437
- 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):
1545
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1438
1546
  """
1439
- Specifies the times when the flow should be run when running on a
1440
- production scheduler.
1547
+ Specifies the PyPI packages for all steps of the flow.
1441
1548
 
1549
+ Use `@pypi_base` to set common packages required by all
1550
+ steps and use `@pypi` to specify step-specific overrides.
1442
1551
  Parameters
1443
1552
  ----------
1444
- hourly : bool, default False
1445
- Run the workflow hourly.
1446
- daily : bool, default True
1447
- Run the workflow daily.
1448
- weekly : bool, default False
1449
- Run the workflow weekly.
1450
- cron : str, optional, default None
1451
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1452
- specified by this expression.
1453
- timezone : str, optional, default None
1454
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1455
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1553
+ packages : Dict[str, str], default: {}
1554
+ Packages to use for this flow. The key is the name of the package
1555
+ and the value is the version to use.
1556
+ python : str, optional, default: None
1557
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1558
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1456
1559
  """
1457
1560
  ...
1458
1561
 
1459
- def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1562
+ @typing.overload
1563
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1564
+ ...
1565
+
1566
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1460
1567
  """
1461
- The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
1462
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1463
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1464
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1465
- starts only after all sensors finish.
1568
+ Specifies the PyPI packages for all steps of the flow.
1466
1569
 
1570
+ Use `@pypi_base` to set common packages required by all
1571
+ steps and use `@pypi` to specify step-specific overrides.
1467
1572
  Parameters
1468
1573
  ----------
1469
- timeout : int
1470
- Time, in seconds before the task times out and fails. (Default: 3600)
1471
- poke_interval : int
1472
- Time in seconds that the job should wait in between each try. (Default: 60)
1473
- mode : str
1474
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1475
- exponential_backoff : bool
1476
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1477
- pool : str
1478
- the slot pool this task should run in,
1479
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1480
- soft_fail : bool
1481
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1482
- name : str
1483
- Name of the sensor on Airflow
1484
- description : str
1485
- Description of sensor in the Airflow UI
1486
- bucket_key : Union[str, List[str]]
1487
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1488
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1489
- bucket_name : str
1490
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1491
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1492
- wildcard_match : bool
1493
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1494
- aws_conn_id : str
1495
- a reference to the s3 connection on Airflow. (Default: None)
1496
- verify : bool
1497
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1574
+ packages : Dict[str, str], default: {}
1575
+ Packages to use for this flow. The key is the name of the package
1576
+ and the value is the version to use.
1577
+ python : str, optional, default: None
1578
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1579
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1498
1580
  """
1499
1581
  ...
1500
1582
 
@@ -1594,41 +1676,51 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1594
1676
  ...
1595
1677
 
1596
1678
  @typing.overload
1597
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1679
+ 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]]:
1598
1680
  """
1599
- Specifies the PyPI packages for all steps of the flow.
1681
+ Specifies the times when the flow should be run when running on a
1682
+ production scheduler.
1600
1683
 
1601
- Use `@pypi_base` to set common packages required by all
1602
- steps and use `@pypi` to specify step-specific overrides.
1603
1684
  Parameters
1604
1685
  ----------
1605
- packages : Dict[str, str], default: {}
1606
- Packages to use for this flow. The key is the name of the package
1607
- and the value is the version to use.
1608
- python : str, optional, default: None
1609
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1610
- that the version used will correspond to the version of the Python interpreter used to start the run.
1686
+ hourly : bool, default False
1687
+ Run the workflow hourly.
1688
+ daily : bool, default True
1689
+ Run the workflow daily.
1690
+ weekly : bool, default False
1691
+ Run the workflow weekly.
1692
+ cron : str, optional, default None
1693
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1694
+ specified by this expression.
1695
+ timezone : str, optional, default None
1696
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1697
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1611
1698
  """
1612
1699
  ...
1613
1700
 
1614
1701
  @typing.overload
1615
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1702
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1616
1703
  ...
1617
1704
 
1618
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1705
+ 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):
1619
1706
  """
1620
- Specifies the PyPI packages for all steps of the flow.
1707
+ Specifies the times when the flow should be run when running on a
1708
+ production scheduler.
1621
1709
 
1622
- Use `@pypi_base` to set common packages required by all
1623
- steps and use `@pypi` to specify step-specific overrides.
1624
1710
  Parameters
1625
1711
  ----------
1626
- packages : Dict[str, str], default: {}
1627
- Packages to use for this flow. The key is the name of the package
1628
- and the value is the version to use.
1629
- python : str, optional, default: None
1630
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1631
- that the version used will correspond to the version of the Python interpreter used to start the run.
1712
+ hourly : bool, default False
1713
+ Run the workflow hourly.
1714
+ daily : bool, default True
1715
+ Run the workflow daily.
1716
+ weekly : bool, default False
1717
+ Run the workflow weekly.
1718
+ cron : str, optional, default None
1719
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1720
+ specified by this expression.
1721
+ timezone : str, optional, default None
1722
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1723
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1632
1724
  """
1633
1725
  ...
1634
1726
 
@@ -1735,97 +1827,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1735
1827
  """
1736
1828
  ...
1737
1829
 
1738
- @typing.overload
1739
- def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1740
- """
1741
- Specifies the Conda environment for all steps of the flow.
1742
-
1743
- Use `@conda_base` to set common libraries required by all
1744
- steps and use `@conda` to specify step-specific additions.
1745
-
1746
- Parameters
1747
- ----------
1748
- packages : Dict[str, str], default {}
1749
- Packages to use for this flow. The key is the name of the package
1750
- and the value is the version to use.
1751
- libraries : Dict[str, str], default {}
1752
- Supported for backward compatibility. When used with packages, packages will take precedence.
1753
- python : str, optional, default None
1754
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1755
- that the version used will correspond to the version of the Python interpreter used to start the run.
1756
- disabled : bool, default False
1757
- If set to True, disables Conda.
1758
- """
1759
- ...
1760
-
1761
- @typing.overload
1762
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1763
- ...
1764
-
1765
- def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1766
- """
1767
- Specifies the Conda environment for all steps of the flow.
1768
-
1769
- Use `@conda_base` to set common libraries required by all
1770
- steps and use `@conda` to specify step-specific additions.
1771
-
1772
- Parameters
1773
- ----------
1774
- packages : Dict[str, str], default {}
1775
- Packages to use for this flow. The key is the name of the package
1776
- and the value is the version to use.
1777
- libraries : Dict[str, str], default {}
1778
- Supported for backward compatibility. When used with packages, packages will take precedence.
1779
- python : str, optional, default None
1780
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1781
- that the version used will correspond to the version of the Python interpreter used to start the run.
1782
- disabled : bool, default False
1783
- If set to True, disables Conda.
1784
- """
1785
- ...
1786
-
1787
- def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1788
- """
1789
- The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1790
- This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
1791
-
1792
- Parameters
1793
- ----------
1794
- timeout : int
1795
- Time, in seconds before the task times out and fails. (Default: 3600)
1796
- poke_interval : int
1797
- Time in seconds that the job should wait in between each try. (Default: 60)
1798
- mode : str
1799
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1800
- exponential_backoff : bool
1801
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1802
- pool : str
1803
- the slot pool this task should run in,
1804
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1805
- soft_fail : bool
1806
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1807
- name : str
1808
- Name of the sensor on Airflow
1809
- description : str
1810
- Description of sensor in the Airflow UI
1811
- external_dag_id : str
1812
- The dag_id that contains the task you want to wait for.
1813
- external_task_ids : List[str]
1814
- The list of task_ids that you want to wait for.
1815
- If None (default value) the sensor waits for the DAG. (Default: None)
1816
- allowed_states : List[str]
1817
- Iterable of allowed states, (Default: ['success'])
1818
- failed_states : List[str]
1819
- Iterable of failed or dis-allowed states. (Default: None)
1820
- execution_delta : datetime.timedelta
1821
- time difference with the previous execution to look at,
1822
- the default is the same logical date as the current task or DAG. (Default: None)
1823
- check_existence: bool
1824
- Set to True to check if the external task exists or check if
1825
- the DAG to wait for exists. (Default: True)
1826
- """
1827
- ...
1828
-
1829
1830
  def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
1830
1831
  """
1831
1832
  Switch namespace to the one provided.