metaflow-stubs 2.12.2__py2.py3-none-any.whl → 2.12.4__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 +598 -597
  2. metaflow-stubs/cards.pyi +5 -5
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/client/__init__.pyi +5 -5
  5. metaflow-stubs/client/core.pyi +8 -8
  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 +5 -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 +4 -2
  16. metaflow-stubs/metaflow_current.pyi +5 -5
  17. metaflow-stubs/mflog/mflog.pyi +2 -2
  18. metaflow-stubs/multicore_utils.pyi +2 -2
  19. metaflow-stubs/parameters.pyi +10 -4
  20. metaflow-stubs/plugins/__init__.pyi +2 -2
  21. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  22. metaflow-stubs/plugins/airflow/airflow.pyi +2 -2
  23. metaflow-stubs/plugins/airflow/airflow_cli.pyi +2 -2
  24. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +4 -4
  28. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
  29. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +4 -4
  30. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +4 -4
  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 +2 -2
  35. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +3 -3
  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 +2 -2
  45. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  46. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  47. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  48. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  52. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  53. metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +3 -3
  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 +3 -3
  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 +5 -5
  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 +2 -2
  69. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/basic.pyi +4 -4
  71. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
  73. metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
  74. metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
  77. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  78. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  79. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  80. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +3 -3
  81. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  82. metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
  83. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  84. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  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 +7 -6
  89. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  90. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  91. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  92. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  93. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  94. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  95. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  96. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  97. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  98. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  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 +2 -2
  106. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  107. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  108. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  109. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  110. metaflow-stubs/plugins/logs_cli.pyi +3 -3
  111. metaflow-stubs/plugins/package_cli.pyi +2 -2
  112. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  113. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  114. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  115. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  116. metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
  117. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  118. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  119. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  120. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  121. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  122. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  123. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
  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 +5 -5
  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/pylint_wrapper.pyi +2 -2
  131. metaflow-stubs/runner/__init__.pyi +2 -2
  132. metaflow-stubs/runner/metaflow_runner.pyi +5 -5
  133. metaflow-stubs/runner/nbrun.pyi +2 -2
  134. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  135. metaflow-stubs/tagging_util.pyi +2 -2
  136. metaflow-stubs/tuple_util.pyi +2 -2
  137. metaflow-stubs/version.pyi +2 -2
  138. {metaflow_stubs-2.12.2.dist-info → metaflow_stubs-2.12.4.dist-info}/METADATA +2 -2
  139. metaflow_stubs-2.12.4.dist-info/RECORD +142 -0
  140. metaflow_stubs-2.12.2.dist-info/RECORD +0 -142
  141. {metaflow_stubs-2.12.2.dist-info → metaflow_stubs-2.12.4.dist-info}/WHEEL +0 -0
  142. {metaflow_stubs-2.12.2.dist-info → metaflow_stubs-2.12.4.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.2 #
4
- # Generated on 2024-06-04T07:19:10.055768 #
3
+ # MF version: 2.12.4 #
4
+ # Generated on 2024-06-18T20:28:20.449033 #
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.datastore.inputs
12
- import metaflow.plugins.datatools.s3.s3
13
11
  import metaflow._vendor.click.types
14
- import metaflow.metaflow_current
15
- import metaflow.runner.metaflow_runner
16
- import metaflow.parameters
17
- import metaflow.client.core
18
- import metaflow.events
19
12
  import datetime
13
+ import metaflow.events
14
+ import metaflow.flowspec
20
15
  import io
16
+ import metaflow.client.core
17
+ import metaflow.metaflow_current
18
+ import metaflow.runner.metaflow_runner
21
19
  import typing
20
+ import metaflow.plugins.datatools.s3.s3
21
+ import metaflow.datastore.inputs
22
+ import metaflow.parameters
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,186 +727,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
726
727
  """
727
728
  ...
728
729
 
729
- 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]]]:
730
- """
731
- Specifies that this step should execute on Kubernetes.
732
-
733
- Parameters
734
- ----------
735
- cpu : int, default 1
736
- Number of CPUs required for this step. If `@resources` is
737
- also present, the maximum value from all decorators is used.
738
- memory : int, default 4096
739
- Memory size (in MB) required for this step. If
740
- `@resources` is also present, the maximum value from all decorators is
741
- used.
742
- disk : int, default 10240
743
- Disk 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 Kubernetes. If not specified, and
748
- METAFLOW_KUBERNETES_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
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
751
- If given, the imagePullPolicy to be applied to the Docker image of the step.
752
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
753
- Kubernetes service account to use when launching pod in Kubernetes.
754
- secrets : List[str], optional, default None
755
- Kubernetes secrets to use when launching pod in Kubernetes. These
756
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
757
- in Metaflow configuration.
758
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
759
- Kubernetes namespace to use when launching pod in Kubernetes.
760
- gpu : int, optional, default None
761
- Number of GPUs required for this step. A value of zero implies that
762
- the scheduled node should not have GPUs.
763
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
764
- The vendor of the GPUs to be used for this step.
765
- tolerations : List[str], default []
766
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
767
- Kubernetes tolerations to use when launching pod in Kubernetes.
768
- use_tmpfs : bool, default False
769
- This enables an explicit tmpfs mount for this step.
770
- tmpfs_tempdir : bool, default True
771
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
772
- tmpfs_size : int, optional, default: None
773
- The value for the size (in MiB) of the tmpfs mount for this step.
774
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
775
- memory allocated for this step.
776
- tmpfs_path : str, optional, default /metaflow_temp
777
- Path to tmpfs mount for this step.
778
- persistent_volume_claims : Dict[str, str], optional, default None
779
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
780
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
781
- shared_memory: int, optional
782
- Shared memory size (in MiB) required for this step
783
- port: int, optional
784
- Port number to specify in the Kubernetes job object
785
- """
786
- ...
787
-
788
- @typing.overload
789
- 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]]]:
790
- """
791
- Specifies the Conda environment for the step.
792
-
793
- Information in this decorator will augment any
794
- attributes set in the `@conda_base` flow-level decorator. Hence,
795
- you can use `@conda_base` to set packages required by all
796
- steps and use `@conda` to specify step-specific overrides.
797
-
798
- Parameters
799
- ----------
800
- packages : Dict[str, str], default {}
801
- Packages to use for this step. The key is the name of the package
802
- and the value is the version to use.
803
- libraries : Dict[str, str], default {}
804
- Supported for backward compatibility. When used with packages, packages will take precedence.
805
- python : str, optional, default None
806
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
807
- that the version used will correspond to the version of the Python interpreter used to start the run.
808
- disabled : bool, default False
809
- If set to True, disables @conda.
810
- """
811
- ...
812
-
813
- @typing.overload
814
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
815
- ...
816
-
817
- @typing.overload
818
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
819
- ...
820
-
821
- 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):
822
- """
823
- Specifies the Conda environment for the step.
824
-
825
- Information in this decorator will augment any
826
- attributes set in the `@conda_base` flow-level decorator. Hence,
827
- you can use `@conda_base` to set packages required by all
828
- steps and use `@conda` to specify step-specific overrides.
829
-
830
- Parameters
831
- ----------
832
- packages : Dict[str, str], default {}
833
- Packages to use for this step. The key is the name of the package
834
- and the value is the version to use.
835
- libraries : Dict[str, str], default {}
836
- Supported for backward compatibility. When used with packages, packages will take precedence.
837
- python : str, optional, default None
838
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
839
- that the version used will correspond to the version of the Python interpreter used to start the run.
840
- disabled : bool, default False
841
- If set to True, disables @conda.
842
- """
843
- ...
844
-
845
- @typing.overload
846
- 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]]]:
847
- """
848
- Specifies environment variables to be set prior to the execution of a step.
849
-
850
- Parameters
851
- ----------
852
- vars : Dict[str, str], default {}
853
- Dictionary of environment variables to set.
854
- """
855
- ...
856
-
857
- @typing.overload
858
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
859
- ...
860
-
861
- @typing.overload
862
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
863
- ...
864
-
865
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
866
- """
867
- Specifies environment variables to be set prior to the execution of a step.
868
-
869
- Parameters
870
- ----------
871
- vars : Dict[str, str], default {}
872
- Dictionary of environment variables to set.
873
- """
874
- ...
875
-
876
- @typing.overload
877
- 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]]]:
878
- """
879
- Specifies secrets to be retrieved and injected as environment variables prior to
880
- the execution of a step.
881
-
882
- Parameters
883
- ----------
884
- sources : List[Union[str, Dict[str, Any]]], default: []
885
- List of secret specs, defining how the secrets are to be retrieved
886
- """
887
- ...
888
-
889
- @typing.overload
890
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
891
- ...
892
-
893
- @typing.overload
894
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
895
- ...
896
-
897
- 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]]] = []):
898
- """
899
- Specifies secrets to be retrieved and injected as environment variables prior to
900
- the execution of a step.
901
-
902
- Parameters
903
- ----------
904
- sources : List[Union[str, Dict[str, Any]]], default: []
905
- List of secret specs, defining how the secrets are to be retrieved
906
- """
907
- ...
908
-
909
730
  @typing.overload
910
731
  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]]]:
911
732
  """
@@ -1054,100 +875,123 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1054
875
  ...
1055
876
 
1056
877
  @typing.overload
1057
- 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]]]:
878
+ 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]]]:
1058
879
  """
1059
- Specifies that the step will success under all circumstances.
880
+ Specifies a timeout for your step.
1060
881
 
1061
- The decorator will create an optional artifact, specified by `var`, which
1062
- contains the exception raised. You can use it to detect the presence
1063
- of errors, indicating that all happy-path artifacts produced by the step
1064
- are missing.
882
+ This decorator is useful if this step may hang indefinitely.
883
+
884
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
885
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
886
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
887
+
888
+ Note that all the values specified in parameters are added together so if you specify
889
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1065
890
 
1066
891
  Parameters
1067
892
  ----------
1068
- var : str, optional, default None
1069
- Name of the artifact in which to store the caught exception.
1070
- If not specified, the exception is not stored.
1071
- print_exception : bool, default True
1072
- Determines whether or not the exception is printed to
1073
- stdout when caught.
893
+ seconds : int, default 0
894
+ Number of seconds to wait prior to timing out.
895
+ minutes : int, default 0
896
+ Number of minutes to wait prior to timing out.
897
+ hours : int, default 0
898
+ Number of hours to wait prior to timing out.
1074
899
  """
1075
900
  ...
1076
901
 
1077
902
  @typing.overload
1078
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
903
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1079
904
  ...
1080
905
 
1081
906
  @typing.overload
1082
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
907
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1083
908
  ...
1084
909
 
1085
- 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):
910
+ 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):
1086
911
  """
1087
- Specifies that the step will success under all circumstances.
912
+ Specifies a timeout for your step.
1088
913
 
1089
- The decorator will create an optional artifact, specified by `var`, which
1090
- contains the exception raised. You can use it to detect the presence
1091
- of errors, indicating that all happy-path artifacts produced by the step
1092
- are missing.
914
+ This decorator is useful if this step may hang indefinitely.
915
+
916
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
917
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
918
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
919
+
920
+ Note that all the values specified in parameters are added together so if you specify
921
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1093
922
 
1094
923
  Parameters
1095
924
  ----------
1096
- var : str, optional, default None
1097
- Name of the artifact in which to store the caught exception.
1098
- If not specified, the exception is not stored.
1099
- print_exception : bool, default True
1100
- Determines whether or not the exception is printed to
1101
- stdout when caught.
925
+ seconds : int, default 0
926
+ Number of seconds to wait prior to timing out.
927
+ minutes : int, default 0
928
+ Number of minutes to wait prior to timing out.
929
+ hours : int, default 0
930
+ Number of hours to wait prior to timing out.
1102
931
  """
1103
932
  ...
1104
933
 
1105
934
  @typing.overload
1106
- 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]]]:
935
+ 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]]]:
1107
936
  """
1108
- Specifies the PyPI packages for the step.
1109
-
1110
- Information in this decorator will augment any
1111
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1112
- you can use `@pypi_base` to set packages required by all
1113
- steps and use `@pypi` to specify step-specific overrides.
937
+ Specifies environment variables to be set prior to the execution of a step.
1114
938
 
1115
939
  Parameters
1116
940
  ----------
1117
- packages : Dict[str, str], default: {}
1118
- Packages to use for this step. The key is the name of the package
1119
- and the value is the version to use.
1120
- python : str, optional, default: None
1121
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1122
- that the version used will correspond to the version of the Python interpreter used to start the run.
941
+ vars : Dict[str, str], default {}
942
+ Dictionary of environment variables to set.
1123
943
  """
1124
944
  ...
1125
945
 
1126
946
  @typing.overload
1127
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
947
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1128
948
  ...
1129
949
 
1130
950
  @typing.overload
1131
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
951
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1132
952
  ...
1133
953
 
1134
- 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):
954
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1135
955
  """
1136
- Specifies the PyPI packages for the step.
956
+ Specifies environment variables to be set prior to the execution of a step.
1137
957
 
1138
- Information in this decorator will augment any
1139
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1140
- you can use `@pypi_base` to set packages required by all
1141
- steps and use `@pypi` to specify step-specific overrides.
958
+ Parameters
959
+ ----------
960
+ vars : Dict[str, str], default {}
961
+ Dictionary of environment variables to set.
962
+ """
963
+ ...
964
+
965
+ @typing.overload
966
+ 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]]]:
967
+ """
968
+ Specifies secrets to be retrieved and injected as environment variables prior to
969
+ the execution of a step.
1142
970
 
1143
971
  Parameters
1144
972
  ----------
1145
- packages : Dict[str, str], default: {}
1146
- Packages to use for this step. The key is the name of the package
1147
- and the value is the version to use.
1148
- python : str, optional, default: None
1149
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1150
- that the version used will correspond to the version of the Python interpreter used to start the run.
973
+ sources : List[Union[str, Dict[str, Any]]], default: []
974
+ List of secret specs, defining how the secrets are to be retrieved
975
+ """
976
+ ...
977
+
978
+ @typing.overload
979
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
980
+ ...
981
+
982
+ @typing.overload
983
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
984
+ ...
985
+
986
+ 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]]] = []):
987
+ """
988
+ Specifies secrets to be retrieved and injected as environment variables prior to
989
+ the execution of a step.
990
+
991
+ Parameters
992
+ ----------
993
+ sources : List[Union[str, Dict[str, Any]]], default: []
994
+ List of secret specs, defining how the secrets are to be retrieved
1151
995
  """
1152
996
  ...
1153
997
 
@@ -1205,110 +1049,59 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1205
1049
  ...
1206
1050
 
1207
1051
  @typing.overload
1208
- 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]]]:
1209
- """
1210
- Specifies a timeout for your step.
1211
-
1212
- This decorator is useful if this step may hang indefinitely.
1213
-
1214
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1215
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
1216
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
1217
-
1218
- Note that all the values specified in parameters are added together so if you specify
1219
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1220
-
1221
- Parameters
1222
- ----------
1223
- seconds : int, default 0
1224
- Number of seconds to wait prior to timing out.
1225
- minutes : int, default 0
1226
- Number of minutes to wait prior to timing out.
1227
- hours : int, default 0
1228
- Number of hours to wait prior to timing out.
1229
- """
1230
- ...
1231
-
1232
- @typing.overload
1233
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1234
- ...
1235
-
1236
- @typing.overload
1237
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1238
- ...
1239
-
1240
- 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):
1241
- """
1242
- Specifies a timeout for your step.
1243
-
1244
- This decorator is useful if this step may hang indefinitely.
1245
-
1246
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1247
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
1248
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
1249
-
1250
- Note that all the values specified in parameters are added together so if you specify
1251
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1252
-
1253
- Parameters
1254
- ----------
1255
- seconds : int, default 0
1256
- Number of seconds to wait prior to timing out.
1257
- minutes : int, default 0
1258
- Number of minutes to wait prior to timing out.
1259
- hours : int, default 0
1260
- Number of hours to wait prior to timing out.
1261
- """
1262
- ...
1263
-
1264
- @typing.overload
1265
- 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]]]:
1052
+ 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]]]:
1266
1053
  """
1267
- Creates a human-readable report, a Metaflow Card, after this step completes.
1054
+ Specifies the Conda environment for the step.
1268
1055
 
1269
- Note that you may add multiple `@card` decorators in a step with different parameters.
1056
+ Information in this decorator will augment any
1057
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1058
+ you can use `@conda_base` to set packages required by all
1059
+ steps and use `@conda` to specify step-specific overrides.
1270
1060
 
1271
1061
  Parameters
1272
1062
  ----------
1273
- type : str, default 'default'
1274
- Card type.
1275
- id : str, optional, default None
1276
- If multiple cards are present, use this id to identify this card.
1277
- options : Dict[str, Any], default {}
1278
- Options passed to the card. The contents depend on the card type.
1279
- timeout : int, default 45
1280
- Interrupt reporting if it takes more than this many seconds.
1281
-
1282
-
1063
+ packages : Dict[str, str], default {}
1064
+ Packages to use for this step. The key is the name of the package
1065
+ and the value is the version to use.
1066
+ libraries : Dict[str, str], default {}
1067
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1068
+ python : str, optional, default None
1069
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1070
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1071
+ disabled : bool, default False
1072
+ If set to True, disables @conda.
1283
1073
  """
1284
1074
  ...
1285
1075
 
1286
1076
  @typing.overload
1287
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1077
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1288
1078
  ...
1289
1079
 
1290
1080
  @typing.overload
1291
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1081
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1292
1082
  ...
1293
1083
 
1294
- 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):
1084
+ 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):
1295
1085
  """
1296
- Creates a human-readable report, a Metaflow Card, after this step completes.
1086
+ Specifies the Conda environment for the step.
1297
1087
 
1298
- Note that you may add multiple `@card` decorators in a step with different parameters.
1088
+ Information in this decorator will augment any
1089
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1090
+ you can use `@conda_base` to set packages required by all
1091
+ steps and use `@conda` to specify step-specific overrides.
1299
1092
 
1300
1093
  Parameters
1301
1094
  ----------
1302
- type : str, default 'default'
1303
- Card type.
1304
- id : str, optional, default None
1305
- If multiple cards are present, use this id to identify this card.
1306
- options : Dict[str, Any], default {}
1307
- Options passed to the card. The contents depend on the card type.
1308
- timeout : int, default 45
1309
- Interrupt reporting if it takes more than this many seconds.
1310
-
1311
-
1095
+ packages : Dict[str, str], default {}
1096
+ Packages to use for this step. The key is the name of the package
1097
+ and the value is the version to use.
1098
+ libraries : Dict[str, str], default {}
1099
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1100
+ python : str, optional, default None
1101
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1102
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1103
+ disabled : bool, default False
1104
+ If set to True, disables @conda.
1312
1105
  """
1313
1106
  ...
1314
1107
 
@@ -1389,126 +1182,99 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
1389
1182
  """
1390
1183
  ...
1391
1184
 
1392
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1185
+ @typing.overload
1186
+ 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]]]:
1393
1187
  """
1394
- Specifies what flows belong to the same project.
1188
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1395
1189
 
1396
- A project-specific namespace is created for all flows that
1397
- use the same `@project(name)`.
1190
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1398
1191
 
1399
1192
  Parameters
1400
1193
  ----------
1401
- name : str
1402
- Project name. Make sure that the name is unique amongst all
1403
- projects that use the same production scheduler. The name may
1404
- contain only lowercase alphanumeric characters and underscores.
1194
+ type : str, default 'default'
1195
+ Card type.
1196
+ id : str, optional, default None
1197
+ If multiple cards are present, use this id to identify this card.
1198
+ options : Dict[str, Any], default {}
1199
+ Options passed to the card. The contents depend on the card type.
1200
+ timeout : int, default 45
1201
+ Interrupt reporting if it takes more than this many seconds.
1405
1202
 
1406
1203
 
1407
1204
  """
1408
1205
  ...
1409
1206
 
1410
1207
  @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]]:
1208
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1209
+ ...
1210
+
1211
+ @typing.overload
1212
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1213
+ ...
1214
+
1215
+ 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):
1412
1216
  """
1413
- Specifies the times when the flow should be run when running on a
1414
- production scheduler.
1217
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1218
+
1219
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1415
1220
 
1416
1221
  Parameters
1417
1222
  ----------
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).
1223
+ type : str, default 'default'
1224
+ Card type.
1225
+ id : str, optional, default None
1226
+ If multiple cards are present, use this id to identify this card.
1227
+ options : Dict[str, Any], default {}
1228
+ Options passed to the card. The contents depend on the card type.
1229
+ timeout : int, default 45
1230
+ Interrupt reporting if it takes more than this many seconds.
1231
+
1232
+
1430
1233
  """
1431
1234
  ...
1432
1235
 
1433
1236
  @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):
1237
+ 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]]]:
1438
1238
  """
1439
- Specifies the times when the flow should be run when running on a
1440
- production scheduler.
1239
+ Specifies the PyPI packages for the step.
1240
+
1241
+ Information in this decorator will augment any
1242
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1243
+ you can use `@pypi_base` to set packages required by all
1244
+ steps and use `@pypi` to specify step-specific overrides.
1441
1245
 
1442
1246
  Parameters
1443
1247
  ----------
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).
1248
+ packages : Dict[str, str], default: {}
1249
+ Packages to use for this step. The key is the name of the package
1250
+ and the value is the version to use.
1251
+ python : str, optional, default: None
1252
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1253
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1456
1254
  """
1457
1255
  ...
1458
1256
 
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]]:
1460
- """
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.
1466
-
1467
- Parameters
1468
- ----------
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)
1498
- """
1257
+ @typing.overload
1258
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1499
1259
  ...
1500
1260
 
1501
1261
  @typing.overload
1502
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1262
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1263
+ ...
1264
+
1265
+ 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):
1503
1266
  """
1504
- Specifies the PyPI packages for all steps of the flow.
1267
+ Specifies the PyPI packages for the step.
1505
1268
 
1506
- Use `@pypi_base` to set common packages required by all
1269
+ Information in this decorator will augment any
1270
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1271
+ you can use `@pypi_base` to set packages required by all
1507
1272
  steps and use `@pypi` to specify step-specific overrides.
1273
+
1508
1274
  Parameters
1509
1275
  ----------
1510
1276
  packages : Dict[str, str], default: {}
1511
- Packages to use for this flow. The key is the name of the package
1277
+ Packages to use for this step. The key is the name of the package
1512
1278
  and the value is the version to use.
1513
1279
  python : str, optional, default: None
1514
1280
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
@@ -1517,23 +1283,375 @@ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[s
1517
1283
  ...
1518
1284
 
1519
1285
  @typing.overload
1520
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1286
+ 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]]]:
1287
+ """
1288
+ Specifies that the step will success under all circumstances.
1289
+
1290
+ The decorator will create an optional artifact, specified by `var`, which
1291
+ contains the exception raised. You can use it to detect the presence
1292
+ of errors, indicating that all happy-path artifacts produced by the step
1293
+ are missing.
1294
+
1295
+ Parameters
1296
+ ----------
1297
+ var : str, optional, default None
1298
+ Name of the artifact in which to store the caught exception.
1299
+ If not specified, the exception is not stored.
1300
+ print_exception : bool, default True
1301
+ Determines whether or not the exception is printed to
1302
+ stdout when caught.
1303
+ """
1304
+ ...
1305
+
1306
+ @typing.overload
1307
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1308
+ ...
1309
+
1310
+ @typing.overload
1311
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1312
+ ...
1313
+
1314
+ 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):
1315
+ """
1316
+ Specifies that the step will success under all circumstances.
1317
+
1318
+ The decorator will create an optional artifact, specified by `var`, which
1319
+ contains the exception raised. You can use it to detect the presence
1320
+ of errors, indicating that all happy-path artifacts produced by the step
1321
+ are missing.
1322
+
1323
+ Parameters
1324
+ ----------
1325
+ var : str, optional, default None
1326
+ Name of the artifact in which to store the caught exception.
1327
+ If not specified, the exception is not stored.
1328
+ print_exception : bool, default True
1329
+ Determines whether or not the exception is printed to
1330
+ stdout when caught.
1331
+ """
1332
+ ...
1333
+
1334
+ 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]]]:
1335
+ """
1336
+ Specifies that this step should execute on Kubernetes.
1337
+
1338
+ Parameters
1339
+ ----------
1340
+ cpu : int, default 1
1341
+ Number of CPUs required for this step. If `@resources` is
1342
+ also present, the maximum value from all decorators is used.
1343
+ memory : int, default 4096
1344
+ Memory size (in MB) required for this step. If
1345
+ `@resources` is also present, the maximum value from all decorators is
1346
+ used.
1347
+ disk : int, default 10240
1348
+ Disk size (in MB) required for this step. If
1349
+ `@resources` is also present, the maximum value from all decorators is
1350
+ used.
1351
+ image : str, optional, default None
1352
+ Docker image to use when launching on Kubernetes. If not specified, and
1353
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
1354
+ not, a default Docker image mapping to the current version of Python is used.
1355
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
1356
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
1357
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
1358
+ Kubernetes service account to use when launching pod in Kubernetes.
1359
+ secrets : List[str], optional, default None
1360
+ Kubernetes secrets to use when launching pod in Kubernetes. These
1361
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
1362
+ in Metaflow configuration.
1363
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
1364
+ Kubernetes namespace to use when launching pod in Kubernetes.
1365
+ gpu : int, optional, default None
1366
+ Number of GPUs required for this step. A value of zero implies that
1367
+ the scheduled node should not have GPUs.
1368
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
1369
+ The vendor of the GPUs to be used for this step.
1370
+ tolerations : List[str], default []
1371
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
1372
+ Kubernetes tolerations to use when launching pod in Kubernetes.
1373
+ use_tmpfs : bool, default False
1374
+ This enables an explicit tmpfs mount for this step.
1375
+ tmpfs_tempdir : bool, default True
1376
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1377
+ tmpfs_size : int, optional, default: None
1378
+ The value for the size (in MiB) of the tmpfs mount for this step.
1379
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1380
+ memory allocated for this step.
1381
+ tmpfs_path : str, optional, default /metaflow_temp
1382
+ Path to tmpfs mount for this step.
1383
+ persistent_volume_claims : Dict[str, str], optional, default None
1384
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
1385
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
1386
+ shared_memory: int, optional
1387
+ Shared memory size (in MiB) required for this step
1388
+ port: int, optional
1389
+ Port number to specify in the Kubernetes job object
1390
+ """
1391
+ ...
1392
+
1393
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1394
+ """
1395
+ Specifies what flows belong to the same project.
1396
+
1397
+ A project-specific namespace is created for all flows that
1398
+ use the same `@project(name)`.
1399
+
1400
+ Parameters
1401
+ ----------
1402
+ name : str
1403
+ Project name. Make sure that the name is unique amongst all
1404
+ projects that use the same production scheduler. The name may
1405
+ contain only lowercase alphanumeric characters and underscores.
1406
+
1407
+
1408
+ """
1409
+ ...
1410
+
1411
+ @typing.overload
1412
+ def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[str, str], None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1413
+ """
1414
+ Specifies the flow(s) that this flow depends on.
1415
+
1416
+ ```
1417
+ @trigger_on_finish(flow='FooFlow')
1418
+ ```
1419
+ or
1420
+ ```
1421
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1422
+ ```
1423
+ This decorator respects the @project decorator and triggers the flow
1424
+ when upstream runs within the same namespace complete successfully
1425
+
1426
+ Additionally, you can specify project aware upstream flow dependencies
1427
+ by specifying the fully qualified project_flow_name.
1428
+ ```
1429
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1430
+ ```
1431
+ or
1432
+ ```
1433
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1434
+ ```
1435
+
1436
+ You can also specify just the project or project branch (other values will be
1437
+ inferred from the current project or project branch):
1438
+ ```
1439
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1440
+ ```
1441
+
1442
+ Note that `branch` is typically one of:
1443
+ - `prod`
1444
+ - `user.bob`
1445
+ - `test.my_experiment`
1446
+ - `prod.staging`
1447
+
1448
+ Parameters
1449
+ ----------
1450
+ flow : Union[str, Dict[str, str]], optional, default None
1451
+ Upstream flow dependency for this flow.
1452
+ flows : List[Union[str, Dict[str, str]]], default []
1453
+ Upstream flow dependencies for this flow.
1454
+ options : Dict[str, Any], default {}
1455
+ Backend-specific configuration for tuning eventing behavior.
1456
+
1457
+
1458
+ """
1459
+ ...
1460
+
1461
+ @typing.overload
1462
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1463
+ ...
1464
+
1465
+ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[str, typing.Dict[str, str], None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
1466
+ """
1467
+ Specifies the flow(s) that this flow depends on.
1468
+
1469
+ ```
1470
+ @trigger_on_finish(flow='FooFlow')
1471
+ ```
1472
+ or
1473
+ ```
1474
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1475
+ ```
1476
+ This decorator respects the @project decorator and triggers the flow
1477
+ when upstream runs within the same namespace complete successfully
1478
+
1479
+ Additionally, you can specify project aware upstream flow dependencies
1480
+ by specifying the fully qualified project_flow_name.
1481
+ ```
1482
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1483
+ ```
1484
+ or
1485
+ ```
1486
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1487
+ ```
1488
+
1489
+ You can also specify just the project or project branch (other values will be
1490
+ inferred from the current project or project branch):
1491
+ ```
1492
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1493
+ ```
1494
+
1495
+ Note that `branch` is typically one of:
1496
+ - `prod`
1497
+ - `user.bob`
1498
+ - `test.my_experiment`
1499
+ - `prod.staging`
1500
+
1501
+ Parameters
1502
+ ----------
1503
+ flow : Union[str, Dict[str, str]], optional, default None
1504
+ Upstream flow dependency for this flow.
1505
+ flows : List[Union[str, Dict[str, str]]], default []
1506
+ Upstream flow dependencies for this flow.
1507
+ options : Dict[str, Any], default {}
1508
+ Backend-specific configuration for tuning eventing behavior.
1509
+
1510
+
1511
+ """
1512
+ ...
1513
+
1514
+ @typing.overload
1515
+ 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]]:
1516
+ """
1517
+ Specifies the event(s) that this flow depends on.
1518
+
1519
+ ```
1520
+ @trigger(event='foo')
1521
+ ```
1522
+ or
1523
+ ```
1524
+ @trigger(events=['foo', 'bar'])
1525
+ ```
1526
+
1527
+ Additionally, you can specify the parameter mappings
1528
+ to map event payload to Metaflow parameters for the flow.
1529
+ ```
1530
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1531
+ ```
1532
+ or
1533
+ ```
1534
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1535
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1536
+ ```
1537
+
1538
+ 'parameters' can also be a list of strings and tuples like so:
1539
+ ```
1540
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1541
+ ```
1542
+ This is equivalent to:
1543
+ ```
1544
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1545
+ ```
1546
+
1547
+ Parameters
1548
+ ----------
1549
+ event : Union[str, Dict[str, Any]], optional, default None
1550
+ Event dependency for this flow.
1551
+ events : List[Union[str, Dict[str, Any]]], default []
1552
+ Events dependency for this flow.
1553
+ options : Dict[str, Any], default {}
1554
+ Backend-specific configuration for tuning eventing behavior.
1555
+
1556
+
1557
+ """
1558
+ ...
1559
+
1560
+ @typing.overload
1561
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1562
+ ...
1563
+
1564
+ 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] = {}):
1565
+ """
1566
+ Specifies the event(s) that this flow depends on.
1567
+
1568
+ ```
1569
+ @trigger(event='foo')
1570
+ ```
1571
+ or
1572
+ ```
1573
+ @trigger(events=['foo', 'bar'])
1574
+ ```
1575
+
1576
+ Additionally, you can specify the parameter mappings
1577
+ to map event payload to Metaflow parameters for the flow.
1578
+ ```
1579
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1580
+ ```
1581
+ or
1582
+ ```
1583
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1584
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1585
+ ```
1586
+
1587
+ 'parameters' can also be a list of strings and tuples like so:
1588
+ ```
1589
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1590
+ ```
1591
+ This is equivalent to:
1592
+ ```
1593
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1594
+ ```
1595
+
1596
+ Parameters
1597
+ ----------
1598
+ event : Union[str, Dict[str, Any]], optional, default None
1599
+ Event dependency for this flow.
1600
+ events : List[Union[str, Dict[str, Any]]], default []
1601
+ Events dependency for this flow.
1602
+ options : Dict[str, Any], default {}
1603
+ Backend-specific configuration for tuning eventing behavior.
1604
+
1605
+
1606
+ """
1607
+ ...
1608
+
1609
+ @typing.overload
1610
+ 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]]:
1611
+ """
1612
+ Specifies the times when the flow should be run when running on a
1613
+ production scheduler.
1614
+
1615
+ Parameters
1616
+ ----------
1617
+ hourly : bool, default False
1618
+ Run the workflow hourly.
1619
+ daily : bool, default True
1620
+ Run the workflow daily.
1621
+ weekly : bool, default False
1622
+ Run the workflow weekly.
1623
+ cron : str, optional, default None
1624
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1625
+ specified by this expression.
1626
+ timezone : str, optional, default None
1627
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1628
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1629
+ """
1630
+ ...
1631
+
1632
+ @typing.overload
1633
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1521
1634
  ...
1522
1635
 
1523
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1636
+ 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):
1524
1637
  """
1525
- Specifies the PyPI packages for all steps of the flow.
1638
+ Specifies the times when the flow should be run when running on a
1639
+ production scheduler.
1526
1640
 
1527
- Use `@pypi_base` to set common packages required by all
1528
- steps and use `@pypi` to specify step-specific overrides.
1529
1641
  Parameters
1530
1642
  ----------
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
- python : str, optional, default: None
1535
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1536
- that the version used will correspond to the version of the Python interpreter used to start the run.
1643
+ hourly : bool, default False
1644
+ Run the workflow hourly.
1645
+ daily : bool, default True
1646
+ Run the workflow daily.
1647
+ weekly : bool, default False
1648
+ Run the workflow weekly.
1649
+ cron : str, optional, default None
1650
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1651
+ specified by this expression.
1652
+ timezone : str, optional, default None
1653
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1654
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1537
1655
  """
1538
1656
  ...
1539
1657
 
@@ -1628,201 +1746,84 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1628
1746
  """
1629
1747
  ...
1630
1748
 
1631
- @typing.overload
1632
- 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]]:
1633
- """
1634
- Specifies the event(s) that this flow depends on.
1635
-
1636
- ```
1637
- @trigger(event='foo')
1638
- ```
1639
- or
1640
- ```
1641
- @trigger(events=['foo', 'bar'])
1642
- ```
1643
-
1644
- Additionally, you can specify the parameter mappings
1645
- to map event payload to Metaflow parameters for the flow.
1646
- ```
1647
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1648
- ```
1649
- or
1650
- ```
1651
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1652
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1653
- ```
1654
-
1655
- 'parameters' can also be a list of strings and tuples like so:
1656
- ```
1657
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1658
- ```
1659
- This is equivalent to:
1660
- ```
1661
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1662
- ```
1663
-
1664
- Parameters
1665
- ----------
1666
- event : Union[str, Dict[str, Any]], optional, default None
1667
- Event dependency for this flow.
1668
- events : List[Union[str, Dict[str, Any]]], default []
1669
- Events dependency for this flow.
1670
- options : Dict[str, Any], default {}
1671
- Backend-specific configuration for tuning eventing behavior.
1672
-
1673
-
1674
- """
1675
- ...
1676
-
1677
- @typing.overload
1678
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1679
- ...
1680
-
1681
- 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] = {}):
1749
+ 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]]:
1682
1750
  """
1683
- Specifies the event(s) that this flow depends on.
1684
-
1685
- ```
1686
- @trigger(event='foo')
1687
- ```
1688
- or
1689
- ```
1690
- @trigger(events=['foo', 'bar'])
1691
- ```
1692
-
1693
- Additionally, you can specify the parameter mappings
1694
- to map event payload to Metaflow parameters for the flow.
1695
- ```
1696
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1697
- ```
1698
- or
1699
- ```
1700
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1701
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1702
- ```
1703
-
1704
- 'parameters' can also be a list of strings and tuples like so:
1705
- ```
1706
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1707
- ```
1708
- This is equivalent to:
1709
- ```
1710
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1711
- ```
1751
+ 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)
1752
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1753
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1754
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1755
+ starts only after all sensors finish.
1712
1756
 
1713
1757
  Parameters
1714
1758
  ----------
1715
- event : Union[str, Dict[str, Any]], optional, default None
1716
- Event dependency for this flow.
1717
- events : List[Union[str, Dict[str, Any]]], default []
1718
- Events dependency for this flow.
1719
- options : Dict[str, Any], default {}
1720
- Backend-specific configuration for tuning eventing behavior.
1721
-
1722
-
1759
+ timeout : int
1760
+ Time, in seconds before the task times out and fails. (Default: 3600)
1761
+ poke_interval : int
1762
+ Time in seconds that the job should wait in between each try. (Default: 60)
1763
+ mode : str
1764
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1765
+ exponential_backoff : bool
1766
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1767
+ pool : str
1768
+ the slot pool this task should run in,
1769
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1770
+ soft_fail : bool
1771
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1772
+ name : str
1773
+ Name of the sensor on Airflow
1774
+ description : str
1775
+ Description of sensor in the Airflow UI
1776
+ bucket_key : Union[str, List[str]]
1777
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1778
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1779
+ bucket_name : str
1780
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1781
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1782
+ wildcard_match : bool
1783
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1784
+ aws_conn_id : str
1785
+ a reference to the s3 connection on Airflow. (Default: None)
1786
+ verify : bool
1787
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1723
1788
  """
1724
1789
  ...
1725
1790
 
1726
1791
  @typing.overload
1727
- def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[str, str], None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1792
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1728
1793
  """
1729
- Specifies the flow(s) that this flow depends on.
1730
-
1731
- ```
1732
- @trigger_on_finish(flow='FooFlow')
1733
- ```
1734
- or
1735
- ```
1736
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1737
- ```
1738
- This decorator respects the @project decorator and triggers the flow
1739
- when upstream runs within the same namespace complete successfully
1740
-
1741
- Additionally, you can specify project aware upstream flow dependencies
1742
- by specifying the fully qualified project_flow_name.
1743
- ```
1744
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1745
- ```
1746
- or
1747
- ```
1748
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1749
- ```
1750
-
1751
- You can also specify just the project or project branch (other values will be
1752
- inferred from the current project or project branch):
1753
- ```
1754
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1755
- ```
1756
-
1757
- Note that `branch` is typically one of:
1758
- - `prod`
1759
- - `user.bob`
1760
- - `test.my_experiment`
1761
- - `prod.staging`
1794
+ Specifies the PyPI packages for all steps of the flow.
1762
1795
 
1796
+ Use `@pypi_base` to set common packages required by all
1797
+ steps and use `@pypi` to specify step-specific overrides.
1763
1798
  Parameters
1764
1799
  ----------
1765
- flow : Union[str, Dict[str, str]], optional, default None
1766
- Upstream flow dependency for this flow.
1767
- flows : List[Union[str, Dict[str, str]]], default []
1768
- Upstream flow dependencies for this flow.
1769
- options : Dict[str, Any], default {}
1770
- Backend-specific configuration for tuning eventing behavior.
1771
-
1772
-
1800
+ packages : Dict[str, str], default: {}
1801
+ Packages to use for this flow. The key is the name of the package
1802
+ and the value is the version to use.
1803
+ python : str, optional, default: None
1804
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1805
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1773
1806
  """
1774
1807
  ...
1775
1808
 
1776
1809
  @typing.overload
1777
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1810
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1778
1811
  ...
1779
1812
 
1780
- def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[str, typing.Dict[str, str], None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
1813
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1781
1814
  """
1782
- Specifies the flow(s) that this flow depends on.
1783
-
1784
- ```
1785
- @trigger_on_finish(flow='FooFlow')
1786
- ```
1787
- or
1788
- ```
1789
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1790
- ```
1791
- This decorator respects the @project decorator and triggers the flow
1792
- when upstream runs within the same namespace complete successfully
1793
-
1794
- Additionally, you can specify project aware upstream flow dependencies
1795
- by specifying the fully qualified project_flow_name.
1796
- ```
1797
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1798
- ```
1799
- or
1800
- ```
1801
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1802
- ```
1803
-
1804
- You can also specify just the project or project branch (other values will be
1805
- inferred from the current project or project branch):
1806
- ```
1807
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1808
- ```
1809
-
1810
- Note that `branch` is typically one of:
1811
- - `prod`
1812
- - `user.bob`
1813
- - `test.my_experiment`
1814
- - `prod.staging`
1815
+ Specifies the PyPI packages for all steps of the flow.
1815
1816
 
1817
+ Use `@pypi_base` to set common packages required by all
1818
+ steps and use `@pypi` to specify step-specific overrides.
1816
1819
  Parameters
1817
1820
  ----------
1818
- flow : Union[str, Dict[str, str]], optional, default None
1819
- Upstream flow dependency for this flow.
1820
- flows : List[Union[str, Dict[str, str]]], default []
1821
- Upstream flow dependencies for this flow.
1822
- options : Dict[str, Any], default {}
1823
- Backend-specific configuration for tuning eventing behavior.
1824
-
1825
-
1821
+ packages : Dict[str, str], default: {}
1822
+ Packages to use for this flow. The key is the name of the package
1823
+ and the value is the version to use.
1824
+ python : str, optional, default: None
1825
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1826
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1826
1827
  """
1827
1828
  ...
1828
1829