ob-metaflow-stubs 6.0.3.111__py2.py3-none-any.whl → 6.0.3.112__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 +510 -510
  2. metaflow-stubs/cards.pyi +4 -4
  3. metaflow-stubs/cli.pyi +1 -1
  4. metaflow-stubs/client/__init__.pyi +2 -2
  5. metaflow-stubs/client/core.pyi +5 -5
  6. metaflow-stubs/client/filecache.pyi +1 -1
  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 +4 -4
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +4 -4
  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 +61 -61
  18. metaflow-stubs/mflog/mflog.pyi +1 -1
  19. metaflow-stubs/multicore_utils.pyi +1 -1
  20. metaflow-stubs/parameters.pyi +2 -2
  21. metaflow-stubs/plugins/__init__.pyi +2 -2
  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 +2 -2
  27. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  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 +4 -4
  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 +1 -1
  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 +2 -2
  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 +1 -1
  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 +1 -1
  65. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
  66. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  67. metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
  68. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  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 +2 -2
  72. metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
  73. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  74. metaflow-stubs/plugins/cards/exception.pyi +1 -1
  75. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  76. metaflow-stubs/plugins/datatools/__init__.pyi +1 -1
  77. metaflow-stubs/plugins/datatools/local.pyi +1 -1
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +1 -1
  79. metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
  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 +1 -1
  86. metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
  87. metaflow-stubs/plugins/frameworks/pytorch.pyi +1 -1
  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 +1 -1
  97. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +2 -2
  98. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
  99. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  100. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
  101. metaflow-stubs/plugins/logs_cli.pyi +2 -2
  102. metaflow-stubs/plugins/package_cli.pyi +1 -1
  103. metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
  104. metaflow-stubs/plugins/perimeters.pyi +1 -1
  105. metaflow-stubs/plugins/project_decorator.pyi +1 -1
  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 +2 -2
  119. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
  120. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  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 +3 -3
  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 +1 -1
  134. metaflow-stubs/tagging_util.pyi +1 -1
  135. metaflow-stubs/tuple_util.pyi +1 -1
  136. {ob_metaflow_stubs-6.0.3.111.dist-info → ob_metaflow_stubs-6.0.3.112.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.112.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.111.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.111.dist-info → ob_metaflow_stubs-6.0.3.112.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.111.dist-info → ob_metaflow_stubs-6.0.3.112.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.25.2+obcheckpoint(0.1.0);ob(v1) #
4
- # Generated on 2024-10-21T17:14:28.436023 #
4
+ # Generated on 2024-10-21T21:22:37.544481 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
+ import typing
11
12
  import metaflow.flowspec
12
- import metaflow.parameters
13
- import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
14
- import metaflow._vendor.click.types
13
+ import metaflow.client.core
15
14
  import metaflow.events
16
- import metaflow.datastore.inputs
17
- import typing
15
+ import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
18
16
  import metaflow.metaflow_current
19
- import metaflow.client.core
20
- import datetime
21
17
  import metaflow.runner.metaflow_runner
18
+ import metaflow.datastore.inputs
19
+ import metaflow._vendor.click.types
20
+ import metaflow.parameters
21
+ import datetime
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -512,144 +512,69 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
512
512
  """
513
513
  ...
514
514
 
515
- @typing.overload
516
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
517
- """
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.
538
-
539
-
540
- Parameters
541
- ----------
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.
552
-
553
- temp_dir_root : str, default: None
554
- The root directory under which `current.checkpoint.directory` will be created.
555
-
556
-
557
-
558
- """
559
- ...
560
-
561
- @typing.overload
562
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
563
- ...
564
-
565
- @typing.overload
566
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
567
- ...
568
-
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):
570
- """
571
- Enables checkpointing for a step.
572
-
573
-
574
- Parameters
575
- ----------
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.
586
-
587
- temp_dir_root : str, default: None
588
- The root directory under which `current.checkpoint.directory` will be created.
589
-
590
-
591
-
592
- """
593
- ...
594
-
595
- @typing.overload
596
- 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]]]:
597
- """
598
- Enables loading / saving of models within a step.
599
-
600
-
601
- Parameters
602
- ----------
603
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
604
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
605
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
606
- - `current.checkpoint`
607
- - `current.model`
608
- - `current.huggingface_hub`
609
-
610
- 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
611
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
612
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
613
-
614
- temp_dir_root : str, default: None
615
- The root directory under which `current.model.loaded` will store loaded models
616
-
617
-
618
-
619
- """
620
- ...
621
-
622
- @typing.overload
623
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
624
- ...
625
-
626
- @typing.overload
627
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
628
- ...
629
-
630
- 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):
515
+ 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]]]:
631
516
  """
632
- Enables loading / saving of models within a step.
633
-
517
+ Specifies that this step should execute on Kubernetes.
634
518
 
635
519
  Parameters
636
520
  ----------
637
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
638
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
639
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
640
- - `current.checkpoint`
641
- - `current.model`
642
- - `current.huggingface_hub`
643
-
644
- 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
645
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
646
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
647
-
648
- temp_dir_root : str, default: None
649
- The root directory under which `current.model.loaded` will store loaded models
650
-
651
-
652
-
521
+ cpu : int, default 1
522
+ Number of CPUs required for this step. If `@resources` is
523
+ also present, the maximum value from all decorators is used.
524
+ memory : int, default 4096
525
+ Memory size (in MB) required for this step. If
526
+ `@resources` is also present, the maximum value from all decorators is
527
+ used.
528
+ disk : int, default 10240
529
+ Disk size (in MB) required for this step. If
530
+ `@resources` is also present, the maximum value from all decorators is
531
+ used.
532
+ image : str, optional, default None
533
+ Docker image to use when launching on Kubernetes. If not specified, and
534
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
535
+ not, a default Docker image mapping to the current version of Python is used.
536
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
537
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
538
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
539
+ Kubernetes service account to use when launching pod in Kubernetes.
540
+ secrets : List[str], optional, default None
541
+ Kubernetes secrets to use when launching pod in Kubernetes. These
542
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
543
+ in Metaflow configuration.
544
+ node_selector: Union[Dict[str,str], str], optional, default None
545
+ Kubernetes node selector(s) to apply to the pod running the task.
546
+ Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
547
+ or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
548
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
549
+ Kubernetes namespace to use when launching pod in Kubernetes.
550
+ gpu : int, optional, default None
551
+ Number of GPUs required for this step. A value of zero implies that
552
+ the scheduled node should not have GPUs.
553
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
554
+ The vendor of the GPUs to be used for this step.
555
+ tolerations : List[str], default []
556
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
557
+ Kubernetes tolerations to use when launching pod in Kubernetes.
558
+ use_tmpfs : bool, default False
559
+ This enables an explicit tmpfs mount for this step.
560
+ tmpfs_tempdir : bool, default True
561
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
562
+ tmpfs_size : int, optional, default: None
563
+ The value for the size (in MiB) of the tmpfs mount for this step.
564
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
565
+ memory allocated for this step.
566
+ tmpfs_path : str, optional, default /metaflow_temp
567
+ Path to tmpfs mount for this step.
568
+ persistent_volume_claims : Dict[str, str], optional, default None
569
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
570
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
571
+ shared_memory: int, optional
572
+ Shared memory size (in MiB) required for this step
573
+ port: int, optional
574
+ Port number to specify in the Kubernetes job object
575
+ compute_pool : str, optional, default None
576
+ Compute pool to be used for for this step.
577
+ If not specified, any accessible compute pool within the perimeter is used.
653
578
  """
654
579
  ...
655
580
 
@@ -744,99 +669,62 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
744
669
  ...
745
670
 
746
671
  @typing.overload
747
- def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
672
+ 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]]]:
748
673
  """
749
- Specifies secrets to be retrieved and injected as environment variables prior to
750
- the execution of a step.
674
+ Specifies the number of times the task corresponding
675
+ to a step needs to be retried.
676
+
677
+ This decorator is useful for handling transient errors, such as networking issues.
678
+ If your task contains operations that can't be retried safely, e.g. database updates,
679
+ it is advisable to annotate it with `@retry(times=0)`.
680
+
681
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
682
+ decorator will execute a no-op task after all retries have been exhausted,
683
+ ensuring that the flow execution can continue.
751
684
 
752
685
  Parameters
753
686
  ----------
754
- sources : List[Union[str, Dict[str, Any]]], default: []
755
- List of secret specs, defining how the secrets are to be retrieved
687
+ times : int, default 3
688
+ Number of times to retry this task.
689
+ minutes_between_retries : int, default 2
690
+ Number of minutes between retries.
756
691
  """
757
692
  ...
758
693
 
759
694
  @typing.overload
760
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
695
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
761
696
  ...
762
697
 
763
698
  @typing.overload
764
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
699
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
765
700
  ...
766
701
 
767
- def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
702
+ 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):
768
703
  """
769
- Specifies secrets to be retrieved and injected as environment variables prior to
770
- the execution of a step.
704
+ Specifies the number of times the task corresponding
705
+ to a step needs to be retried.
706
+
707
+ This decorator is useful for handling transient errors, such as networking issues.
708
+ If your task contains operations that can't be retried safely, e.g. database updates,
709
+ it is advisable to annotate it with `@retry(times=0)`.
710
+
711
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
712
+ decorator will execute a no-op task after all retries have been exhausted,
713
+ ensuring that the flow execution can continue.
771
714
 
772
715
  Parameters
773
716
  ----------
774
- sources : List[Union[str, Dict[str, Any]]], default: []
775
- List of secret specs, defining how the secrets are to be retrieved
717
+ times : int, default 3
718
+ Number of times to retry this task.
719
+ minutes_between_retries : int, default 2
720
+ Number of minutes between retries.
776
721
  """
777
722
  ...
778
723
 
779
724
  @typing.overload
780
- 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]]]:
725
+ def card(*, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
781
726
  """
782
- Specifies a timeout for your step.
783
-
784
- This decorator is useful if this step may hang indefinitely.
785
-
786
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
787
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
788
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
789
-
790
- Note that all the values specified in parameters are added together so if you specify
791
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
792
-
793
- Parameters
794
- ----------
795
- seconds : int, default 0
796
- Number of seconds to wait prior to timing out.
797
- minutes : int, default 0
798
- Number of minutes to wait prior to timing out.
799
- hours : int, default 0
800
- Number of hours to wait prior to timing out.
801
- """
802
- ...
803
-
804
- @typing.overload
805
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
806
- ...
807
-
808
- @typing.overload
809
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
810
- ...
811
-
812
- 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):
813
- """
814
- Specifies a timeout for your step.
815
-
816
- This decorator is useful if this step may hang indefinitely.
817
-
818
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
819
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
820
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
821
-
822
- Note that all the values specified in parameters are added together so if you specify
823
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
824
-
825
- Parameters
826
- ----------
827
- seconds : int, default 0
828
- Number of seconds to wait prior to timing out.
829
- minutes : int, default 0
830
- Number of minutes to wait prior to timing out.
831
- hours : int, default 0
832
- Number of hours to wait prior to timing out.
833
- """
834
- ...
835
-
836
- @typing.overload
837
- def card(*, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
838
- """
839
- Creates a human-readable report, a Metaflow Card, after this step completes.
727
+ Creates a human-readable report, a Metaflow Card, after this step completes.
840
728
 
841
729
  Note that you may add multiple `@card` decorators in a step with different parameters.
842
730
 
@@ -884,72 +772,6 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
884
772
  """
885
773
  ...
886
774
 
887
- 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]]]:
888
- """
889
- Specifies that this step should execute on Kubernetes.
890
-
891
- Parameters
892
- ----------
893
- cpu : int, default 1
894
- Number of CPUs required for this step. If `@resources` is
895
- also present, the maximum value from all decorators is used.
896
- memory : int, default 4096
897
- Memory size (in MB) required for this step. If
898
- `@resources` is also present, the maximum value from all decorators is
899
- used.
900
- disk : int, default 10240
901
- Disk size (in MB) required for this step. If
902
- `@resources` is also present, the maximum value from all decorators is
903
- used.
904
- image : str, optional, default None
905
- Docker image to use when launching on Kubernetes. If not specified, and
906
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
907
- not, a default Docker image mapping to the current version of Python is used.
908
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
909
- If given, the imagePullPolicy to be applied to the Docker image of the step.
910
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
911
- Kubernetes service account to use when launching pod in Kubernetes.
912
- secrets : List[str], optional, default None
913
- Kubernetes secrets to use when launching pod in Kubernetes. These
914
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
915
- in Metaflow configuration.
916
- node_selector: Union[Dict[str,str], str], optional, default None
917
- Kubernetes node selector(s) to apply to the pod running the task.
918
- Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
919
- or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
920
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
921
- Kubernetes namespace to use when launching pod in Kubernetes.
922
- gpu : int, optional, default None
923
- Number of GPUs required for this step. A value of zero implies that
924
- the scheduled node should not have GPUs.
925
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
926
- The vendor of the GPUs to be used for this step.
927
- tolerations : List[str], default []
928
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
929
- Kubernetes tolerations to use when launching pod in Kubernetes.
930
- use_tmpfs : bool, default False
931
- This enables an explicit tmpfs mount for this step.
932
- tmpfs_tempdir : bool, default True
933
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
934
- tmpfs_size : int, optional, default: None
935
- The value for the size (in MiB) of the tmpfs mount for this step.
936
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
937
- memory allocated for this step.
938
- tmpfs_path : str, optional, default /metaflow_temp
939
- Path to tmpfs mount for this step.
940
- persistent_volume_claims : Dict[str, str], optional, default None
941
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
942
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
943
- shared_memory: int, optional
944
- Shared memory size (in MiB) required for this step
945
- port: int, optional
946
- Port number to specify in the Kubernetes job object
947
- compute_pool : str, optional, default None
948
- Compute pool to be used for for this step.
949
- If not specified, any accessible compute pool within the perimeter is used.
950
- """
951
- ...
952
-
953
775
  @typing.overload
954
776
  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]]]:
955
777
  """
@@ -1000,55 +822,78 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
1000
822
  ...
1001
823
 
1002
824
  @typing.overload
1003
- 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]]]:
825
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1004
826
  """
1005
- Specifies the number of times the task corresponding
1006
- to a step needs to be retried.
827
+ Decorator prototype for all step decorators. This function gets specialized
828
+ and imported for all decorators types by _import_plugin_decorators().
829
+ """
830
+ ...
831
+
832
+ @typing.overload
833
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
834
+ ...
835
+
836
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
837
+ """
838
+ Decorator prototype for all step decorators. This function gets specialized
839
+ and imported for all decorators types by _import_plugin_decorators().
840
+ """
841
+ ...
842
+
843
+ @typing.overload
844
+ 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]]]:
845
+ """
846
+ Specifies a timeout for your step.
1007
847
 
1008
- This decorator is useful for handling transient errors, such as networking issues.
1009
- If your task contains operations that can't be retried safely, e.g. database updates,
1010
- it is advisable to annotate it with `@retry(times=0)`.
848
+ This decorator is useful if this step may hang indefinitely.
1011
849
 
1012
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1013
- decorator will execute a no-op task after all retries have been exhausted,
1014
- ensuring that the flow execution can continue.
850
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
851
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
852
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
853
+
854
+ Note that all the values specified in parameters are added together so if you specify
855
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1015
856
 
1016
857
  Parameters
1017
858
  ----------
1018
- times : int, default 3
1019
- Number of times to retry this task.
1020
- minutes_between_retries : int, default 2
1021
- Number of minutes between retries.
859
+ seconds : int, default 0
860
+ Number of seconds to wait prior to timing out.
861
+ minutes : int, default 0
862
+ Number of minutes to wait prior to timing out.
863
+ hours : int, default 0
864
+ Number of hours to wait prior to timing out.
1022
865
  """
1023
866
  ...
1024
867
 
1025
868
  @typing.overload
1026
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
869
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1027
870
  ...
1028
871
 
1029
872
  @typing.overload
1030
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
873
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1031
874
  ...
1032
875
 
1033
- 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):
876
+ 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):
1034
877
  """
1035
- Specifies the number of times the task corresponding
1036
- to a step needs to be retried.
878
+ Specifies a timeout for your step.
1037
879
 
1038
- This decorator is useful for handling transient errors, such as networking issues.
1039
- If your task contains operations that can't be retried safely, e.g. database updates,
1040
- it is advisable to annotate it with `@retry(times=0)`.
880
+ This decorator is useful if this step may hang indefinitely.
1041
881
 
1042
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1043
- decorator will execute a no-op task after all retries have been exhausted,
1044
- ensuring that the flow execution can continue.
882
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
883
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
884
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
885
+
886
+ Note that all the values specified in parameters are added together so if you specify
887
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1045
888
 
1046
889
  Parameters
1047
890
  ----------
1048
- times : int, default 3
1049
- Number of times to retry this task.
1050
- minutes_between_retries : int, default 2
1051
- Number of minutes between retries.
891
+ seconds : int, default 0
892
+ Number of seconds to wait prior to timing out.
893
+ minutes : int, default 0
894
+ Number of minutes to wait prior to timing out.
895
+ hours : int, default 0
896
+ Number of hours to wait prior to timing out.
1052
897
  """
1053
898
  ...
1054
899
 
@@ -1102,26 +947,40 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1102
947
  ...
1103
948
 
1104
949
  @typing.overload
1105
- 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]]]:
950
+ def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1106
951
  """
1107
- Specifies environment variables to be set prior to the execution of a step.
952
+ Specifies secrets to be retrieved and injected as environment variables prior to
953
+ the execution of a step.
1108
954
 
1109
955
  Parameters
1110
956
  ----------
1111
- vars : Dict[str, str], default {}
1112
- Dictionary of environment variables to set.
957
+ sources : List[Union[str, Dict[str, Any]]], default: []
958
+ List of secret specs, defining how the secrets are to be retrieved
1113
959
  """
1114
960
  ...
1115
961
 
1116
962
  @typing.overload
1117
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
963
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1118
964
  ...
1119
965
 
1120
966
  @typing.overload
1121
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
967
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1122
968
  ...
1123
969
 
1124
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
970
+ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
971
+ """
972
+ Specifies secrets to be retrieved and injected as environment variables prior to
973
+ the execution of a step.
974
+
975
+ Parameters
976
+ ----------
977
+ sources : List[Union[str, Dict[str, Any]]], default: []
978
+ List of secret specs, defining how the secrets are to be retrieved
979
+ """
980
+ ...
981
+
982
+ @typing.overload
983
+ 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]]]:
1125
984
  """
1126
985
  Specifies environment variables to be set prior to the execution of a step.
1127
986
 
@@ -1133,179 +992,177 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
1133
992
  ...
1134
993
 
1135
994
  @typing.overload
1136
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1137
- """
1138
- Internal decorator to support Fast bakery
1139
- """
995
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1140
996
  ...
1141
997
 
1142
998
  @typing.overload
1143
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
999
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1144
1000
  ...
1145
1001
 
1146
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1002
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1147
1003
  """
1148
- Internal decorator to support Fast bakery
1004
+ Specifies environment variables to be set prior to the execution of a step.
1005
+
1006
+ Parameters
1007
+ ----------
1008
+ vars : Dict[str, str], default {}
1009
+ Dictionary of environment variables to set.
1149
1010
  """
1150
1011
  ...
1151
1012
 
1152
1013
  @typing.overload
1153
- 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]]]:
1014
+ 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]]]:
1154
1015
  """
1155
- Specifies the Conda environment for the step.
1016
+ Enables checkpointing for a step.
1156
1017
 
1157
- Information in this decorator will augment any
1158
- attributes set in the `@conda_base` flow-level decorator. Hence,
1159
- you can use `@conda_base` to set packages required by all
1160
- steps and use `@conda` to specify step-specific overrides.
1161
1018
 
1162
1019
  Parameters
1163
1020
  ----------
1164
- packages : Dict[str, str], default {}
1165
- Packages to use for this step. The key is the name of the package
1166
- and the value is the version to use.
1167
- libraries : Dict[str, str], default {}
1168
- Supported for backward compatibility. When used with packages, packages will take precedence.
1169
- python : str, optional, default None
1170
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1171
- that the version used will correspond to the version of the Python interpreter used to start the run.
1172
- disabled : bool, default False
1173
- If set to True, disables @conda.
1021
+ load_policy : str, default: "fresh"
1022
+ The policy for loading the checkpoint. The following policies are supported:
1023
+ - "eager": Loads the the latest available checkpoint within the namespace.
1024
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1025
+ will be loaded at the start of the task.
1026
+ - "none": Do not load any checkpoint
1027
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1028
+ This mode helps loading checkpoints across various retry attempts of the same task.
1029
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1030
+ created within the task will be loaded when the task is retries execution on failure.
1031
+
1032
+ temp_dir_root : str, default: None
1033
+ The root directory under which `current.checkpoint.directory` will be created.
1034
+
1035
+
1036
+
1174
1037
  """
1175
1038
  ...
1176
1039
 
1177
1040
  @typing.overload
1178
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1041
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1179
1042
  ...
1180
1043
 
1181
1044
  @typing.overload
1182
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1045
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1183
1046
  ...
1184
1047
 
1185
- 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):
1048
+ 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):
1186
1049
  """
1187
- Specifies the Conda environment for the step.
1050
+ Enables checkpointing for a step.
1188
1051
 
1189
- Information in this decorator will augment any
1190
- attributes set in the `@conda_base` flow-level decorator. Hence,
1191
- you can use `@conda_base` to set packages required by all
1192
- steps and use `@conda` to specify step-specific overrides.
1193
1052
 
1194
1053
  Parameters
1195
1054
  ----------
1196
- packages : Dict[str, str], default {}
1197
- Packages to use for this step. The key is the name of the package
1198
- and the value is the version to use.
1199
- libraries : Dict[str, str], default {}
1200
- Supported for backward compatibility. When used with packages, packages will take precedence.
1201
- python : str, optional, default None
1202
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1203
- that the version used will correspond to the version of the Python interpreter used to start the run.
1204
- disabled : bool, default False
1205
- If set to True, disables @conda.
1055
+ load_policy : str, default: "fresh"
1056
+ The policy for loading the checkpoint. The following policies are supported:
1057
+ - "eager": Loads the the latest available checkpoint within the namespace.
1058
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1059
+ will be loaded at the start of the task.
1060
+ - "none": Do not load any checkpoint
1061
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1062
+ This mode helps loading checkpoints across various retry attempts of the same task.
1063
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1064
+ created within the task will be loaded when the task is retries execution on failure.
1065
+
1066
+ temp_dir_root : str, default: None
1067
+ The root directory under which `current.checkpoint.directory` will be created.
1068
+
1069
+
1070
+
1206
1071
  """
1207
1072
  ...
1208
1073
 
1209
1074
  @typing.overload
1210
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1075
+ 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]]]:
1211
1076
  """
1212
- Specifies the PyPI packages for all steps of the flow.
1077
+ Enables loading / saving of models within a step.
1078
+
1213
1079
 
1214
- Use `@pypi_base` to set common packages required by all
1215
- steps and use `@pypi` to specify step-specific overrides.
1216
1080
  Parameters
1217
1081
  ----------
1218
- packages : Dict[str, str], default: {}
1219
- Packages to use for this flow. The key is the name of the package
1220
- and the value is the version to use.
1221
- python : str, optional, default: None
1222
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1223
- that the version used will correspond to the version of the Python interpreter used to start the run.
1082
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
1083
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
1084
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
1085
+ - `current.checkpoint`
1086
+ - `current.model`
1087
+ - `current.huggingface_hub`
1088
+
1089
+ 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
1090
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
1091
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
1092
+
1093
+ temp_dir_root : str, default: None
1094
+ The root directory under which `current.model.loaded` will store loaded models
1095
+
1096
+
1097
+
1224
1098
  """
1225
1099
  ...
1226
1100
 
1227
1101
  @typing.overload
1228
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1102
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1229
1103
  ...
1230
1104
 
1231
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1105
+ @typing.overload
1106
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1107
+ ...
1108
+
1109
+ 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):
1232
1110
  """
1233
- Specifies the PyPI packages for all steps of the flow.
1111
+ Enables loading / saving of models within a step.
1112
+
1234
1113
 
1235
- Use `@pypi_base` to set common packages required by all
1236
- steps and use `@pypi` to specify step-specific overrides.
1237
1114
  Parameters
1238
1115
  ----------
1239
- packages : Dict[str, str], default: {}
1240
- Packages to use for this flow. The key is the name of the package
1241
- and the value is the version to use.
1242
- python : str, optional, default: None
1243
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1244
- that the version used will correspond to the version of the Python interpreter used to start the run.
1116
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
1117
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
1118
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
1119
+ - `current.checkpoint`
1120
+ - `current.model`
1121
+ - `current.huggingface_hub`
1122
+
1123
+ 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
1124
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
1125
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
1126
+
1127
+ temp_dir_root : str, default: None
1128
+ The root directory under which `current.model.loaded` will store loaded models
1129
+
1130
+
1131
+
1245
1132
  """
1246
1133
  ...
1247
1134
 
1248
1135
  @typing.overload
1249
- 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]]:
1136
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1250
1137
  """
1251
- Specifies the times when the flow should be run when running on a
1252
- production scheduler.
1253
-
1254
- Parameters
1255
- ----------
1256
- hourly : bool, default False
1257
- Run the workflow hourly.
1258
- daily : bool, default True
1259
- Run the workflow daily.
1260
- weekly : bool, default False
1261
- Run the workflow weekly.
1262
- cron : str, optional, default None
1263
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1264
- specified by this expression.
1265
- timezone : str, optional, default None
1266
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1267
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1138
+ Internal decorator to support Fast bakery
1268
1139
  """
1269
1140
  ...
1270
1141
 
1271
1142
  @typing.overload
1272
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1143
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1273
1144
  ...
1274
1145
 
1275
- 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):
1146
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1276
1147
  """
1277
- Specifies the times when the flow should be run when running on a
1278
- production scheduler.
1279
-
1280
- Parameters
1281
- ----------
1282
- hourly : bool, default False
1283
- Run the workflow hourly.
1284
- daily : bool, default True
1285
- Run the workflow daily.
1286
- weekly : bool, default False
1287
- Run the workflow weekly.
1288
- cron : str, optional, default None
1289
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1290
- specified by this expression.
1291
- timezone : str, optional, default None
1292
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1293
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1148
+ Internal decorator to support Fast bakery
1294
1149
  """
1295
1150
  ...
1296
1151
 
1297
1152
  @typing.overload
1298
- 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]]:
1153
+ 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]]]:
1299
1154
  """
1300
- Specifies the Conda environment for all steps of the flow.
1155
+ Specifies the Conda environment for the step.
1301
1156
 
1302
- Use `@conda_base` to set common libraries required by all
1303
- steps and use `@conda` to specify step-specific additions.
1157
+ Information in this decorator will augment any
1158
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1159
+ you can use `@conda_base` to set packages required by all
1160
+ steps and use `@conda` to specify step-specific overrides.
1304
1161
 
1305
1162
  Parameters
1306
1163
  ----------
1307
1164
  packages : Dict[str, str], default {}
1308
- Packages to use for this flow. The key is the name of the package
1165
+ Packages to use for this step. The key is the name of the package
1309
1166
  and the value is the version to use.
1310
1167
  libraries : Dict[str, str], default {}
1311
1168
  Supported for backward compatibility. When used with packages, packages will take precedence.
@@ -1313,25 +1170,31 @@ def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[s
1313
1170
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1314
1171
  that the version used will correspond to the version of the Python interpreter used to start the run.
1315
1172
  disabled : bool, default False
1316
- If set to True, disables Conda.
1173
+ If set to True, disables @conda.
1317
1174
  """
1318
1175
  ...
1319
1176
 
1320
1177
  @typing.overload
1321
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1178
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1322
1179
  ...
1323
1180
 
1324
- 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):
1181
+ @typing.overload
1182
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1183
+ ...
1184
+
1185
+ 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):
1325
1186
  """
1326
- Specifies the Conda environment for all steps of the flow.
1187
+ Specifies the Conda environment for the step.
1327
1188
 
1328
- Use `@conda_base` to set common libraries required by all
1329
- steps and use `@conda` to specify step-specific additions.
1189
+ Information in this decorator will augment any
1190
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1191
+ you can use `@conda_base` to set packages required by all
1192
+ steps and use `@conda` to specify step-specific overrides.
1330
1193
 
1331
1194
  Parameters
1332
1195
  ----------
1333
1196
  packages : Dict[str, str], default {}
1334
- Packages to use for this flow. The key is the name of the package
1197
+ Packages to use for this step. The key is the name of the package
1335
1198
  and the value is the version to use.
1336
1199
  libraries : Dict[str, str], default {}
1337
1200
  Supported for backward compatibility. When used with packages, packages will take precedence.
@@ -1339,56 +1202,7 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1339
1202
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1340
1203
  that the version used will correspond to the version of the Python interpreter used to start the run.
1341
1204
  disabled : bool, default False
1342
- If set to True, disables Conda.
1343
- """
1344
- ...
1345
-
1346
- def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1347
- """
1348
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1349
-
1350
- User code call
1351
- -----------
1352
- @nim(
1353
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1354
- backend='managed'
1355
- )
1356
-
1357
- Valid backend options
1358
- ---------------------
1359
- - 'managed': Outerbounds selects a compute provider based on the model.
1360
- - 🚧 'dataplane': Run in your account.
1361
-
1362
- Valid model options
1363
- ----------------
1364
- - 'meta/llama3-8b-instruct': 8B parameter model
1365
- - 'meta/llama3-70b-instruct': 70B parameter model
1366
- - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1367
-
1368
- Parameters
1369
- ----------
1370
- models: list[NIM]
1371
- List of NIM containers running models in sidecars.
1372
- backend: str
1373
- Compute provider to run the NIM container.
1374
- """
1375
- ...
1376
-
1377
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1378
- """
1379
- Specifies what flows belong to the same project.
1380
-
1381
- A project-specific namespace is created for all flows that
1382
- use the same `@project(name)`.
1383
-
1384
- Parameters
1385
- ----------
1386
- name : str
1387
- Project name. Make sure that the name is unique amongst all
1388
- projects that use the same production scheduler. The name may
1389
- contain only lowercase alphanumeric characters and underscores.
1390
-
1391
-
1205
+ If set to True, disables @conda.
1392
1206
  """
1393
1207
  ...
1394
1208
 
@@ -1495,45 +1309,52 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1495
1309
  """
1496
1310
  ...
1497
1311
 
1498
- 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]]:
1312
+ @typing.overload
1313
+ 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]]:
1499
1314
  """
1500
- 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.
1501
- 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.
1315
+ Specifies the Conda environment for all steps of the flow.
1316
+
1317
+ Use `@conda_base` to set common libraries required by all
1318
+ steps and use `@conda` to specify step-specific additions.
1502
1319
 
1503
1320
  Parameters
1504
1321
  ----------
1505
- timeout : int
1506
- Time, in seconds before the task times out and fails. (Default: 3600)
1507
- poke_interval : int
1508
- Time in seconds that the job should wait in between each try. (Default: 60)
1509
- mode : str
1510
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1511
- exponential_backoff : bool
1512
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1513
- pool : str
1514
- the slot pool this task should run in,
1515
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1516
- soft_fail : bool
1517
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1518
- name : str
1519
- Name of the sensor on Airflow
1520
- description : str
1521
- Description of sensor in the Airflow UI
1522
- external_dag_id : str
1523
- The dag_id that contains the task you want to wait for.
1524
- external_task_ids : List[str]
1525
- The list of task_ids that you want to wait for.
1526
- If None (default value) the sensor waits for the DAG. (Default: None)
1527
- allowed_states : List[str]
1528
- Iterable of allowed states, (Default: ['success'])
1529
- failed_states : List[str]
1530
- Iterable of failed or dis-allowed states. (Default: None)
1531
- execution_delta : datetime.timedelta
1532
- time difference with the previous execution to look at,
1533
- the default is the same logical date as the current task or DAG. (Default: None)
1534
- check_existence: bool
1535
- Set to True to check if the external task exists or check if
1536
- the DAG to wait for exists. (Default: True)
1322
+ packages : Dict[str, str], default {}
1323
+ Packages to use for this flow. The key is the name of the package
1324
+ and the value is the version to use.
1325
+ libraries : Dict[str, str], default {}
1326
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1327
+ python : str, optional, default None
1328
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1329
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1330
+ disabled : bool, default False
1331
+ If set to True, disables Conda.
1332
+ """
1333
+ ...
1334
+
1335
+ @typing.overload
1336
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1337
+ ...
1338
+
1339
+ 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):
1340
+ """
1341
+ Specifies the Conda environment for all steps of the flow.
1342
+
1343
+ Use `@conda_base` to set common libraries required by all
1344
+ steps and use `@conda` to specify step-specific additions.
1345
+
1346
+ Parameters
1347
+ ----------
1348
+ packages : Dict[str, str], default {}
1349
+ Packages to use for this flow. The key is the name of the package
1350
+ and the value is the version to use.
1351
+ libraries : Dict[str, str], default {}
1352
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1353
+ python : str, optional, default None
1354
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1355
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1356
+ disabled : bool, default False
1357
+ If set to True, disables Conda.
1537
1358
  """
1538
1359
  ...
1539
1360
 
@@ -1579,6 +1400,185 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1579
1400
  """
1580
1401
  ...
1581
1402
 
1403
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1404
+ """
1405
+ Specifies what flows belong to the same project.
1406
+
1407
+ A project-specific namespace is created for all flows that
1408
+ use the same `@project(name)`.
1409
+
1410
+ Parameters
1411
+ ----------
1412
+ name : str
1413
+ Project name. Make sure that the name is unique amongst all
1414
+ projects that use the same production scheduler. The name may
1415
+ contain only lowercase alphanumeric characters and underscores.
1416
+
1417
+
1418
+ """
1419
+ ...
1420
+
1421
+ 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]]:
1422
+ """
1423
+ 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.
1424
+ 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.
1425
+
1426
+ Parameters
1427
+ ----------
1428
+ timeout : int
1429
+ Time, in seconds before the task times out and fails. (Default: 3600)
1430
+ poke_interval : int
1431
+ Time in seconds that the job should wait in between each try. (Default: 60)
1432
+ mode : str
1433
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1434
+ exponential_backoff : bool
1435
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1436
+ pool : str
1437
+ the slot pool this task should run in,
1438
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1439
+ soft_fail : bool
1440
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1441
+ name : str
1442
+ Name of the sensor on Airflow
1443
+ description : str
1444
+ Description of sensor in the Airflow UI
1445
+ external_dag_id : str
1446
+ The dag_id that contains the task you want to wait for.
1447
+ external_task_ids : List[str]
1448
+ The list of task_ids that you want to wait for.
1449
+ If None (default value) the sensor waits for the DAG. (Default: None)
1450
+ allowed_states : List[str]
1451
+ Iterable of allowed states, (Default: ['success'])
1452
+ failed_states : List[str]
1453
+ Iterable of failed or dis-allowed states. (Default: None)
1454
+ execution_delta : datetime.timedelta
1455
+ time difference with the previous execution to look at,
1456
+ the default is the same logical date as the current task or DAG. (Default: None)
1457
+ check_existence: bool
1458
+ Set to True to check if the external task exists or check if
1459
+ the DAG to wait for exists. (Default: True)
1460
+ """
1461
+ ...
1462
+
1463
+ @typing.overload
1464
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1465
+ """
1466
+ Specifies the PyPI packages for all steps of the flow.
1467
+
1468
+ Use `@pypi_base` to set common packages required by all
1469
+ steps and use `@pypi` to specify step-specific overrides.
1470
+ Parameters
1471
+ ----------
1472
+ packages : Dict[str, str], default: {}
1473
+ Packages to use for this flow. The key is the name of the package
1474
+ and the value is the version to use.
1475
+ python : str, optional, default: None
1476
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1477
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1478
+ """
1479
+ ...
1480
+
1481
+ @typing.overload
1482
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1483
+ ...
1484
+
1485
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1486
+ """
1487
+ Specifies the PyPI packages for all steps of the flow.
1488
+
1489
+ Use `@pypi_base` to set common packages required by all
1490
+ steps and use `@pypi` to specify step-specific overrides.
1491
+ Parameters
1492
+ ----------
1493
+ packages : Dict[str, str], default: {}
1494
+ Packages to use for this flow. The key is the name of the package
1495
+ and the value is the version to use.
1496
+ python : str, optional, default: None
1497
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1498
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1499
+ """
1500
+ ...
1501
+
1502
+ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1503
+ """
1504
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1505
+
1506
+ User code call
1507
+ -----------
1508
+ @nim(
1509
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1510
+ backend='managed'
1511
+ )
1512
+
1513
+ Valid backend options
1514
+ ---------------------
1515
+ - 'managed': Outerbounds selects a compute provider based on the model.
1516
+ - 🚧 'dataplane': Run in your account.
1517
+
1518
+ Valid model options
1519
+ ----------------
1520
+ - 'meta/llama3-8b-instruct': 8B parameter model
1521
+ - 'meta/llama3-70b-instruct': 70B parameter model
1522
+ - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1523
+
1524
+ Parameters
1525
+ ----------
1526
+ models: list[NIM]
1527
+ List of NIM containers running models in sidecars.
1528
+ backend: str
1529
+ Compute provider to run the NIM container.
1530
+ """
1531
+ ...
1532
+
1533
+ @typing.overload
1534
+ 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]]:
1535
+ """
1536
+ Specifies the times when the flow should be run when running on a
1537
+ production scheduler.
1538
+
1539
+ Parameters
1540
+ ----------
1541
+ hourly : bool, default False
1542
+ Run the workflow hourly.
1543
+ daily : bool, default True
1544
+ Run the workflow daily.
1545
+ weekly : bool, default False
1546
+ Run the workflow weekly.
1547
+ cron : str, optional, default None
1548
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1549
+ specified by this expression.
1550
+ timezone : str, optional, default None
1551
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1552
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1553
+ """
1554
+ ...
1555
+
1556
+ @typing.overload
1557
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1558
+ ...
1559
+
1560
+ 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):
1561
+ """
1562
+ Specifies the times when the flow should be run when running on a
1563
+ production scheduler.
1564
+
1565
+ Parameters
1566
+ ----------
1567
+ hourly : bool, default False
1568
+ Run the workflow hourly.
1569
+ daily : bool, default True
1570
+ Run the workflow daily.
1571
+ weekly : bool, default False
1572
+ Run the workflow weekly.
1573
+ cron : str, optional, default None
1574
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1575
+ specified by this expression.
1576
+ timezone : str, optional, default None
1577
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1578
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1579
+ """
1580
+ ...
1581
+
1582
1582
  @typing.overload
1583
1583
  def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1584
1584
  """