ob-metaflow-stubs 6.0.3.106__py2.py3-none-any.whl → 6.0.3.106rc1__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. metaflow-stubs/__init__.pyi +570 -570
  2. metaflow-stubs/cards.pyi +4 -4
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/client/__init__.pyi +2 -2
  5. metaflow-stubs/client/core.pyi +6 -6
  6. metaflow-stubs/client/filecache.pyi +2 -2
  7. metaflow-stubs/clone_util.pyi +1 -1
  8. metaflow-stubs/events.pyi +2 -2
  9. metaflow-stubs/exception.pyi +1 -1
  10. metaflow-stubs/flowspec.pyi +2 -2
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +1 -1
  13. metaflow-stubs/info_file.pyi +1 -1
  14. metaflow-stubs/metadata/metadata.pyi +1 -1
  15. metaflow-stubs/metadata/util.pyi +1 -1
  16. metaflow-stubs/metaflow_config.pyi +1 -1
  17. metaflow-stubs/metaflow_current.pyi +84 -84
  18. metaflow-stubs/mflog/mflog.pyi +1 -1
  19. metaflow-stubs/multicore_utils.pyi +1 -1
  20. metaflow-stubs/parameters.pyi +3 -3
  21. metaflow-stubs/plugins/__init__.pyi +1 -1
  22. metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
  23. metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
  24. metaflow-stubs/plugins/airflow/exception.pyi +1 -1
  25. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
  26. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
  27. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
  28. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
  29. metaflow-stubs/plugins/argo/__init__.pyi +1 -1
  30. metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
  31. metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
  32. metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +5 -5
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +5 -5
  35. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
  36. metaflow-stubs/plugins/aws/__init__.pyi +1 -1
  37. metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
  38. metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
  39. metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
  40. metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
  41. metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
  42. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
  43. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
  44. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
  45. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
  46. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
  47. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +1 -1
  48. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
  49. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
  50. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
  51. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +1 -1
  52. metaflow-stubs/plugins/azure/__init__.pyi +1 -1
  53. metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
  54. metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
  55. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
  56. metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
  57. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
  58. metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
  59. metaflow-stubs/plugins/cards/__init__.pyi +1 -1
  60. metaflow-stubs/plugins/cards/card_cli.pyi +3 -3
  61. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  62. metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
  63. metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
  64. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  65. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
  66. metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
  67. metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
  68. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  69. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
  70. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
  71. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
  72. metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
  73. metaflow-stubs/plugins/cards/component_serializer.pyi +3 -3
  74. metaflow-stubs/plugins/cards/exception.pyi +1 -1
  75. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  76. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  77. metaflow-stubs/plugins/datatools/local.pyi +1 -1
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  79. metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
  80. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
  81. metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
  82. metaflow-stubs/plugins/debug_logger.pyi +1 -1
  83. metaflow-stubs/plugins/debug_monitor.pyi +1 -1
  84. metaflow-stubs/plugins/environment_decorator.pyi +1 -1
  85. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  86. metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
  87. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  88. metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
  89. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
  90. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
  91. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
  92. metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
  93. metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
  94. metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
  95. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
  96. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  97. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +1 -1
  98. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
  99. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
  100. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
  101. metaflow-stubs/plugins/logs_cli.pyi +1 -1
  102. metaflow-stubs/plugins/package_cli.pyi +1 -1
  103. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  104. metaflow-stubs/plugins/perimeters.pyi +1 -1
  105. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  106. metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
  107. metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
  108. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  109. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
  110. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  111. metaflow-stubs/plugins/pypi/utils.pyi +1 -1
  112. metaflow-stubs/plugins/resources_decorator.pyi +1 -1
  113. metaflow-stubs/plugins/retry_decorator.pyi +1 -1
  114. metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
  115. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +1 -1
  116. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
  117. metaflow-stubs/plugins/storage_executor.pyi +1 -1
  118. metaflow-stubs/plugins/tag_cli.pyi +4 -4
  119. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
  120. metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
  121. metaflow-stubs/procpoll.pyi +1 -1
  122. metaflow-stubs/profilers/__init__.pyi +1 -1
  123. metaflow-stubs/pylint_wrapper.pyi +1 -1
  124. metaflow-stubs/runner/__init__.pyi +1 -1
  125. metaflow-stubs/runner/deployer.pyi +2 -2
  126. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  127. metaflow-stubs/runner/nbdeploy.pyi +1 -1
  128. metaflow-stubs/runner/nbrun.pyi +1 -1
  129. metaflow-stubs/runner/subprocess_manager.pyi +1 -1
  130. metaflow-stubs/runner/utils.pyi +1 -1
  131. metaflow-stubs/system/__init__.pyi +2 -2
  132. metaflow-stubs/system/system_logger.pyi +1 -1
  133. metaflow-stubs/system/system_monitor.pyi +2 -2
  134. metaflow-stubs/tagging_util.pyi +1 -1
  135. metaflow-stubs/tuple_util.pyi +1 -1
  136. {ob_metaflow_stubs-6.0.3.106.dist-info → ob_metaflow_stubs-6.0.3.106rc1.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.106rc1.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.106.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.106.dist-info → ob_metaflow_stubs-6.0.3.106rc1.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.106.dist-info → ob_metaflow_stubs-6.0.3.106rc1.dist-info}/top_level.txt +0 -0
@@ -1,24 +1,24 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
3
  # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
- # Generated on 2024-10-04T19:10:58.884265 #
4
+ # Generated on 2024-10-07T18:32:56.944750 #
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._vendor.click.types
11
+ import metaflow.runner.metaflow_runner
12
12
  import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
13
- import metaflow.parameters
13
+ import metaflow._vendor.click.types
14
14
  import metaflow.metaflow_current
15
- import datetime
15
+ import metaflow.parameters
16
+ import metaflow.client.core
16
17
  import typing
17
- import metaflow.events
18
- import metaflow.runner.metaflow_runner
19
18
  import metaflow.datastore.inputs
20
19
  import metaflow.flowspec
21
- import metaflow.client.core
20
+ import metaflow.events
21
+ import datetime
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -513,26 +513,45 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
513
513
  ...
514
514
 
515
515
  @typing.overload
516
- def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: 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]]]:
516
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
517
517
  """
518
- Enables loading / saving of models within a step.
518
+ Decorator prototype for all step decorators. This function gets specialized
519
+ and imported for all decorators types by _import_plugin_decorators().
520
+ """
521
+ ...
522
+
523
+ @typing.overload
524
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
525
+ ...
526
+
527
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
528
+ """
529
+ Decorator prototype for all step decorators. This function gets specialized
530
+ and imported for all decorators types by _import_plugin_decorators().
531
+ """
532
+ ...
533
+
534
+ @typing.overload
535
+ def checkpoint(*, load_policy: str = "fresh", temp_dir_root: 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]]]:
536
+ """
537
+ Enables checkpointing for a step.
519
538
 
520
539
 
521
540
  Parameters
522
541
  ----------
523
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
524
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
525
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
526
- - `current.checkpoint`
527
- - `current.model`
528
- - `current.huggingface_hub`
529
-
530
- If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
531
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
532
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
542
+ load_policy : str, default: "fresh"
543
+ The policy for loading the checkpoint. The following policies are supported:
544
+ - "eager": Loads the the latest available checkpoint within the namespace.
545
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
546
+ will be loaded at the start of the task.
547
+ - "none": Do not load any checkpoint
548
+ - "fresh": Loads the lastest checkpoint created within the running Task.
549
+ This mode helps loading checkpoints across various retry attempts of the same task.
550
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
551
+ created within the task will be loaded when the task is retries execution on failure.
533
552
 
534
553
  temp_dir_root : str, default: None
535
- The root directory under which `current.model.loaded` will store loaded models
554
+ The root directory under which `current.checkpoint.directory` will be created.
536
555
 
537
556
 
538
557
 
@@ -540,159 +559,190 @@ def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[
540
559
  ...
541
560
 
542
561
  @typing.overload
543
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
562
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
544
563
  ...
545
564
 
546
565
  @typing.overload
547
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
566
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
548
567
  ...
549
568
 
550
- def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
569
+ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = "fresh", temp_dir_root: str = None):
551
570
  """
552
- Enables loading / saving of models within a step.
571
+ Enables checkpointing for a step.
553
572
 
554
573
 
555
574
  Parameters
556
575
  ----------
557
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
558
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
559
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
560
- - `current.checkpoint`
561
- - `current.model`
562
- - `current.huggingface_hub`
563
-
564
- If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
565
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
566
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
576
+ load_policy : str, default: "fresh"
577
+ The policy for loading the checkpoint. The following policies are supported:
578
+ - "eager": Loads the the latest available checkpoint within the namespace.
579
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
580
+ will be loaded at the start of the task.
581
+ - "none": Do not load any checkpoint
582
+ - "fresh": Loads the lastest checkpoint created within the running Task.
583
+ This mode helps loading checkpoints across various retry attempts of the same task.
584
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
585
+ created within the task will be loaded when the task is retries execution on failure.
567
586
 
568
587
  temp_dir_root : str, default: None
569
- The root directory under which `current.model.loaded` will store loaded models
588
+ The root directory under which `current.checkpoint.directory` will be created.
570
589
 
571
590
 
572
591
 
573
592
  """
574
593
  ...
575
594
 
576
- @typing.overload
577
- 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]]]:
595
+ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
578
596
  """
579
- Specifies the Conda environment for the step.
580
-
581
- Information in this decorator will augment any
582
- attributes set in the `@conda_base` flow-level decorator. Hence,
583
- you can use `@conda_base` to set packages required by all
584
- steps and use `@conda` to specify step-specific overrides.
597
+ Specifies that this step should execute on Kubernetes.
585
598
 
586
599
  Parameters
587
600
  ----------
588
- packages : Dict[str, str], default {}
589
- Packages to use for this step. The key is the name of the package
590
- and the value is the version to use.
591
- libraries : Dict[str, str], default {}
592
- Supported for backward compatibility. When used with packages, packages will take precedence.
593
- python : str, optional, default None
594
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
595
- that the version used will correspond to the version of the Python interpreter used to start the run.
596
- disabled : bool, default False
597
- If set to True, disables @conda.
601
+ cpu : int, default 1
602
+ Number of CPUs required for this step. If `@resources` is
603
+ also present, the maximum value from all decorators is used.
604
+ memory : int, default 4096
605
+ Memory size (in MB) required for this step. If
606
+ `@resources` is also present, the maximum value from all decorators is
607
+ used.
608
+ disk : int, default 10240
609
+ Disk size (in MB) required for this step. If
610
+ `@resources` is also present, the maximum value from all decorators is
611
+ used.
612
+ image : str, optional, default None
613
+ Docker image to use when launching on Kubernetes. If not specified, and
614
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
615
+ not, a default Docker image mapping to the current version of Python is used.
616
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
617
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
618
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
619
+ Kubernetes service account to use when launching pod in Kubernetes.
620
+ secrets : List[str], optional, default None
621
+ Kubernetes secrets to use when launching pod in Kubernetes. These
622
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
623
+ in Metaflow configuration.
624
+ node_selector: Union[Dict[str,str], str], optional, default None
625
+ Kubernetes node selector(s) to apply to the pod running the task.
626
+ Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
627
+ or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
628
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
629
+ Kubernetes namespace to use when launching pod in Kubernetes.
630
+ gpu : int, optional, default None
631
+ Number of GPUs required for this step. A value of zero implies that
632
+ the scheduled node should not have GPUs.
633
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
634
+ The vendor of the GPUs to be used for this step.
635
+ tolerations : List[str], default []
636
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
637
+ Kubernetes tolerations to use when launching pod in Kubernetes.
638
+ use_tmpfs : bool, default False
639
+ This enables an explicit tmpfs mount for this step.
640
+ tmpfs_tempdir : bool, default True
641
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
642
+ tmpfs_size : int, optional, default: None
643
+ The value for the size (in MiB) of the tmpfs mount for this step.
644
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
645
+ memory allocated for this step.
646
+ tmpfs_path : str, optional, default /metaflow_temp
647
+ Path to tmpfs mount for this step.
648
+ persistent_volume_claims : Dict[str, str], optional, default None
649
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
650
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
651
+ shared_memory: int, optional
652
+ Shared memory size (in MiB) required for this step
653
+ port: int, optional
654
+ Port number to specify in the Kubernetes job object
655
+ compute_pool : str, optional, default None
656
+ Compute pool to be used for for this step.
657
+ If not specified, any accessible compute pool within the perimeter is used.
598
658
  """
599
659
  ...
600
660
 
601
661
  @typing.overload
602
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
603
- ...
604
-
605
- @typing.overload
606
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
607
- ...
608
-
609
- 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):
662
+ 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]]]:
610
663
  """
611
- Specifies the Conda environment for the step.
664
+ Specifies a timeout for your step.
612
665
 
613
- Information in this decorator will augment any
614
- attributes set in the `@conda_base` flow-level decorator. Hence,
615
- you can use `@conda_base` to set packages required by all
616
- steps and use `@conda` to specify step-specific overrides.
666
+ This decorator is useful if this step may hang indefinitely.
667
+
668
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
669
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
670
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
671
+
672
+ Note that all the values specified in parameters are added together so if you specify
673
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
617
674
 
618
675
  Parameters
619
676
  ----------
620
- packages : Dict[str, str], default {}
621
- Packages to use for this step. The key is the name of the package
622
- and the value is the version to use.
623
- libraries : Dict[str, str], default {}
624
- Supported for backward compatibility. When used with packages, packages will take precedence.
625
- python : str, optional, default None
626
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
627
- that the version used will correspond to the version of the Python interpreter used to start the run.
628
- disabled : bool, default False
629
- If set to True, disables @conda.
677
+ seconds : int, default 0
678
+ Number of seconds to wait prior to timing out.
679
+ minutes : int, default 0
680
+ Number of minutes to wait prior to timing out.
681
+ hours : int, default 0
682
+ Number of hours to wait prior to timing out.
630
683
  """
631
684
  ...
632
685
 
633
686
  @typing.overload
634
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
635
- """
636
- Internal decorator to support Fast bakery
637
- """
687
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
638
688
  ...
639
689
 
640
690
  @typing.overload
641
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
691
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
642
692
  ...
643
693
 
644
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
694
+ 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):
645
695
  """
646
- Internal decorator to support Fast bakery
696
+ Specifies a timeout for your step.
697
+
698
+ This decorator is useful if this step may hang indefinitely.
699
+
700
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
701
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
702
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
703
+
704
+ Note that all the values specified in parameters are added together so if you specify
705
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
706
+
707
+ Parameters
708
+ ----------
709
+ seconds : int, default 0
710
+ Number of seconds to wait prior to timing out.
711
+ minutes : int, default 0
712
+ Number of minutes to wait prior to timing out.
713
+ hours : int, default 0
714
+ Number of hours to wait prior to timing out.
647
715
  """
648
716
  ...
649
717
 
650
718
  @typing.overload
651
- 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]]]:
719
+ 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]]]:
652
720
  """
653
- Specifies that the step will success under all circumstances.
654
-
655
- The decorator will create an optional artifact, specified by `var`, which
656
- contains the exception raised. You can use it to detect the presence
657
- of errors, indicating that all happy-path artifacts produced by the step
658
- are missing.
721
+ Specifies environment variables to be set prior to the execution of a step.
659
722
 
660
723
  Parameters
661
724
  ----------
662
- var : str, optional, default None
663
- Name of the artifact in which to store the caught exception.
664
- If not specified, the exception is not stored.
665
- print_exception : bool, default True
666
- Determines whether or not the exception is printed to
667
- stdout when caught.
725
+ vars : Dict[str, str], default {}
726
+ Dictionary of environment variables to set.
668
727
  """
669
728
  ...
670
729
 
671
730
  @typing.overload
672
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
731
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
673
732
  ...
674
733
 
675
734
  @typing.overload
676
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
735
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
677
736
  ...
678
737
 
679
- 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):
738
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
680
739
  """
681
- Specifies that the step will success under all circumstances.
682
-
683
- The decorator will create an optional artifact, specified by `var`, which
684
- contains the exception raised. You can use it to detect the presence
685
- of errors, indicating that all happy-path artifacts produced by the step
686
- are missing.
740
+ Specifies environment variables to be set prior to the execution of a step.
687
741
 
688
742
  Parameters
689
743
  ----------
690
- var : str, optional, default None
691
- Name of the artifact in which to store the caught exception.
692
- If not specified, the exception is not stored.
693
- print_exception : bool, default True
694
- Determines whether or not the exception is printed to
695
- stdout when caught.
744
+ vars : Dict[str, str], default {}
745
+ Dictionary of environment variables to set.
696
746
  """
697
747
  ...
698
748
 
@@ -730,163 +780,51 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
730
780
  ...
731
781
 
732
782
  @typing.overload
733
- 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]]]:
734
- """
735
- Specifies environment variables to be set prior to the execution of a step.
736
-
737
- Parameters
738
- ----------
739
- vars : Dict[str, str], default {}
740
- Dictionary of environment variables to set.
741
- """
742
- ...
743
-
744
- @typing.overload
745
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
746
- ...
747
-
748
- @typing.overload
749
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
750
- ...
751
-
752
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
753
- """
754
- Specifies environment variables to be set prior to the execution of a step.
755
-
756
- Parameters
757
- ----------
758
- vars : Dict[str, str], default {}
759
- Dictionary of environment variables to set.
760
- """
761
- ...
762
-
763
- @typing.overload
764
- 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]]]:
765
- """
766
- Specifies the resources needed when executing this step.
767
-
768
- Use `@resources` to specify the resource requirements
769
- independently of the specific compute layer (`@batch`, `@kubernetes`).
770
-
771
- You can choose the compute layer on the command line by executing e.g.
772
- ```
773
- python myflow.py run --with batch
774
- ```
775
- or
776
- ```
777
- python myflow.py run --with kubernetes
778
- ```
779
- which executes the flow on the desired system using the
780
- requirements specified in `@resources`.
781
-
782
- Parameters
783
- ----------
784
- cpu : int, default 1
785
- Number of CPUs required for this step.
786
- gpu : int, default 0
787
- Number of GPUs required for this step.
788
- disk : int, optional, default None
789
- Disk size (in MB) required for this step. Only applies on Kubernetes.
790
- memory : int, default 4096
791
- Memory size (in MB) required for this step.
792
- shared_memory : int, optional, default None
793
- The value for the size (in MiB) of the /dev/shm volume for this step.
794
- This parameter maps to the `--shm-size` option in Docker.
795
- """
796
- ...
797
-
798
- @typing.overload
799
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
800
- ...
801
-
802
- @typing.overload
803
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
804
- ...
805
-
806
- def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
807
- """
808
- Specifies the resources needed when executing this step.
809
-
810
- Use `@resources` to specify the resource requirements
811
- independently of the specific compute layer (`@batch`, `@kubernetes`).
812
-
813
- You can choose the compute layer on the command line by executing e.g.
814
- ```
815
- python myflow.py run --with batch
816
- ```
817
- or
818
- ```
819
- python myflow.py run --with kubernetes
820
- ```
821
- which executes the flow on the desired system using the
822
- requirements specified in `@resources`.
823
-
824
- Parameters
825
- ----------
826
- cpu : int, default 1
827
- Number of CPUs required for this step.
828
- gpu : int, default 0
829
- Number of GPUs required for this step.
830
- disk : int, optional, default None
831
- Disk size (in MB) required for this step. Only applies on Kubernetes.
832
- memory : int, default 4096
833
- Memory size (in MB) required for this step.
834
- shared_memory : int, optional, default None
835
- The value for the size (in MiB) of the /dev/shm volume for this step.
836
- This parameter maps to the `--shm-size` option in Docker.
837
- """
838
- ...
839
-
840
- @typing.overload
841
- 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]]]:
783
+ 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]]]:
842
784
  """
843
- Specifies the number of times the task corresponding
844
- to a step needs to be retried.
845
-
846
- This decorator is useful for handling transient errors, such as networking issues.
847
- If your task contains operations that can't be retried safely, e.g. database updates,
848
- it is advisable to annotate it with `@retry(times=0)`.
785
+ Specifies that the step will success under all circumstances.
849
786
 
850
- This can be used in conjunction with the `@catch` decorator. The `@catch`
851
- decorator will execute a no-op task after all retries have been exhausted,
852
- ensuring that the flow execution can continue.
787
+ The decorator will create an optional artifact, specified by `var`, which
788
+ contains the exception raised. You can use it to detect the presence
789
+ of errors, indicating that all happy-path artifacts produced by the step
790
+ are missing.
853
791
 
854
792
  Parameters
855
793
  ----------
856
- times : int, default 3
857
- Number of times to retry this task.
858
- minutes_between_retries : int, default 2
859
- Number of minutes between retries.
794
+ var : str, optional, default None
795
+ Name of the artifact in which to store the caught exception.
796
+ If not specified, the exception is not stored.
797
+ print_exception : bool, default True
798
+ Determines whether or not the exception is printed to
799
+ stdout when caught.
860
800
  """
861
801
  ...
862
802
 
863
803
  @typing.overload
864
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
804
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
865
805
  ...
866
806
 
867
807
  @typing.overload
868
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
808
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
869
809
  ...
870
810
 
871
- 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):
811
+ 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):
872
812
  """
873
- Specifies the number of times the task corresponding
874
- to a step needs to be retried.
875
-
876
- This decorator is useful for handling transient errors, such as networking issues.
877
- If your task contains operations that can't be retried safely, e.g. database updates,
878
- it is advisable to annotate it with `@retry(times=0)`.
813
+ Specifies that the step will success under all circumstances.
879
814
 
880
- This can be used in conjunction with the `@catch` decorator. The `@catch`
881
- decorator will execute a no-op task after all retries have been exhausted,
882
- ensuring that the flow execution can continue.
815
+ The decorator will create an optional artifact, specified by `var`, which
816
+ contains the exception raised. You can use it to detect the presence
817
+ of errors, indicating that all happy-path artifacts produced by the step
818
+ are missing.
883
819
 
884
820
  Parameters
885
821
  ----------
886
- times : int, default 3
887
- Number of times to retry this task.
888
- minutes_between_retries : int, default 2
889
- Number of minutes between retries.
822
+ var : str, optional, default None
823
+ Name of the artifact in which to store the caught exception.
824
+ If not specified, the exception is not stored.
825
+ print_exception : bool, default True
826
+ Determines whether or not the exception is printed to
827
+ stdout when caught.
890
828
  """
891
829
  ...
892
830
 
@@ -942,261 +880,326 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
942
880
  ...
943
881
 
944
882
  @typing.overload
945
- 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]]]:
883
+ 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]]]:
946
884
  """
947
- Specifies the PyPI packages for the step.
885
+ Specifies the Conda environment for the step.
948
886
 
949
887
  Information in this decorator will augment any
950
- attributes set in the `@pyi_base` flow-level decorator. Hence,
951
- you can use `@pypi_base` to set packages required by all
952
- steps and use `@pypi` to specify step-specific overrides.
888
+ attributes set in the `@conda_base` flow-level decorator. Hence,
889
+ you can use `@conda_base` to set packages required by all
890
+ steps and use `@conda` to specify step-specific overrides.
953
891
 
954
892
  Parameters
955
893
  ----------
956
- packages : Dict[str, str], default: {}
894
+ packages : Dict[str, str], default {}
957
895
  Packages to use for this step. The key is the name of the package
958
896
  and the value is the version to use.
959
- python : str, optional, default: None
897
+ libraries : Dict[str, str], default {}
898
+ Supported for backward compatibility. When used with packages, packages will take precedence.
899
+ python : str, optional, default None
960
900
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
961
901
  that the version used will correspond to the version of the Python interpreter used to start the run.
902
+ disabled : bool, default False
903
+ If set to True, disables @conda.
962
904
  """
963
905
  ...
964
906
 
965
907
  @typing.overload
966
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
908
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
967
909
  ...
968
910
 
969
911
  @typing.overload
970
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
912
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
971
913
  ...
972
914
 
973
- 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):
915
+ 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):
974
916
  """
975
- Specifies the PyPI packages for the step.
917
+ Specifies the Conda environment for the step.
976
918
 
977
919
  Information in this decorator will augment any
978
- attributes set in the `@pyi_base` flow-level decorator. Hence,
979
- you can use `@pypi_base` to set packages required by all
980
- steps and use `@pypi` to specify step-specific overrides.
920
+ attributes set in the `@conda_base` flow-level decorator. Hence,
921
+ you can use `@conda_base` to set packages required by all
922
+ steps and use `@conda` to specify step-specific overrides.
981
923
 
982
924
  Parameters
983
925
  ----------
984
- packages : Dict[str, str], default: {}
926
+ packages : Dict[str, str], default {}
985
927
  Packages to use for this step. The key is the name of the package
986
928
  and the value is the version to use.
987
- python : str, optional, default: None
929
+ libraries : Dict[str, str], default {}
930
+ Supported for backward compatibility. When used with packages, packages will take precedence.
931
+ python : str, optional, default None
988
932
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
989
933
  that the version used will correspond to the version of the Python interpreter used to start the run.
934
+ disabled : bool, default False
935
+ If set to True, disables @conda.
990
936
  """
991
937
  ...
992
938
 
993
939
  @typing.overload
994
- 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]]]:
940
+ def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: 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]]]:
995
941
  """
996
- Specifies a timeout for your step.
997
-
998
- This decorator is useful if this step may hang indefinitely.
999
-
1000
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1001
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
1002
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
942
+ Enables loading / saving of models within a step.
1003
943
 
1004
- Note that all the values specified in parameters are added together so if you specify
1005
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1006
944
 
1007
945
  Parameters
1008
946
  ----------
1009
- seconds : int, default 0
1010
- Number of seconds to wait prior to timing out.
1011
- minutes : int, default 0
1012
- Number of minutes to wait prior to timing out.
1013
- hours : int, default 0
1014
- Number of hours to wait prior to timing out.
947
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
948
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
949
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
950
+ - `current.checkpoint`
951
+ - `current.model`
952
+ - `current.huggingface_hub`
953
+
954
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
955
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
956
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
957
+
958
+ temp_dir_root : str, default: None
959
+ The root directory under which `current.model.loaded` will store loaded models
960
+
961
+
962
+
1015
963
  """
1016
964
  ...
1017
965
 
1018
966
  @typing.overload
1019
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
967
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1020
968
  ...
1021
969
 
1022
970
  @typing.overload
1023
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
971
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1024
972
  ...
1025
973
 
1026
- 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):
974
+ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
1027
975
  """
1028
- Specifies a timeout for your step.
1029
-
1030
- This decorator is useful if this step may hang indefinitely.
1031
-
1032
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1033
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
1034
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
976
+ Enables loading / saving of models within a step.
1035
977
 
1036
- Note that all the values specified in parameters are added together so if you specify
1037
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1038
978
 
1039
979
  Parameters
1040
980
  ----------
1041
- seconds : int, default 0
1042
- Number of seconds to wait prior to timing out.
1043
- minutes : int, default 0
1044
- Number of minutes to wait prior to timing out.
1045
- hours : int, default 0
1046
- Number of hours to wait prior to timing out.
981
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
982
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
983
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
984
+ - `current.checkpoint`
985
+ - `current.model`
986
+ - `current.huggingface_hub`
987
+
988
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
989
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
990
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
991
+
992
+ temp_dir_root : str, default: None
993
+ The root directory under which `current.model.loaded` will store loaded models
994
+
995
+
996
+
1047
997
  """
1048
998
  ...
1049
999
 
1050
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1000
+ @typing.overload
1001
+ 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]]]:
1051
1002
  """
1052
- Specifies that this step should execute on Kubernetes.
1003
+ Specifies the number of times the task corresponding
1004
+ to a step needs to be retried.
1005
+
1006
+ This decorator is useful for handling transient errors, such as networking issues.
1007
+ If your task contains operations that can't be retried safely, e.g. database updates,
1008
+ it is advisable to annotate it with `@retry(times=0)`.
1009
+
1010
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1011
+ decorator will execute a no-op task after all retries have been exhausted,
1012
+ ensuring that the flow execution can continue.
1053
1013
 
1054
1014
  Parameters
1055
1015
  ----------
1056
- cpu : int, default 1
1057
- Number of CPUs required for this step. If `@resources` is
1058
- also present, the maximum value from all decorators is used.
1059
- memory : int, default 4096
1060
- Memory size (in MB) required for this step. If
1061
- `@resources` is also present, the maximum value from all decorators is
1062
- used.
1063
- disk : int, default 10240
1064
- Disk size (in MB) required for this step. If
1065
- `@resources` is also present, the maximum value from all decorators is
1066
- used.
1067
- image : str, optional, default None
1068
- Docker image to use when launching on Kubernetes. If not specified, and
1069
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
1070
- not, a default Docker image mapping to the current version of Python is used.
1071
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
1072
- If given, the imagePullPolicy to be applied to the Docker image of the step.
1073
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
1074
- Kubernetes service account to use when launching pod in Kubernetes.
1075
- secrets : List[str], optional, default None
1076
- Kubernetes secrets to use when launching pod in Kubernetes. These
1077
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
1078
- in Metaflow configuration.
1079
- node_selector: Union[Dict[str,str], str], optional, default None
1080
- Kubernetes node selector(s) to apply to the pod running the task.
1081
- Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
1082
- or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
1083
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
1084
- Kubernetes namespace to use when launching pod in Kubernetes.
1085
- gpu : int, optional, default None
1086
- Number of GPUs required for this step. A value of zero implies that
1087
- the scheduled node should not have GPUs.
1088
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
1089
- The vendor of the GPUs to be used for this step.
1090
- tolerations : List[str], default []
1091
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
1092
- Kubernetes tolerations to use when launching pod in Kubernetes.
1093
- use_tmpfs : bool, default False
1094
- This enables an explicit tmpfs mount for this step.
1095
- tmpfs_tempdir : bool, default True
1096
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1097
- tmpfs_size : int, optional, default: None
1098
- The value for the size (in MiB) of the tmpfs mount for this step.
1099
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1100
- memory allocated for this step.
1101
- tmpfs_path : str, optional, default /metaflow_temp
1102
- Path to tmpfs mount for this step.
1103
- persistent_volume_claims : Dict[str, str], optional, default None
1104
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
1105
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
1106
- shared_memory: int, optional
1107
- Shared memory size (in MiB) required for this step
1108
- port: int, optional
1109
- Port number to specify in the Kubernetes job object
1110
- compute_pool : str, optional, default None
1111
- Compute pool to be used for for this step.
1112
- If not specified, any accessible compute pool within the perimeter is used.
1016
+ times : int, default 3
1017
+ Number of times to retry this task.
1018
+ minutes_between_retries : int, default 2
1019
+ Number of minutes between retries.
1113
1020
  """
1114
1021
  ...
1115
1022
 
1116
1023
  @typing.overload
1117
- def checkpoint(*, load_policy: str = "fresh", temp_dir_root: 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]]]:
1024
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1025
+ ...
1026
+
1027
+ @typing.overload
1028
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1029
+ ...
1030
+
1031
+ 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):
1118
1032
  """
1119
- Enables checkpointing for a step.
1033
+ Specifies the number of times the task corresponding
1034
+ to a step needs to be retried.
1035
+
1036
+ This decorator is useful for handling transient errors, such as networking issues.
1037
+ If your task contains operations that can't be retried safely, e.g. database updates,
1038
+ it is advisable to annotate it with `@retry(times=0)`.
1120
1039
 
1040
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1041
+ decorator will execute a no-op task after all retries have been exhausted,
1042
+ ensuring that the flow execution can continue.
1121
1043
 
1122
1044
  Parameters
1123
1045
  ----------
1124
- load_policy : str, default: "fresh"
1125
- The policy for loading the checkpoint. The following policies are supported:
1126
- - "eager": Loads the the latest available checkpoint within the namespace.
1127
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1128
- will be loaded at the start of the task.
1129
- - "none": Do not load any checkpoint
1130
- - "fresh": Loads the lastest checkpoint created within the running Task.
1131
- This mode helps loading checkpoints across various retry attempts of the same task.
1132
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1133
- created within the task will be loaded when the task is retries execution on failure.
1134
-
1135
- temp_dir_root : str, default: None
1136
- The root directory under which `current.checkpoint.directory` will be created.
1137
-
1046
+ times : int, default 3
1047
+ Number of times to retry this task.
1048
+ minutes_between_retries : int, default 2
1049
+ Number of minutes between retries.
1050
+ """
1051
+ ...
1052
+
1053
+ @typing.overload
1054
+ 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]]]:
1055
+ """
1056
+ Specifies the PyPI packages for the step.
1138
1057
 
1058
+ Information in this decorator will augment any
1059
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1060
+ you can use `@pypi_base` to set packages required by all
1061
+ steps and use `@pypi` to specify step-specific overrides.
1139
1062
 
1063
+ Parameters
1064
+ ----------
1065
+ packages : Dict[str, str], default: {}
1066
+ Packages to use for this step. The key is the name of the package
1067
+ and the value is the version to use.
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.
1140
1071
  """
1141
1072
  ...
1142
1073
 
1143
1074
  @typing.overload
1144
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1075
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1145
1076
  ...
1146
1077
 
1147
1078
  @typing.overload
1148
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1079
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1149
1080
  ...
1150
1081
 
1151
- def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = "fresh", temp_dir_root: str = None):
1082
+ 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):
1152
1083
  """
1153
- Enables checkpointing for a step.
1084
+ Specifies the PyPI packages for the step.
1154
1085
 
1086
+ Information in this decorator will augment any
1087
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1088
+ you can use `@pypi_base` to set packages required by all
1089
+ steps and use `@pypi` to specify step-specific overrides.
1155
1090
 
1156
1091
  Parameters
1157
1092
  ----------
1158
- load_policy : str, default: "fresh"
1159
- The policy for loading the checkpoint. The following policies are supported:
1160
- - "eager": Loads the the latest available checkpoint within the namespace.
1161
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1162
- will be loaded at the start of the task.
1163
- - "none": Do not load any checkpoint
1164
- - "fresh": Loads the lastest checkpoint created within the running Task.
1165
- This mode helps loading checkpoints across various retry attempts of the same task.
1166
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1167
- created within the task will be loaded when the task is retries execution on failure.
1168
-
1169
- temp_dir_root : str, default: None
1170
- The root directory under which `current.checkpoint.directory` will be created.
1093
+ packages : Dict[str, str], default: {}
1094
+ Packages to use for this step. The key is the name of the package
1095
+ and the value is the version to use.
1096
+ python : str, optional, default: None
1097
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1098
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1099
+ """
1100
+ ...
1101
+
1102
+ @typing.overload
1103
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1104
+ """
1105
+ Internal decorator to support Fast bakery
1106
+ """
1107
+ ...
1108
+
1109
+ @typing.overload
1110
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1111
+ ...
1112
+
1113
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1114
+ """
1115
+ Internal decorator to support Fast bakery
1116
+ """
1117
+ ...
1118
+
1119
+ @typing.overload
1120
+ 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]]]:
1121
+ """
1122
+ Specifies the resources needed when executing this step.
1171
1123
 
1124
+ Use `@resources` to specify the resource requirements
1125
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1172
1126
 
1127
+ You can choose the compute layer on the command line by executing e.g.
1128
+ ```
1129
+ python myflow.py run --with batch
1130
+ ```
1131
+ or
1132
+ ```
1133
+ python myflow.py run --with kubernetes
1134
+ ```
1135
+ which executes the flow on the desired system using the
1136
+ requirements specified in `@resources`.
1173
1137
 
1138
+ Parameters
1139
+ ----------
1140
+ cpu : int, default 1
1141
+ Number of CPUs required for this step.
1142
+ gpu : int, default 0
1143
+ Number of GPUs required for this step.
1144
+ disk : int, optional, default None
1145
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1146
+ memory : int, default 4096
1147
+ Memory size (in MB) required for this step.
1148
+ shared_memory : int, optional, default None
1149
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1150
+ This parameter maps to the `--shm-size` option in Docker.
1174
1151
  """
1175
1152
  ...
1176
1153
 
1177
1154
  @typing.overload
1178
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1179
- """
1180
- Decorator prototype for all step decorators. This function gets specialized
1181
- and imported for all decorators types by _import_plugin_decorators().
1182
- """
1155
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1183
1156
  ...
1184
1157
 
1185
1158
  @typing.overload
1186
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1159
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1187
1160
  ...
1188
1161
 
1189
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1162
+ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
1190
1163
  """
1191
- Decorator prototype for all step decorators. This function gets specialized
1192
- and imported for all decorators types by _import_plugin_decorators().
1164
+ Specifies the resources needed when executing this step.
1165
+
1166
+ Use `@resources` to specify the resource requirements
1167
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1168
+
1169
+ You can choose the compute layer on the command line by executing e.g.
1170
+ ```
1171
+ python myflow.py run --with batch
1172
+ ```
1173
+ or
1174
+ ```
1175
+ python myflow.py run --with kubernetes
1176
+ ```
1177
+ which executes the flow on the desired system using the
1178
+ requirements specified in `@resources`.
1179
+
1180
+ Parameters
1181
+ ----------
1182
+ cpu : int, default 1
1183
+ Number of CPUs required for this step.
1184
+ gpu : int, default 0
1185
+ Number of GPUs required for this step.
1186
+ disk : int, optional, default None
1187
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1188
+ memory : int, default 4096
1189
+ Memory size (in MB) required for this step.
1190
+ shared_memory : int, optional, default None
1191
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1192
+ This parameter maps to the `--shm-size` option in Docker.
1193
1193
  """
1194
1194
  ...
1195
1195
 
1196
- def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1196
+ 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]]:
1197
1197
  """
1198
- The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1199
- This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
1198
+ 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)
1199
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1200
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1201
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1202
+ starts only after all sensors finish.
1200
1203
 
1201
1204
  Parameters
1202
1205
  ----------
@@ -1217,168 +1220,148 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1217
1220
  Name of the sensor on Airflow
1218
1221
  description : str
1219
1222
  Description of sensor in the Airflow UI
1220
- external_dag_id : str
1221
- The dag_id that contains the task you want to wait for.
1222
- external_task_ids : List[str]
1223
- The list of task_ids that you want to wait for.
1224
- If None (default value) the sensor waits for the DAG. (Default: None)
1225
- allowed_states : List[str]
1226
- Iterable of allowed states, (Default: ['success'])
1227
- failed_states : List[str]
1228
- Iterable of failed or dis-allowed states. (Default: None)
1229
- execution_delta : datetime.timedelta
1230
- time difference with the previous execution to look at,
1231
- the default is the same logical date as the current task or DAG. (Default: None)
1232
- check_existence: bool
1233
- Set to True to check if the external task exists or check if
1234
- the DAG to wait for exists. (Default: True)
1223
+ bucket_key : Union[str, List[str]]
1224
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1225
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1226
+ bucket_name : str
1227
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1228
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1229
+ wildcard_match : bool
1230
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1231
+ aws_conn_id : str
1232
+ a reference to the s3 connection on Airflow. (Default: None)
1233
+ verify : bool
1234
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1235
1235
  """
1236
1236
  ...
1237
1237
 
1238
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1238
+ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1239
1239
  """
1240
- Specifies what flows belong to the same project.
1241
-
1242
- A project-specific namespace is created for all flows that
1243
- use the same `@project(name)`.
1240
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1244
1241
 
1245
- Parameters
1246
- ----------
1247
- name : str
1248
- Project name. Make sure that the name is unique amongst all
1249
- projects that use the same production scheduler. The name may
1250
- contain only lowercase alphanumeric characters and underscores.
1242
+ User code call
1243
+ -----------
1244
+ @nim(
1245
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1246
+ backend='managed'
1247
+ )
1251
1248
 
1249
+ Valid backend options
1250
+ ---------------------
1251
+ - 'managed': Outerbounds selects a compute provider based on the model.
1252
+ - 🚧 'dataplane': Run in your account.
1252
1253
 
1253
- """
1254
- ...
1255
-
1256
- @typing.overload
1257
- 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]]:
1258
- """
1259
- Specifies the times when the flow should be run when running on a
1260
- production scheduler.
1254
+ Valid model options
1255
+ ----------------
1256
+ - 'meta/llama3-8b-instruct': 8B parameter model
1257
+ - 'meta/llama3-70b-instruct': 70B parameter model
1258
+ - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1261
1259
 
1262
1260
  Parameters
1263
1261
  ----------
1264
- hourly : bool, default False
1265
- Run the workflow hourly.
1266
- daily : bool, default True
1267
- Run the workflow daily.
1268
- weekly : bool, default False
1269
- Run the workflow weekly.
1270
- cron : str, optional, default None
1271
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1272
- specified by this expression.
1273
- timezone : str, optional, default None
1274
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1275
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1262
+ models: list[NIM]
1263
+ List of NIM containers running models in sidecars.
1264
+ backend: str
1265
+ Compute provider to run the NIM container.
1276
1266
  """
1277
1267
  ...
1278
1268
 
1279
- @typing.overload
1280
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1281
- ...
1282
-
1283
- 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):
1269
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1284
1270
  """
1285
- Specifies the times when the flow should be run when running on a
1286
- production scheduler.
1271
+ Specifies what flows belong to the same project.
1272
+
1273
+ A project-specific namespace is created for all flows that
1274
+ use the same `@project(name)`.
1287
1275
 
1288
1276
  Parameters
1289
1277
  ----------
1290
- hourly : bool, default False
1291
- Run the workflow hourly.
1292
- daily : bool, default True
1293
- Run the workflow daily.
1294
- weekly : bool, default False
1295
- Run the workflow weekly.
1296
- cron : str, optional, default None
1297
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1298
- specified by this expression.
1299
- timezone : str, optional, default None
1300
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1301
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1278
+ name : str
1279
+ Project name. Make sure that the name is unique amongst all
1280
+ projects that use the same production scheduler. The name may
1281
+ contain only lowercase alphanumeric characters and underscores.
1282
+
1283
+
1302
1284
  """
1303
1285
  ...
1304
1286
 
1305
1287
  @typing.overload
1306
- 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]]:
1288
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1307
1289
  """
1308
- Specifies the Conda environment for all steps of the flow.
1309
-
1310
- Use `@conda_base` to set common libraries required by all
1311
- steps and use `@conda` to specify step-specific additions.
1290
+ Specifies the PyPI packages for all steps of the flow.
1312
1291
 
1292
+ Use `@pypi_base` to set common packages required by all
1293
+ steps and use `@pypi` to specify step-specific overrides.
1313
1294
  Parameters
1314
1295
  ----------
1315
- packages : Dict[str, str], default {}
1296
+ packages : Dict[str, str], default: {}
1316
1297
  Packages to use for this flow. The key is the name of the package
1317
1298
  and the value is the version to use.
1318
- libraries : Dict[str, str], default {}
1319
- Supported for backward compatibility. When used with packages, packages will take precedence.
1320
- python : str, optional, default None
1299
+ python : str, optional, default: None
1321
1300
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1322
1301
  that the version used will correspond to the version of the Python interpreter used to start the run.
1323
- disabled : bool, default False
1324
- If set to True, disables Conda.
1325
1302
  """
1326
1303
  ...
1327
1304
 
1328
1305
  @typing.overload
1329
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1306
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1330
1307
  ...
1331
1308
 
1332
- 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):
1309
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1333
1310
  """
1334
- Specifies the Conda environment for all steps of the flow.
1335
-
1336
- Use `@conda_base` to set common libraries required by all
1337
- steps and use `@conda` to specify step-specific additions.
1311
+ Specifies the PyPI packages for all steps of the flow.
1338
1312
 
1313
+ Use `@pypi_base` to set common packages required by all
1314
+ steps and use `@pypi` to specify step-specific overrides.
1339
1315
  Parameters
1340
1316
  ----------
1341
- packages : Dict[str, str], default {}
1317
+ packages : Dict[str, str], default: {}
1342
1318
  Packages to use for this flow. The key is the name of the package
1343
1319
  and the value is the version to use.
1344
- libraries : Dict[str, str], default {}
1345
- Supported for backward compatibility. When used with packages, packages will take precedence.
1346
- python : str, optional, default None
1320
+ python : str, optional, default: None
1347
1321
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1348
1322
  that the version used will correspond to the version of the Python interpreter used to start the run.
1349
- disabled : bool, default False
1350
- If set to True, disables Conda.
1351
1323
  """
1352
1324
  ...
1353
1325
 
1354
- def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1326
+ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1355
1327
  """
1356
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1357
-
1358
- User code call
1359
- -----------
1360
- @nim(
1361
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1362
- backend='managed'
1363
- )
1364
-
1365
- Valid backend options
1366
- ---------------------
1367
- - 'managed': Outerbounds selects a compute provider based on the model.
1368
- - 🚧 'dataplane': Run in your account.
1369
-
1370
- Valid model options
1371
- ----------------
1372
- - 'meta/llama3-8b-instruct': 8B parameter model
1373
- - 'meta/llama3-70b-instruct': 70B parameter model
1374
- - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1328
+ The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1329
+ This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
1375
1330
 
1376
1331
  Parameters
1377
1332
  ----------
1378
- models: list[NIM]
1379
- List of NIM containers running models in sidecars.
1380
- backend: str
1381
- Compute provider to run the NIM container.
1333
+ timeout : int
1334
+ Time, in seconds before the task times out and fails. (Default: 3600)
1335
+ poke_interval : int
1336
+ Time in seconds that the job should wait in between each try. (Default: 60)
1337
+ mode : str
1338
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1339
+ exponential_backoff : bool
1340
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1341
+ pool : str
1342
+ the slot pool this task should run in,
1343
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1344
+ soft_fail : bool
1345
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1346
+ name : str
1347
+ Name of the sensor on Airflow
1348
+ description : str
1349
+ Description of sensor in the Airflow UI
1350
+ external_dag_id : str
1351
+ The dag_id that contains the task you want to wait for.
1352
+ external_task_ids : List[str]
1353
+ The list of task_ids that you want to wait for.
1354
+ If None (default value) the sensor waits for the DAG. (Default: None)
1355
+ allowed_states : List[str]
1356
+ Iterable of allowed states, (Default: ['success'])
1357
+ failed_states : List[str]
1358
+ Iterable of failed or dis-allowed states. (Default: None)
1359
+ execution_delta : datetime.timedelta
1360
+ time difference with the previous execution to look at,
1361
+ the default is the same logical date as the current task or DAG. (Default: None)
1362
+ check_existence: bool
1363
+ Set to True to check if the external task exists or check if
1364
+ the DAG to wait for exists. (Default: True)
1382
1365
  """
1383
1366
  ...
1384
1367
 
@@ -1486,41 +1469,100 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1486
1469
  ...
1487
1470
 
1488
1471
  @typing.overload
1489
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1472
+ 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]]:
1490
1473
  """
1491
- Specifies the PyPI packages for all steps of the flow.
1474
+ Specifies the Conda environment for all steps of the flow.
1475
+
1476
+ Use `@conda_base` to set common libraries required by all
1477
+ steps and use `@conda` to specify step-specific additions.
1492
1478
 
1493
- Use `@pypi_base` to set common packages required by all
1494
- steps and use `@pypi` to specify step-specific overrides.
1495
1479
  Parameters
1496
1480
  ----------
1497
- packages : Dict[str, str], default: {}
1481
+ packages : Dict[str, str], default {}
1498
1482
  Packages to use for this flow. The key is the name of the package
1499
1483
  and the value is the version to use.
1500
- python : str, optional, default: None
1484
+ libraries : Dict[str, str], default {}
1485
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1486
+ python : str, optional, default None
1501
1487
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1502
1488
  that the version used will correspond to the version of the Python interpreter used to start the run.
1489
+ disabled : bool, default False
1490
+ If set to True, disables Conda.
1503
1491
  """
1504
1492
  ...
1505
1493
 
1506
1494
  @typing.overload
1507
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1495
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1508
1496
  ...
1509
1497
 
1510
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1498
+ 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):
1511
1499
  """
1512
- Specifies the PyPI packages for all steps of the flow.
1500
+ Specifies the Conda environment for all steps of the flow.
1501
+
1502
+ Use `@conda_base` to set common libraries required by all
1503
+ steps and use `@conda` to specify step-specific additions.
1513
1504
 
1514
- Use `@pypi_base` to set common packages required by all
1515
- steps and use `@pypi` to specify step-specific overrides.
1516
1505
  Parameters
1517
1506
  ----------
1518
- packages : Dict[str, str], default: {}
1507
+ packages : Dict[str, str], default {}
1519
1508
  Packages to use for this flow. The key is the name of the package
1520
1509
  and the value is the version to use.
1521
- python : str, optional, default: None
1510
+ libraries : Dict[str, str], default {}
1511
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1512
+ python : str, optional, default None
1522
1513
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1523
1514
  that the version used will correspond to the version of the Python interpreter used to start the run.
1515
+ disabled : bool, default False
1516
+ If set to True, disables Conda.
1517
+ """
1518
+ ...
1519
+
1520
+ @typing.overload
1521
+ 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]]:
1522
+ """
1523
+ Specifies the times when the flow should be run when running on a
1524
+ production scheduler.
1525
+
1526
+ Parameters
1527
+ ----------
1528
+ hourly : bool, default False
1529
+ Run the workflow hourly.
1530
+ daily : bool, default True
1531
+ Run the workflow daily.
1532
+ weekly : bool, default False
1533
+ Run the workflow weekly.
1534
+ cron : str, optional, default None
1535
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1536
+ specified by this expression.
1537
+ timezone : str, optional, default None
1538
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1539
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1540
+ """
1541
+ ...
1542
+
1543
+ @typing.overload
1544
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1545
+ ...
1546
+
1547
+ 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):
1548
+ """
1549
+ Specifies the times when the flow should be run when running on a
1550
+ production scheduler.
1551
+
1552
+ Parameters
1553
+ ----------
1554
+ hourly : bool, default False
1555
+ Run the workflow hourly.
1556
+ daily : bool, default True
1557
+ Run the workflow daily.
1558
+ weekly : bool, default False
1559
+ Run the workflow weekly.
1560
+ cron : str, optional, default None
1561
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1562
+ specified by this expression.
1563
+ timezone : str, optional, default None
1564
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1565
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1524
1566
  """
1525
1567
  ...
1526
1568
 
@@ -1619,48 +1661,6 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1619
1661
  """
1620
1662
  ...
1621
1663
 
1622
- 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]]:
1623
- """
1624
- 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)
1625
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1626
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1627
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1628
- starts only after all sensors finish.
1629
-
1630
- Parameters
1631
- ----------
1632
- timeout : int
1633
- Time, in seconds before the task times out and fails. (Default: 3600)
1634
- poke_interval : int
1635
- Time in seconds that the job should wait in between each try. (Default: 60)
1636
- mode : str
1637
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1638
- exponential_backoff : bool
1639
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1640
- pool : str
1641
- the slot pool this task should run in,
1642
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1643
- soft_fail : bool
1644
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1645
- name : str
1646
- Name of the sensor on Airflow
1647
- description : str
1648
- Description of sensor in the Airflow UI
1649
- bucket_key : Union[str, List[str]]
1650
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1651
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1652
- bucket_name : str
1653
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1654
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1655
- wildcard_match : bool
1656
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1657
- aws_conn_id : str
1658
- a reference to the s3 connection on Airflow. (Default: None)
1659
- verify : bool
1660
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1661
- """
1662
- ...
1663
-
1664
1664
  def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
1665
1665
  """
1666
1666
  Switch namespace to the one provided.