ob-metaflow-stubs 2.11.8.1__py2.py3-none-any.whl → 2.11.10.3__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. metaflow-stubs/__init__.pyi +507 -507
  2. metaflow-stubs/cards.pyi +3 -3
  3. metaflow-stubs/cli.pyi +3 -3
  4. metaflow-stubs/client/__init__.pyi +3 -3
  5. metaflow-stubs/client/core.pyi +5 -5
  6. metaflow-stubs/client/filecache.pyi +2 -2
  7. metaflow-stubs/clone_util.pyi +2 -2
  8. metaflow-stubs/events.pyi +2 -2
  9. metaflow-stubs/exception.pyi +2 -2
  10. metaflow-stubs/flowspec.pyi +4 -4
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +4 -4
  13. metaflow-stubs/metadata/metadata.pyi +3 -3
  14. metaflow-stubs/metadata/util.pyi +2 -2
  15. metaflow-stubs/metaflow_config.pyi +2 -2
  16. metaflow-stubs/metaflow_current.pyi +4 -4
  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 +2 -2
  21. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  22. metaflow-stubs/plugins/airflow/airflow.pyi +4 -4
  23. metaflow-stubs/plugins/airflow/airflow_cli.pyi +3 -3
  24. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  29. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
  30. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
  31. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  32. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  33. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  34. metaflow-stubs/plugins/argo/argo_workflows.pyi +5 -5
  35. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +5 -5
  36. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  37. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  38. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  39. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  40. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  41. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/batch_cli.pyi +2 -2
  43. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  44. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +4 -4
  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 +5 -5
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  55. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  56. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  57. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  58. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  60. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  61. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  62. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  63. metaflow-stubs/plugins/cards/card_cli.pyi +4 -4
  64. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  65. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  67. metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
  68. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  69. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  70. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  71. metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
  73. metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
  74. metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  77. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  78. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  79. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +3 -3
  80. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  81. metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
  82. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  83. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  84. metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
  85. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  86. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  87. metaflow-stubs/plugins/datatools/s3/s3.pyi +5 -5
  88. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  89. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  90. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  91. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  92. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  93. metaflow-stubs/plugins/events_decorator.pyi +3 -3
  94. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  95. metaflow-stubs/plugins/frameworks/pytorch.pyi +4 -4
  96. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  97. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
  98. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  99. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  100. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  101. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  102. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  103. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +4 -4
  104. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
  105. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  106. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +4 -4
  107. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  108. metaflow-stubs/plugins/package_cli.pyi +2 -2
  109. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  110. metaflow-stubs/plugins/project_decorator.pyi +3 -3
  111. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  112. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  113. metaflow-stubs/plugins/pypi/conda_environment.pyi +2 -2
  114. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  115. metaflow-stubs/plugins/pypi/pypi_environment.pyi +3 -3
  116. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  117. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  118. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  119. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  120. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  121. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  122. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  123. metaflow-stubs/plugins/tag_cli.pyi +4 -4
  124. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  125. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  126. metaflow-stubs/procpoll.pyi +2 -2
  127. metaflow-stubs/pylint_wrapper.pyi +2 -2
  128. metaflow-stubs/tagging_util.pyi +2 -2
  129. {ob_metaflow_stubs-2.11.8.1.dist-info → ob_metaflow_stubs-2.11.10.3.dist-info}/METADATA +2 -2
  130. ob_metaflow_stubs-2.11.10.3.dist-info/RECORD +133 -0
  131. ob_metaflow_stubs-2.11.8.1.dist-info/RECORD +0 -133
  132. {ob_metaflow_stubs-2.11.8.1.dist-info → ob_metaflow_stubs-2.11.10.3.dist-info}/WHEEL +0 -0
  133. {ob_metaflow_stubs-2.11.8.1.dist-info → ob_metaflow_stubs-2.11.10.3.dist-info}/top_level.txt +0 -0
@@ -1,23 +1,23 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.11.8.1 #
4
- # Generated on 2024-03-29T12:39:58.338796 #
3
+ # MF version: 2.11.10.3 #
4
+ # Generated on 2024-04-12T18:07:07.339961 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
+ import io
11
12
  import metaflow.metaflow_current
13
+ import metaflow._vendor.click.types
12
14
  import typing
13
- import io
14
- import metaflow.events
15
- import metaflow.plugins.datatools.s3.s3
16
15
  import metaflow.datastore.inputs
17
16
  import metaflow.client.core
18
- import metaflow._vendor.click.types
19
- import datetime
20
17
  import metaflow.parameters
18
+ import metaflow.plugins.datatools.s3.s3
19
+ import metaflow.events
20
+ import datetime
21
21
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
22
22
  StepFlag = typing.NewType("StepFlag", bool)
23
23
 
@@ -726,37 +726,112 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
726
726
  ...
727
727
 
728
728
  @typing.overload
729
- def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
729
+ def 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]]]:
730
730
  """
731
- Specifies environment variables to be set prior to the execution of a step.
731
+ Specifies that the step will success under all circumstances.
732
+
733
+ The decorator will create an optional artifact, specified by `var`, which
734
+ contains the exception raised. You can use it to detect the presence
735
+ of errors, indicating that all happy-path artifacts produced by the step
736
+ are missing.
732
737
 
733
738
  Parameters
734
739
  ----------
735
- vars : Dict[str, str], default {}
736
- Dictionary of environment variables to set.
740
+ var : str, optional, default None
741
+ Name of the artifact in which to store the caught exception.
742
+ If not specified, the exception is not stored.
743
+ print_exception : bool, default True
744
+ Determines whether or not the exception is printed to
745
+ stdout when caught.
737
746
  """
738
747
  ...
739
748
 
740
749
  @typing.overload
741
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
750
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
742
751
  ...
743
752
 
744
753
  @typing.overload
745
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
754
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
746
755
  ...
747
756
 
748
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
757
+ 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):
749
758
  """
750
- Specifies environment variables to be set prior to the execution of a step.
759
+ Specifies that the step will success under all circumstances.
760
+
761
+ The decorator will create an optional artifact, specified by `var`, which
762
+ contains the exception raised. You can use it to detect the presence
763
+ of errors, indicating that all happy-path artifacts produced by the step
764
+ are missing.
751
765
 
752
766
  Parameters
753
767
  ----------
754
- vars : Dict[str, str], default {}
755
- Dictionary of environment variables to set.
768
+ var : str, optional, default None
769
+ Name of the artifact in which to store the caught exception.
770
+ If not specified, the exception is not stored.
771
+ print_exception : bool, default True
772
+ Determines whether or not the exception is printed to
773
+ stdout when caught.
774
+ """
775
+ ...
776
+
777
+ @typing.overload
778
+ 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]]]:
779
+ """
780
+ Specifies a timeout for your step.
781
+
782
+ This decorator is useful if this step may hang indefinitely.
783
+
784
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
785
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
786
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
787
+
788
+ Note that all the values specified in parameters are added together so if you specify
789
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
790
+
791
+ Parameters
792
+ ----------
793
+ seconds : int, default 0
794
+ Number of seconds to wait prior to timing out.
795
+ minutes : int, default 0
796
+ Number of minutes to wait prior to timing out.
797
+ hours : int, default 0
798
+ Number of hours to wait prior to timing out.
799
+ """
800
+ ...
801
+
802
+ @typing.overload
803
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
804
+ ...
805
+
806
+ @typing.overload
807
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
808
+ ...
809
+
810
+ 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):
811
+ """
812
+ Specifies a timeout for your step.
813
+
814
+ This decorator is useful if this step may hang indefinitely.
815
+
816
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
817
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
818
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
819
+
820
+ Note that all the values specified in parameters are added together so if you specify
821
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
822
+
823
+ Parameters
824
+ ----------
825
+ seconds : int, default 0
826
+ Number of seconds to wait prior to timing out.
827
+ minutes : int, default 0
828
+ Number of minutes to wait prior to timing out.
829
+ hours : int, default 0
830
+ Number of hours to wait prior to timing out.
756
831
  """
757
832
  ...
758
833
 
759
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, port: typing.Optional[int] = None, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
834
+ 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]]]:
760
835
  """
761
836
  Specifies that this step should execute on Kubernetes.
762
837
 
@@ -808,143 +883,215 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
808
883
  persistent_volume_claims : Dict[str, str], optional, default None
809
884
  A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
810
885
  volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
811
- port: int, optional
812
- Number of the port to specify in the Kubernetes job object
813
886
  shared_memory: int, optional
814
- Shared memory size (in MiB) required for this steps
887
+ Shared memory size (in MiB) required for this step
888
+ port: int, optional
889
+ Port number to specify in the Kubernetes job object
815
890
  """
816
891
  ...
817
892
 
818
893
  @typing.overload
819
- 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]]]:
894
+ 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]]]:
820
895
  """
821
- Specifies a timeout for your step.
822
-
823
- This decorator is useful if this step may hang indefinitely.
824
-
825
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
826
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
827
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
896
+ Creates a human-readable report, a Metaflow Card, after this step completes.
828
897
 
829
- Note that all the values specified in parameters are added together so if you specify
830
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
898
+ Note that you may add multiple `@card` decorators in a step with different parameters.
831
899
 
832
900
  Parameters
833
901
  ----------
834
- seconds : int, default 0
835
- Number of seconds to wait prior to timing out.
836
- minutes : int, default 0
837
- Number of minutes to wait prior to timing out.
838
- hours : int, default 0
839
- Number of hours to wait prior to timing out.
902
+ type : str, default 'default'
903
+ Card type.
904
+ id : str, optional, default None
905
+ If multiple cards are present, use this id to identify this card.
906
+ options : Dict[str, Any], default {}
907
+ Options passed to the card. The contents depend on the card type.
908
+ timeout : int, default 45
909
+ Interrupt reporting if it takes more than this many seconds.
910
+
911
+
840
912
  """
841
913
  ...
842
914
 
843
915
  @typing.overload
844
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
916
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
845
917
  ...
846
918
 
847
919
  @typing.overload
848
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
920
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
849
921
  ...
850
922
 
851
- 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):
923
+ 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):
852
924
  """
853
- Specifies a timeout for your step.
925
+ Creates a human-readable report, a Metaflow Card, after this step completes.
854
926
 
855
- This decorator is useful if this step may hang indefinitely.
927
+ Note that you may add multiple `@card` decorators in a step with different parameters.
856
928
 
857
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
858
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
859
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
929
+ Parameters
930
+ ----------
931
+ type : str, default 'default'
932
+ Card type.
933
+ id : str, optional, default None
934
+ If multiple cards are present, use this id to identify this card.
935
+ options : Dict[str, Any], default {}
936
+ Options passed to the card. The contents depend on the card type.
937
+ timeout : int, default 45
938
+ Interrupt reporting if it takes more than this many seconds.
860
939
 
861
- Note that all the values specified in parameters are added together so if you specify
862
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
940
+
941
+ """
942
+ ...
943
+
944
+ @typing.overload
945
+ 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]]]:
946
+ """
947
+ Specifies secrets to be retrieved and injected as environment variables prior to
948
+ the execution of a step.
863
949
 
864
950
  Parameters
865
951
  ----------
866
- seconds : int, default 0
867
- Number of seconds to wait prior to timing out.
868
- minutes : int, default 0
869
- Number of minutes to wait prior to timing out.
870
- hours : int, default 0
871
- Number of hours to wait prior to timing out.
952
+ sources : List[Union[str, Dict[str, Any]]], default: []
953
+ List of secret specs, defining how the secrets are to be retrieved
872
954
  """
873
955
  ...
874
956
 
875
957
  @typing.overload
876
- def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
958
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
959
+ ...
960
+
961
+ @typing.overload
962
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
963
+ ...
964
+
965
+ 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]]] = []):
877
966
  """
878
- Specifies the Conda environment for the step.
967
+ Specifies secrets to be retrieved and injected as environment variables prior to
968
+ the execution of a step.
969
+
970
+ Parameters
971
+ ----------
972
+ sources : List[Union[str, Dict[str, Any]]], default: []
973
+ List of secret specs, defining how the secrets are to be retrieved
974
+ """
975
+ ...
976
+
977
+ @typing.overload
978
+ 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]]]:
979
+ """
980
+ Specifies the PyPI packages for the step.
879
981
 
880
982
  Information in this decorator will augment any
881
- attributes set in the `@conda_base` flow-level decorator. Hence,
882
- you can use `@conda_base` to set packages required by all
883
- steps and use `@conda` to specify step-specific overrides.
983
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
984
+ you can use `@pypi_base` to set packages required by all
985
+ steps and use `@pypi` to specify step-specific overrides.
884
986
 
885
987
  Parameters
886
988
  ----------
887
- packages : Dict[str, str], default {}
989
+ packages : Dict[str, str], default: {}
888
990
  Packages to use for this step. The key is the name of the package
889
991
  and the value is the version to use.
890
- libraries : Dict[str, str], default {}
891
- Supported for backward compatibility. When used with packages, packages will take precedence.
892
- python : str, optional, default None
992
+ python : str, optional, default: None
893
993
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
894
994
  that the version used will correspond to the version of the Python interpreter used to start the run.
895
- disabled : bool, default False
896
- If set to True, disables @conda.
897
995
  """
898
996
  ...
899
997
 
900
998
  @typing.overload
901
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
999
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
902
1000
  ...
903
1001
 
904
1002
  @typing.overload
905
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1003
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
906
1004
  ...
907
1005
 
908
- def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1006
+ 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):
909
1007
  """
910
- Specifies the Conda environment for the step.
1008
+ Specifies the PyPI packages for the step.
911
1009
 
912
1010
  Information in this decorator will augment any
913
- attributes set in the `@conda_base` flow-level decorator. Hence,
914
- you can use `@conda_base` to set packages required by all
915
- steps and use `@conda` to specify step-specific overrides.
1011
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1012
+ you can use `@pypi_base` to set packages required by all
1013
+ steps and use `@pypi` to specify step-specific overrides.
916
1014
 
917
1015
  Parameters
918
1016
  ----------
919
- packages : Dict[str, str], default {}
1017
+ packages : Dict[str, str], default: {}
920
1018
  Packages to use for this step. The key is the name of the package
921
1019
  and the value is the version to use.
922
- libraries : Dict[str, str], default {}
923
- Supported for backward compatibility. When used with packages, packages will take precedence.
924
- python : str, optional, default None
1020
+ python : str, optional, default: None
925
1021
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
926
1022
  that the version used will correspond to the version of the Python interpreter used to start the run.
927
- disabled : bool, default False
928
- If set to True, disables @conda.
929
1023
  """
930
1024
  ...
931
1025
 
932
1026
  @typing.overload
933
- def resources(*, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1027
+ 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]]]:
934
1028
  """
935
- Specifies the resources needed when executing this step.
1029
+ Specifies the number of times the task corresponding
1030
+ to a step needs to be retried.
936
1031
 
937
- Use `@resources` to specify the resource requirements
938
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1032
+ This decorator is useful for handling transient errors, such as networking issues.
1033
+ If your task contains operations that can't be retried safely, e.g. database updates,
1034
+ it is advisable to annotate it with `@retry(times=0)`.
939
1035
 
940
- You can choose the compute layer on the command line by executing e.g.
941
- ```
942
- python myflow.py run --with batch
943
- ```
944
- or
945
- ```
946
- python myflow.py run --with kubernetes
947
- ```
1036
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1037
+ decorator will execute a no-op task after all retries have been exhausted,
1038
+ ensuring that the flow execution can continue.
1039
+
1040
+ Parameters
1041
+ ----------
1042
+ times : int, default 3
1043
+ Number of times to retry this task.
1044
+ minutes_between_retries : int, default 2
1045
+ Number of minutes between retries.
1046
+ """
1047
+ ...
1048
+
1049
+ @typing.overload
1050
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1051
+ ...
1052
+
1053
+ @typing.overload
1054
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1055
+ ...
1056
+
1057
+ 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):
1058
+ """
1059
+ Specifies the number of times the task corresponding
1060
+ to a step needs to be retried.
1061
+
1062
+ This decorator is useful for handling transient errors, such as networking issues.
1063
+ If your task contains operations that can't be retried safely, e.g. database updates,
1064
+ it is advisable to annotate it with `@retry(times=0)`.
1065
+
1066
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1067
+ decorator will execute a no-op task after all retries have been exhausted,
1068
+ ensuring that the flow execution can continue.
1069
+
1070
+ Parameters
1071
+ ----------
1072
+ times : int, default 3
1073
+ Number of times to retry this task.
1074
+ minutes_between_retries : int, default 2
1075
+ Number of minutes between retries.
1076
+ """
1077
+ ...
1078
+
1079
+ @typing.overload
1080
+ 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]]]:
1081
+ """
1082
+ Specifies the resources needed when executing this step.
1083
+
1084
+ Use `@resources` to specify the resource requirements
1085
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1086
+
1087
+ You can choose the compute layer on the command line by executing e.g.
1088
+ ```
1089
+ python myflow.py run --with batch
1090
+ ```
1091
+ or
1092
+ ```
1093
+ python myflow.py run --with kubernetes
1094
+ ```
948
1095
  which executes the flow on the desired system using the
949
1096
  requirements specified in `@resources`.
950
1097
 
@@ -1006,6 +1153,94 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
1006
1153
  """
1007
1154
  ...
1008
1155
 
1156
+ @typing.overload
1157
+ 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]]]:
1158
+ """
1159
+ Specifies the Conda environment for the step.
1160
+
1161
+ Information in this decorator will augment any
1162
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1163
+ you can use `@conda_base` to set packages required by all
1164
+ steps and use `@conda` to specify step-specific overrides.
1165
+
1166
+ Parameters
1167
+ ----------
1168
+ packages : Dict[str, str], default {}
1169
+ Packages to use for this step. The key is the name of the package
1170
+ and the value is the version to use.
1171
+ libraries : Dict[str, str], default {}
1172
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1173
+ python : str, optional, default None
1174
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1175
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1176
+ disabled : bool, default False
1177
+ If set to True, disables @conda.
1178
+ """
1179
+ ...
1180
+
1181
+ @typing.overload
1182
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1183
+ ...
1184
+
1185
+ @typing.overload
1186
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1187
+ ...
1188
+
1189
+ 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):
1190
+ """
1191
+ Specifies the Conda environment for the step.
1192
+
1193
+ Information in this decorator will augment any
1194
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1195
+ you can use `@conda_base` to set packages required by all
1196
+ steps and use `@conda` to specify step-specific overrides.
1197
+
1198
+ Parameters
1199
+ ----------
1200
+ packages : Dict[str, str], default {}
1201
+ Packages to use for this step. The key is the name of the package
1202
+ and the value is the version to use.
1203
+ libraries : Dict[str, str], default {}
1204
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1205
+ python : str, optional, default None
1206
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1207
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1208
+ disabled : bool, default False
1209
+ If set to True, disables @conda.
1210
+ """
1211
+ ...
1212
+
1213
+ @typing.overload
1214
+ 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]]]:
1215
+ """
1216
+ Specifies environment variables to be set prior to the execution of a step.
1217
+
1218
+ Parameters
1219
+ ----------
1220
+ vars : Dict[str, str], default {}
1221
+ Dictionary of environment variables to set.
1222
+ """
1223
+ ...
1224
+
1225
+ @typing.overload
1226
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1227
+ ...
1228
+
1229
+ @typing.overload
1230
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1231
+ ...
1232
+
1233
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1234
+ """
1235
+ Specifies environment variables to be set prior to the execution of a step.
1236
+
1237
+ Parameters
1238
+ ----------
1239
+ vars : Dict[str, str], default {}
1240
+ Dictionary of environment variables to set.
1241
+ """
1242
+ ...
1243
+
1009
1244
  @typing.overload
1010
1245
  def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1011
1246
  """
@@ -1153,351 +1388,143 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1153
1388
  """
1154
1389
  ...
1155
1390
 
1156
- @typing.overload
1157
- def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1391
+ 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]]:
1158
1392
  """
1159
- Specifies the number of times the task corresponding
1160
- to a step needs to be retried.
1161
-
1162
- This decorator is useful for handling transient errors, such as networking issues.
1163
- If your task contains operations that can't be retried safely, e.g. database updates,
1164
- it is advisable to annotate it with `@retry(times=0)`.
1165
-
1166
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1167
- decorator will execute a no-op task after all retries have been exhausted,
1168
- ensuring that the flow execution can continue.
1393
+ 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)
1394
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1395
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1396
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1397
+ starts only after all sensors finish.
1169
1398
 
1170
1399
  Parameters
1171
1400
  ----------
1172
- times : int, default 3
1173
- Number of times to retry this task.
1174
- minutes_between_retries : int, default 2
1175
- Number of minutes between retries.
1401
+ timeout : int
1402
+ Time, in seconds before the task times out and fails. (Default: 3600)
1403
+ poke_interval : int
1404
+ Time in seconds that the job should wait in between each try. (Default: 60)
1405
+ mode : str
1406
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1407
+ exponential_backoff : bool
1408
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1409
+ pool : str
1410
+ the slot pool this task should run in,
1411
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1412
+ soft_fail : bool
1413
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1414
+ name : str
1415
+ Name of the sensor on Airflow
1416
+ description : str
1417
+ Description of sensor in the Airflow UI
1418
+ bucket_key : Union[str, List[str]]
1419
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1420
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1421
+ bucket_name : str
1422
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1423
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1424
+ wildcard_match : bool
1425
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1426
+ aws_conn_id : str
1427
+ a reference to the s3 connection on Airflow. (Default: None)
1428
+ verify : bool
1429
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1176
1430
  """
1177
1431
  ...
1178
1432
 
1179
1433
  @typing.overload
1180
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1181
- ...
1182
-
1183
- @typing.overload
1184
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1185
- ...
1186
-
1187
- def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
1434
+ 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]]:
1188
1435
  """
1189
- Specifies the number of times the task corresponding
1190
- to a step needs to be retried.
1191
-
1192
- This decorator is useful for handling transient errors, such as networking issues.
1193
- If your task contains operations that can't be retried safely, e.g. database updates,
1194
- it is advisable to annotate it with `@retry(times=0)`.
1436
+ Specifies the Conda environment for all steps of the flow.
1195
1437
 
1196
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1197
- decorator will execute a no-op task after all retries have been exhausted,
1198
- ensuring that the flow execution can continue.
1438
+ Use `@conda_base` to set common libraries required by all
1439
+ steps and use `@conda` to specify step-specific additions.
1199
1440
 
1200
1441
  Parameters
1201
1442
  ----------
1202
- times : int, default 3
1203
- Number of times to retry this task.
1204
- minutes_between_retries : int, default 2
1205
- Number of minutes between retries.
1443
+ packages : Dict[str, str], default {}
1444
+ Packages to use for this flow. The key is the name of the package
1445
+ and the value is the version to use.
1446
+ libraries : Dict[str, str], default {}
1447
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1448
+ python : str, optional, default None
1449
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1450
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1451
+ disabled : bool, default False
1452
+ If set to True, disables Conda.
1206
1453
  """
1207
1454
  ...
1208
1455
 
1209
1456
  @typing.overload
1210
- def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1457
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1458
+ ...
1459
+
1460
+ 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):
1211
1461
  """
1212
- Specifies the PyPI packages for the step.
1462
+ Specifies the Conda environment for all steps of the flow.
1213
1463
 
1214
- Information in this decorator will augment any
1215
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1216
- you can use `@pypi_base` to set packages required by all
1217
- steps and use `@pypi` to specify step-specific overrides.
1464
+ Use `@conda_base` to set common libraries required by all
1465
+ steps and use `@conda` to specify step-specific additions.
1218
1466
 
1219
1467
  Parameters
1220
1468
  ----------
1221
- packages : Dict[str, str], default: {}
1222
- Packages to use for this step. The key is the name of the package
1469
+ packages : Dict[str, str], default {}
1470
+ Packages to use for this flow. The key is the name of the package
1223
1471
  and the value is the version to use.
1224
- python : str, optional, default: None
1472
+ libraries : Dict[str, str], default {}
1473
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1474
+ python : str, optional, default None
1225
1475
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1226
1476
  that the version used will correspond to the version of the Python interpreter used to start the run.
1477
+ disabled : bool, default False
1478
+ If set to True, disables Conda.
1227
1479
  """
1228
1480
  ...
1229
1481
 
1230
1482
  @typing.overload
1231
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1232
- ...
1233
-
1234
- @typing.overload
1235
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1236
- ...
1237
-
1238
- def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1239
- """
1240
- Specifies the PyPI packages for the step.
1241
-
1242
- Information in this decorator will augment any
1243
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1244
- you can use `@pypi_base` to set packages required by all
1245
- steps and use `@pypi` to specify step-specific overrides.
1246
-
1247
- Parameters
1248
- ----------
1249
- packages : Dict[str, str], default: {}
1250
- Packages to use for this step. The key is the name of the package
1251
- and the value is the version to use.
1252
- python : str, optional, default: None
1253
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1254
- that the version used will correspond to the version of the Python interpreter used to start the run.
1255
- """
1256
- ...
1257
-
1258
- @typing.overload
1259
- def card(*, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1260
- """
1261
- Creates a human-readable report, a Metaflow Card, after this step completes.
1262
-
1263
- Note that you may add multiple `@card` decorators in a step with different parameters.
1264
-
1265
- Parameters
1266
- ----------
1267
- type : str, default 'default'
1268
- Card type.
1269
- id : str, optional, default None
1270
- If multiple cards are present, use this id to identify this card.
1271
- options : Dict[str, Any], default {}
1272
- Options passed to the card. The contents depend on the card type.
1273
- timeout : int, default 45
1274
- Interrupt reporting if it takes more than this many seconds.
1275
-
1276
-
1277
- """
1278
- ...
1279
-
1280
- @typing.overload
1281
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1282
- ...
1283
-
1284
- @typing.overload
1285
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1286
- ...
1287
-
1288
- 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):
1289
- """
1290
- Creates a human-readable report, a Metaflow Card, after this step completes.
1291
-
1292
- Note that you may add multiple `@card` decorators in a step with different parameters.
1293
-
1294
- Parameters
1295
- ----------
1296
- type : str, default 'default'
1297
- Card type.
1298
- id : str, optional, default None
1299
- If multiple cards are present, use this id to identify this card.
1300
- options : Dict[str, Any], default {}
1301
- Options passed to the card. The contents depend on the card type.
1302
- timeout : int, default 45
1303
- Interrupt reporting if it takes more than this many seconds.
1304
-
1305
-
1306
- """
1307
- ...
1308
-
1309
- @typing.overload
1310
- def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1311
- """
1312
- Specifies secrets to be retrieved and injected as environment variables prior to
1313
- the execution of a step.
1314
-
1315
- Parameters
1316
- ----------
1317
- sources : List[Union[str, Dict[str, Any]]], default: []
1318
- List of secret specs, defining how the secrets are to be retrieved
1319
- """
1320
- ...
1321
-
1322
- @typing.overload
1323
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1324
- ...
1325
-
1326
- @typing.overload
1327
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1328
- ...
1329
-
1330
- def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
1331
- """
1332
- Specifies secrets to be retrieved and injected as environment variables prior to
1333
- the execution of a step.
1334
-
1335
- Parameters
1336
- ----------
1337
- sources : List[Union[str, Dict[str, Any]]], default: []
1338
- List of secret specs, defining how the secrets are to be retrieved
1339
- """
1340
- ...
1341
-
1342
- @typing.overload
1343
- def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1344
- """
1345
- Specifies that the step will success under all circumstances.
1346
-
1347
- The decorator will create an optional artifact, specified by `var`, which
1348
- contains the exception raised. You can use it to detect the presence
1349
- of errors, indicating that all happy-path artifacts produced by the step
1350
- are missing.
1351
-
1352
- Parameters
1353
- ----------
1354
- var : str, optional, default None
1355
- Name of the artifact in which to store the caught exception.
1356
- If not specified, the exception is not stored.
1357
- print_exception : bool, default True
1358
- Determines whether or not the exception is printed to
1359
- stdout when caught.
1360
- """
1361
- ...
1362
-
1363
- @typing.overload
1364
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1365
- ...
1366
-
1367
- @typing.overload
1368
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1369
- ...
1370
-
1371
- 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):
1372
- """
1373
- Specifies that the step will success under all circumstances.
1374
-
1375
- The decorator will create an optional artifact, specified by `var`, which
1376
- contains the exception raised. You can use it to detect the presence
1377
- of errors, indicating that all happy-path artifacts produced by the step
1378
- are missing.
1379
-
1380
- Parameters
1381
- ----------
1382
- var : str, optional, default None
1383
- Name of the artifact in which to store the caught exception.
1384
- If not specified, the exception is not stored.
1385
- print_exception : bool, default True
1386
- Determines whether or not the exception is printed to
1387
- stdout when caught.
1388
- """
1389
- ...
1390
-
1391
- @typing.overload
1392
- def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1483
+ 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]]:
1393
1484
  """
1394
- Specifies the event(s) that this flow depends on.
1395
-
1396
- ```
1397
- @trigger(event='foo')
1398
- ```
1399
- or
1400
- ```
1401
- @trigger(events=['foo', 'bar'])
1402
- ```
1403
-
1404
- Additionally, you can specify the parameter mappings
1405
- to map event payload to Metaflow parameters for the flow.
1406
- ```
1407
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1408
- ```
1409
- or
1410
- ```
1411
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1412
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1413
- ```
1414
-
1415
- 'parameters' can also be a list of strings and tuples like so:
1416
- ```
1417
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1418
- ```
1419
- This is equivalent to:
1420
- ```
1421
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1422
- ```
1485
+ Specifies the times when the flow should be run when running on a
1486
+ production scheduler.
1423
1487
 
1424
1488
  Parameters
1425
1489
  ----------
1426
- event : Union[str, Dict[str, Any]], optional, default None
1427
- Event dependency for this flow.
1428
- events : List[Union[str, Dict[str, Any]]], default []
1429
- Events dependency for this flow.
1430
- options : Dict[str, Any], default {}
1431
- Backend-specific configuration for tuning eventing behavior.
1432
-
1433
-
1490
+ hourly : bool, default False
1491
+ Run the workflow hourly.
1492
+ daily : bool, default True
1493
+ Run the workflow daily.
1494
+ weekly : bool, default False
1495
+ Run the workflow weekly.
1496
+ cron : str, optional, default None
1497
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1498
+ specified by this expression.
1499
+ timezone : str, optional, default None
1500
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1501
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1434
1502
  """
1435
1503
  ...
1436
1504
 
1437
1505
  @typing.overload
1438
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1439
- ...
1440
-
1441
- def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1442
- """
1443
- Specifies the event(s) that this flow depends on.
1444
-
1445
- ```
1446
- @trigger(event='foo')
1447
- ```
1448
- or
1449
- ```
1450
- @trigger(events=['foo', 'bar'])
1451
- ```
1452
-
1453
- Additionally, you can specify the parameter mappings
1454
- to map event payload to Metaflow parameters for the flow.
1455
- ```
1456
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1457
- ```
1458
- or
1459
- ```
1460
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1461
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1462
- ```
1463
-
1464
- 'parameters' can also be a list of strings and tuples like so:
1465
- ```
1466
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1467
- ```
1468
- This is equivalent to:
1469
- ```
1470
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1471
- ```
1472
-
1473
- Parameters
1474
- ----------
1475
- event : Union[str, Dict[str, Any]], optional, default None
1476
- Event dependency for this flow.
1477
- events : List[Union[str, Dict[str, Any]]], default []
1478
- Events dependency for this flow.
1479
- options : Dict[str, Any], default {}
1480
- Backend-specific configuration for tuning eventing behavior.
1481
-
1482
-
1483
- """
1506
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1484
1507
  ...
1485
1508
 
1486
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1509
+ 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):
1487
1510
  """
1488
- Specifies what flows belong to the same project.
1489
-
1490
- A project-specific namespace is created for all flows that
1491
- use the same `@project(name)`.
1511
+ Specifies the times when the flow should be run when running on a
1512
+ production scheduler.
1492
1513
 
1493
1514
  Parameters
1494
1515
  ----------
1495
- name : str
1496
- Project name. Make sure that the name is unique amongst all
1497
- projects that use the same production scheduler. The name may
1498
- contain only lowercase alphanumeric characters and underscores.
1499
-
1500
-
1516
+ hourly : bool, default False
1517
+ Run the workflow hourly.
1518
+ daily : bool, default True
1519
+ Run the workflow daily.
1520
+ weekly : bool, default False
1521
+ Run the workflow weekly.
1522
+ cron : str, optional, default None
1523
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1524
+ specified by this expression.
1525
+ timezone : str, optional, default None
1526
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1527
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1501
1528
  """
1502
1529
  ...
1503
1530
 
@@ -1604,55 +1631,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1604
1631
  """
1605
1632
  ...
1606
1633
 
1607
- @typing.overload
1608
- 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]]:
1609
- """
1610
- Specifies the times when the flow should be run when running on a
1611
- production scheduler.
1612
-
1613
- Parameters
1614
- ----------
1615
- hourly : bool, default False
1616
- Run the workflow hourly.
1617
- daily : bool, default True
1618
- Run the workflow daily.
1619
- weekly : bool, default False
1620
- Run the workflow weekly.
1621
- cron : str, optional, default None
1622
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1623
- specified by this expression.
1624
- timezone : str, optional, default None
1625
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1626
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1627
- """
1628
- ...
1629
-
1630
- @typing.overload
1631
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1632
- ...
1633
-
1634
- 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):
1635
- """
1636
- Specifies the times when the flow should be run when running on a
1637
- production scheduler.
1638
-
1639
- Parameters
1640
- ----------
1641
- hourly : bool, default False
1642
- Run the workflow hourly.
1643
- daily : bool, default True
1644
- Run the workflow daily.
1645
- weekly : bool, default False
1646
- Run the workflow weekly.
1647
- cron : str, optional, default None
1648
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1649
- specified by this expression.
1650
- timezone : str, optional, default None
1651
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1652
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1653
- """
1654
- ...
1655
-
1656
1634
  @typing.overload
1657
1635
  def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1658
1636
  """
@@ -1734,94 +1712,116 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1734
1712
  """
1735
1713
  ...
1736
1714
 
1737
- @typing.overload
1738
- 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]]:
1715
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1739
1716
  """
1740
- Specifies the Conda environment for all steps of the flow.
1717
+ Specifies what flows belong to the same project.
1741
1718
 
1742
- Use `@conda_base` to set common libraries required by all
1743
- steps and use `@conda` to specify step-specific additions.
1719
+ A project-specific namespace is created for all flows that
1720
+ use the same `@project(name)`.
1744
1721
 
1745
1722
  Parameters
1746
1723
  ----------
1747
- packages : Dict[str, str], default {}
1748
- Packages to use for this flow. The key is the name of the package
1749
- and the value is the version to use.
1750
- libraries : Dict[str, str], default {}
1751
- Supported for backward compatibility. When used with packages, packages will take precedence.
1752
- python : str, optional, default None
1753
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1754
- that the version used will correspond to the version of the Python interpreter used to start the run.
1755
- disabled : bool, default False
1756
- If set to True, disables Conda.
1724
+ name : str
1725
+ Project name. Make sure that the name is unique amongst all
1726
+ projects that use the same production scheduler. The name may
1727
+ contain only lowercase alphanumeric characters and underscores.
1728
+
1729
+
1757
1730
  """
1758
1731
  ...
1759
1732
 
1760
1733
  @typing.overload
1761
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1762
- ...
1763
-
1764
- 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):
1734
+ def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1765
1735
  """
1766
- Specifies the Conda environment for all steps of the flow.
1736
+ Specifies the event(s) that this flow depends on.
1767
1737
 
1768
- Use `@conda_base` to set common libraries required by all
1769
- steps and use `@conda` to specify step-specific additions.
1738
+ ```
1739
+ @trigger(event='foo')
1740
+ ```
1741
+ or
1742
+ ```
1743
+ @trigger(events=['foo', 'bar'])
1744
+ ```
1745
+
1746
+ Additionally, you can specify the parameter mappings
1747
+ to map event payload to Metaflow parameters for the flow.
1748
+ ```
1749
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1750
+ ```
1751
+ or
1752
+ ```
1753
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1754
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1755
+ ```
1756
+
1757
+ 'parameters' can also be a list of strings and tuples like so:
1758
+ ```
1759
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1760
+ ```
1761
+ This is equivalent to:
1762
+ ```
1763
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1764
+ ```
1770
1765
 
1771
1766
  Parameters
1772
1767
  ----------
1773
- packages : Dict[str, str], default {}
1774
- Packages to use for this flow. The key is the name of the package
1775
- and the value is the version to use.
1776
- libraries : Dict[str, str], default {}
1777
- Supported for backward compatibility. When used with packages, packages will take precedence.
1778
- python : str, optional, default None
1779
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1780
- that the version used will correspond to the version of the Python interpreter used to start the run.
1781
- disabled : bool, default False
1782
- If set to True, disables Conda.
1768
+ event : Union[str, Dict[str, Any]], optional, default None
1769
+ Event dependency for this flow.
1770
+ events : List[Union[str, Dict[str, Any]]], default []
1771
+ Events dependency for this flow.
1772
+ options : Dict[str, Any], default {}
1773
+ Backend-specific configuration for tuning eventing behavior.
1774
+
1775
+
1783
1776
  """
1784
1777
  ...
1785
1778
 
1786
- 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]]:
1779
+ @typing.overload
1780
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1781
+ ...
1782
+
1783
+ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1787
1784
  """
1788
- 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)
1789
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1790
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1791
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1792
- starts only after all sensors finish.
1785
+ Specifies the event(s) that this flow depends on.
1786
+
1787
+ ```
1788
+ @trigger(event='foo')
1789
+ ```
1790
+ or
1791
+ ```
1792
+ @trigger(events=['foo', 'bar'])
1793
+ ```
1794
+
1795
+ Additionally, you can specify the parameter mappings
1796
+ to map event payload to Metaflow parameters for the flow.
1797
+ ```
1798
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1799
+ ```
1800
+ or
1801
+ ```
1802
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1803
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1804
+ ```
1805
+
1806
+ 'parameters' can also be a list of strings and tuples like so:
1807
+ ```
1808
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1809
+ ```
1810
+ This is equivalent to:
1811
+ ```
1812
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1813
+ ```
1793
1814
 
1794
1815
  Parameters
1795
1816
  ----------
1796
- timeout : int
1797
- Time, in seconds before the task times out and fails. (Default: 3600)
1798
- poke_interval : int
1799
- Time in seconds that the job should wait in between each try. (Default: 60)
1800
- mode : str
1801
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1802
- exponential_backoff : bool
1803
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1804
- pool : str
1805
- the slot pool this task should run in,
1806
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1807
- soft_fail : bool
1808
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1809
- name : str
1810
- Name of the sensor on Airflow
1811
- description : str
1812
- Description of sensor in the Airflow UI
1813
- bucket_key : Union[str, List[str]]
1814
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1815
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1816
- bucket_name : str
1817
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1818
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1819
- wildcard_match : bool
1820
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1821
- aws_conn_id : str
1822
- a reference to the s3 connection on Airflow. (Default: None)
1823
- verify : bool
1824
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1817
+ event : Union[str, Dict[str, Any]], optional, default None
1818
+ Event dependency for this flow.
1819
+ events : List[Union[str, Dict[str, Any]]], default []
1820
+ Events dependency for this flow.
1821
+ options : Dict[str, Any], default {}
1822
+ Backend-specific configuration for tuning eventing behavior.
1823
+
1824
+
1825
1825
  """
1826
1826
  ...
1827
1827