ob-metaflow-stubs 6.0.3.106rc1__py2.py3-none-any.whl → 6.0.3.108__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 +572 -572
  2. metaflow-stubs/cards.pyi +4 -4
  3. metaflow-stubs/cli.pyi +3 -3
  4. metaflow-stubs/client/__init__.pyi +4 -4
  5. metaflow-stubs/client/core.pyi +6 -6
  6. metaflow-stubs/client/filecache.pyi +2 -2
  7. metaflow-stubs/clone_util.pyi +2 -2
  8. metaflow-stubs/events.pyi +2 -2
  9. metaflow-stubs/exception.pyi +2 -2
  10. metaflow-stubs/flowspec.pyi +5 -5
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +4 -4
  13. metaflow-stubs/info_file.pyi +2 -2
  14. metaflow-stubs/metadata/metadata.pyi +2 -2
  15. metaflow-stubs/metadata/util.pyi +2 -2
  16. metaflow-stubs/metaflow_config.pyi +2 -2
  17. metaflow-stubs/metaflow_current.pyi +71 -71
  18. metaflow-stubs/mflog/mflog.pyi +2 -2
  19. metaflow-stubs/multicore_utils.pyi +2 -2
  20. metaflow-stubs/parameters.pyi +4 -4
  21. metaflow-stubs/plugins/__init__.pyi +2 -2
  22. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  23. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  24. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
  27. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +4 -4
  28. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +4 -4
  29. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  30. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  31. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  32. metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +7 -7
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
  35. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
  36. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  37. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  38. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  39. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  40. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  41. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
  43. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  44. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  45. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  46. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  47. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
  48. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
  52. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  53. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  54. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  55. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  56. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  57. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  58. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  59. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  60. metaflow-stubs/plugins/cards/card_cli.pyi +5 -5
  61. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  62. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  63. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  64. metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
  65. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_modules/basic.pyi +4 -4
  67. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  69. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  71. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +3 -3
  72. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  73. metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
  74. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  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 +2 -2
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  79. metaflow-stubs/plugins/datatools/s3/s3.pyi +6 -6
  80. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  81. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  82. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  83. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  84. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  85. metaflow-stubs/plugins/events_decorator.pyi +3 -3
  86. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  87. metaflow-stubs/plugins/frameworks/pytorch.pyi +4 -4
  88. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  89. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  90. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  91. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  92. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  93. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  94. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  95. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  96. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +3 -3
  97. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +4 -4
  98. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  99. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
  100. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  101. metaflow-stubs/plugins/logs_cli.pyi +2 -2
  102. metaflow-stubs/plugins/package_cli.pyi +2 -2
  103. metaflow-stubs/plugins/parallel_decorator.pyi +3 -3
  104. metaflow-stubs/plugins/perimeters.pyi +2 -2
  105. metaflow-stubs/plugins/project_decorator.pyi +3 -3
  106. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  107. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  108. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  109. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  110. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  111. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  112. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  113. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  114. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  115. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  116. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  117. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  118. metaflow-stubs/plugins/tag_cli.pyi +4 -4
  119. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  120. metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
  121. metaflow-stubs/procpoll.pyi +2 -2
  122. metaflow-stubs/profilers/__init__.pyi +2 -2
  123. metaflow-stubs/pylint_wrapper.pyi +2 -2
  124. metaflow-stubs/runner/__init__.pyi +2 -2
  125. metaflow-stubs/runner/deployer.pyi +3 -3
  126. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  127. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  128. metaflow-stubs/runner/nbrun.pyi +2 -2
  129. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  130. metaflow-stubs/runner/utils.pyi +2 -2
  131. metaflow-stubs/system/__init__.pyi +3 -3
  132. metaflow-stubs/system/system_logger.pyi +3 -3
  133. metaflow-stubs/system/system_monitor.pyi +2 -2
  134. metaflow-stubs/tagging_util.pyi +2 -2
  135. metaflow-stubs/tuple_util.pyi +2 -2
  136. {ob_metaflow_stubs-6.0.3.106rc1.dist-info → ob_metaflow_stubs-6.0.3.108.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.108.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.106rc1.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.106rc1.dist-info → ob_metaflow_stubs-6.0.3.108.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.106rc1.dist-info → ob_metaflow_stubs-6.0.3.108.dist-info}/top_level.txt +0 -0
@@ -1,24 +1,24 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
- # Generated on 2024-10-07T18:32:56.944750 #
3
+ # MF version: 2.12.25.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-08T12:29:45.085886 #
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.runner.metaflow_runner
12
- import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
13
11
  import metaflow._vendor.click.types
14
12
  import metaflow.metaflow_current
15
- import metaflow.parameters
16
- import metaflow.client.core
17
- import typing
18
13
  import metaflow.datastore.inputs
14
+ import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
15
+ import typing
19
16
  import metaflow.flowspec
20
- import metaflow.events
21
17
  import datetime
18
+ import metaflow.runner.metaflow_runner
19
+ import metaflow.parameters
20
+ import metaflow.events
21
+ import metaflow.client.core
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -513,82 +513,59 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
513
513
  ...
514
514
 
515
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]]]:
516
+ 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]]]:
536
517
  """
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.
518
+ Specifies a timeout for your step.
552
519
 
553
- temp_dir_root : str, default: None
554
- The root directory under which `current.checkpoint.directory` will be created.
520
+ This decorator is useful if this step may hang indefinitely.
555
521
 
522
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
523
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
524
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
556
525
 
526
+ Note that all the values specified in parameters are added together so if you specify
527
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
557
528
 
529
+ Parameters
530
+ ----------
531
+ seconds : int, default 0
532
+ Number of seconds to wait prior to timing out.
533
+ minutes : int, default 0
534
+ Number of minutes to wait prior to timing out.
535
+ hours : int, default 0
536
+ Number of hours to wait prior to timing out.
558
537
  """
559
538
  ...
560
539
 
561
540
  @typing.overload
562
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
541
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
563
542
  ...
564
543
 
565
544
  @typing.overload
566
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
545
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
567
546
  ...
568
547
 
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):
548
+ 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):
570
549
  """
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.
550
+ Specifies a timeout for your step.
586
551
 
587
- temp_dir_root : str, default: None
588
- The root directory under which `current.checkpoint.directory` will be created.
552
+ This decorator is useful if this step may hang indefinitely.
589
553
 
554
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
555
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
556
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
590
557
 
558
+ Note that all the values specified in parameters are added together so if you specify
559
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
591
560
 
561
+ Parameters
562
+ ----------
563
+ seconds : int, default 0
564
+ Number of seconds to wait prior to timing out.
565
+ minutes : int, default 0
566
+ Number of minutes to wait prior to timing out.
567
+ hours : int, default 0
568
+ Number of hours to wait prior to timing out.
592
569
  """
593
570
  ...
594
571
 
@@ -658,127 +635,6 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
658
635
  """
659
636
  ...
660
637
 
661
- @typing.overload
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]]]:
663
- """
664
- Specifies a timeout for your step.
665
-
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.
674
-
675
- Parameters
676
- ----------
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.
683
- """
684
- ...
685
-
686
- @typing.overload
687
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
688
- ...
689
-
690
- @typing.overload
691
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
692
- ...
693
-
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):
695
- """
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.
715
- """
716
- ...
717
-
718
- @typing.overload
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]]]:
720
- """
721
- Specifies environment variables to be set prior to the execution of a step.
722
-
723
- Parameters
724
- ----------
725
- vars : Dict[str, str], default {}
726
- Dictionary of environment variables to set.
727
- """
728
- ...
729
-
730
- @typing.overload
731
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
732
- ...
733
-
734
- @typing.overload
735
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
736
- ...
737
-
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] = {}):
739
- """
740
- Specifies environment variables to be set prior to the execution of a step.
741
-
742
- Parameters
743
- ----------
744
- vars : Dict[str, str], default {}
745
- Dictionary of environment variables to set.
746
- """
747
- ...
748
-
749
- @typing.overload
750
- 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]]]:
751
- """
752
- Specifies secrets to be retrieved and injected as environment variables prior to
753
- the execution of a step.
754
-
755
- Parameters
756
- ----------
757
- sources : List[Union[str, Dict[str, Any]]], default: []
758
- List of secret specs, defining how the secrets are to be retrieved
759
- """
760
- ...
761
-
762
- @typing.overload
763
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
764
- ...
765
-
766
- @typing.overload
767
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
768
- ...
769
-
770
- 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]]] = []):
771
- """
772
- Specifies secrets to be retrieved and injected as environment variables prior to
773
- the execution of a step.
774
-
775
- Parameters
776
- ----------
777
- sources : List[Union[str, Dict[str, Any]]], default: []
778
- List of secret specs, defining how the secrets are to be retrieved
779
- """
780
- ...
781
-
782
638
  @typing.overload
783
639
  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]]]:
784
640
  """
@@ -829,110 +685,128 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
829
685
  ...
830
686
 
831
687
  @typing.overload
832
- 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]]]:
688
+ 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]]]:
833
689
  """
834
- Creates a human-readable report, a Metaflow Card, after this step completes.
690
+ Specifies the PyPI packages for the step.
835
691
 
836
- Note that you may add multiple `@card` decorators in a step with different parameters.
692
+ Information in this decorator will augment any
693
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
694
+ you can use `@pypi_base` to set packages required by all
695
+ steps and use `@pypi` to specify step-specific overrides.
837
696
 
838
697
  Parameters
839
698
  ----------
840
- type : str, default 'default'
841
- Card type.
842
- id : str, optional, default None
843
- If multiple cards are present, use this id to identify this card.
844
- options : Dict[str, Any], default {}
845
- Options passed to the card. The contents depend on the card type.
846
- timeout : int, default 45
847
- Interrupt reporting if it takes more than this many seconds.
848
-
849
-
699
+ packages : Dict[str, str], default: {}
700
+ Packages to use for this step. The key is the name of the package
701
+ and the value is the version to use.
702
+ python : str, optional, default: None
703
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
704
+ that the version used will correspond to the version of the Python interpreter used to start the run.
850
705
  """
851
706
  ...
852
707
 
853
708
  @typing.overload
854
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
709
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
855
710
  ...
856
711
 
857
712
  @typing.overload
858
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
713
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
859
714
  ...
860
715
 
861
- def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
716
+ 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):
862
717
  """
863
- Creates a human-readable report, a Metaflow Card, after this step completes.
718
+ Specifies the PyPI packages for the step.
864
719
 
865
- Note that you may add multiple `@card` decorators in a step with different parameters.
720
+ Information in this decorator will augment any
721
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
722
+ you can use `@pypi_base` to set packages required by all
723
+ steps and use `@pypi` to specify step-specific overrides.
866
724
 
867
725
  Parameters
868
726
  ----------
869
- type : str, default 'default'
870
- Card type.
871
- id : str, optional, default None
872
- If multiple cards are present, use this id to identify this card.
873
- options : Dict[str, Any], default {}
874
- Options passed to the card. The contents depend on the card type.
875
- timeout : int, default 45
876
- Interrupt reporting if it takes more than this many seconds.
877
-
878
-
727
+ packages : Dict[str, str], default: {}
728
+ Packages to use for this step. The key is the name of the package
729
+ and the value is the version to use.
730
+ python : str, optional, default: None
731
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
732
+ that the version used will correspond to the version of the Python interpreter used to start the run.
879
733
  """
880
734
  ...
881
735
 
882
736
  @typing.overload
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]]]:
737
+ 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]]]:
884
738
  """
885
- Specifies the Conda environment for the step.
739
+ Specifies the resources needed when executing this step.
886
740
 
887
- Information in this decorator will augment any
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.
741
+ Use `@resources` to specify the resource requirements
742
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
743
+
744
+ You can choose the compute layer on the command line by executing e.g.
745
+ ```
746
+ python myflow.py run --with batch
747
+ ```
748
+ or
749
+ ```
750
+ python myflow.py run --with kubernetes
751
+ ```
752
+ which executes the flow on the desired system using the
753
+ requirements specified in `@resources`.
891
754
 
892
755
  Parameters
893
756
  ----------
894
- packages : Dict[str, str], default {}
895
- Packages to use for this step. The key is the name of the package
896
- and the value is the version to use.
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
900
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
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.
757
+ cpu : int, default 1
758
+ Number of CPUs required for this step.
759
+ gpu : int, default 0
760
+ Number of GPUs required for this step.
761
+ disk : int, optional, default None
762
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
763
+ memory : int, default 4096
764
+ Memory size (in MB) required for this step.
765
+ shared_memory : int, optional, default None
766
+ The value for the size (in MiB) of the /dev/shm volume for this step.
767
+ This parameter maps to the `--shm-size` option in Docker.
904
768
  """
905
769
  ...
906
770
 
907
771
  @typing.overload
908
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
772
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
909
773
  ...
910
774
 
911
775
  @typing.overload
912
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
776
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
913
777
  ...
914
778
 
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):
779
+ 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):
916
780
  """
917
- Specifies the Conda environment for the step.
781
+ Specifies the resources needed when executing this step.
918
782
 
919
- Information in this decorator will augment any
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.
783
+ Use `@resources` to specify the resource requirements
784
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
785
+
786
+ You can choose the compute layer on the command line by executing e.g.
787
+ ```
788
+ python myflow.py run --with batch
789
+ ```
790
+ or
791
+ ```
792
+ python myflow.py run --with kubernetes
793
+ ```
794
+ which executes the flow on the desired system using the
795
+ requirements specified in `@resources`.
923
796
 
924
797
  Parameters
925
798
  ----------
926
- packages : Dict[str, str], default {}
927
- Packages to use for this step. The key is the name of the package
928
- and the value is the version to use.
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
932
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
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.
799
+ cpu : int, default 1
800
+ Number of CPUs required for this step.
801
+ gpu : int, default 0
802
+ Number of GPUs required for this step.
803
+ disk : int, optional, default None
804
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
805
+ memory : int, default 4096
806
+ Memory size (in MB) required for this step.
807
+ shared_memory : int, optional, default None
808
+ The value for the size (in MiB) of the /dev/shm volume for this step.
809
+ This parameter maps to the `--shm-size` option in Docker.
936
810
  """
937
811
  ...
938
812
 
@@ -998,287 +872,322 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
998
872
  ...
999
873
 
1000
874
  @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]]]:
875
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1002
876
  """
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.
877
+ Internal decorator to support Fast bakery
878
+ """
879
+ ...
880
+
881
+ @typing.overload
882
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
883
+ ...
884
+
885
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
886
+ """
887
+ Internal decorator to support Fast bakery
888
+ """
889
+ ...
890
+
891
+ @typing.overload
892
+ 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]]]:
893
+ """
894
+ Specifies secrets to be retrieved and injected as environment variables prior to
895
+ the execution of a step.
1013
896
 
1014
897
  Parameters
1015
898
  ----------
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.
899
+ sources : List[Union[str, Dict[str, Any]]], default: []
900
+ List of secret specs, defining how the secrets are to be retrieved
1020
901
  """
1021
902
  ...
1022
903
 
1023
904
  @typing.overload
1024
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
905
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1025
906
  ...
1026
907
 
1027
908
  @typing.overload
1028
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
909
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1029
910
  ...
1030
911
 
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):
912
+ 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]]] = []):
1032
913
  """
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)`.
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.
914
+ Specifies secrets to be retrieved and injected as environment variables prior to
915
+ the execution of a step.
1043
916
 
1044
917
  Parameters
1045
918
  ----------
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.
919
+ sources : List[Union[str, Dict[str, Any]]], default: []
920
+ List of secret specs, defining how the secrets are to be retrieved
1050
921
  """
1051
922
  ...
1052
923
 
1053
924
  @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]]]:
925
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1055
926
  """
1056
- Specifies the PyPI packages for the step.
927
+ Decorator prototype for all step decorators. This function gets specialized
928
+ and imported for all decorators types by _import_plugin_decorators().
929
+ """
930
+ ...
931
+
932
+ @typing.overload
933
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
934
+ ...
935
+
936
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
937
+ """
938
+ Decorator prototype for all step decorators. This function gets specialized
939
+ and imported for all decorators types by _import_plugin_decorators().
940
+ """
941
+ ...
942
+
943
+ @typing.overload
944
+ 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]]]:
945
+ """
946
+ Specifies the Conda environment for the step.
1057
947
 
1058
948
  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.
949
+ attributes set in the `@conda_base` flow-level decorator. Hence,
950
+ you can use `@conda_base` to set packages required by all
951
+ steps and use `@conda` to specify step-specific overrides.
1062
952
 
1063
953
  Parameters
1064
954
  ----------
1065
- packages : Dict[str, str], default: {}
955
+ packages : Dict[str, str], default {}
1066
956
  Packages to use for this step. The key is the name of the package
1067
957
  and the value is the version to use.
1068
- python : str, optional, default: None
958
+ libraries : Dict[str, str], default {}
959
+ Supported for backward compatibility. When used with packages, packages will take precedence.
960
+ python : str, optional, default None
1069
961
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1070
962
  that the version used will correspond to the version of the Python interpreter used to start the run.
963
+ disabled : bool, default False
964
+ If set to True, disables @conda.
1071
965
  """
1072
966
  ...
1073
967
 
1074
968
  @typing.overload
1075
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
969
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1076
970
  ...
1077
971
 
1078
972
  @typing.overload
1079
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
973
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1080
974
  ...
1081
975
 
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):
976
+ 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):
1083
977
  """
1084
- Specifies the PyPI packages for the step.
978
+ Specifies the Conda environment for the step.
1085
979
 
1086
980
  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.
981
+ attributes set in the `@conda_base` flow-level decorator. Hence,
982
+ you can use `@conda_base` to set packages required by all
983
+ steps and use `@conda` to specify step-specific overrides.
1090
984
 
1091
985
  Parameters
1092
986
  ----------
1093
- packages : Dict[str, str], default: {}
987
+ packages : Dict[str, str], default {}
1094
988
  Packages to use for this step. The key is the name of the package
1095
989
  and the value is the version to use.
1096
- python : str, optional, default: None
990
+ libraries : Dict[str, str], default {}
991
+ Supported for backward compatibility. When used with packages, packages will take precedence.
992
+ python : str, optional, default None
1097
993
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1098
994
  that the version used will correspond to the version of the Python interpreter used to start the run.
995
+ disabled : bool, default False
996
+ If set to True, disables @conda.
1099
997
  """
1100
998
  ...
1101
999
 
1102
1000
  @typing.overload
1103
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1001
+ 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]]]:
1104
1002
  """
1105
- Internal decorator to support Fast bakery
1003
+ Specifies environment variables to be set prior to the execution of a step.
1004
+
1005
+ Parameters
1006
+ ----------
1007
+ vars : Dict[str, str], default {}
1008
+ Dictionary of environment variables to set.
1106
1009
  """
1107
1010
  ...
1108
1011
 
1109
1012
  @typing.overload
1110
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1013
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1111
1014
  ...
1112
1015
 
1113
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1016
+ @typing.overload
1017
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1018
+ ...
1019
+
1020
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1114
1021
  """
1115
- Internal decorator to support Fast bakery
1022
+ Specifies environment variables to be set prior to the execution of a step.
1023
+
1024
+ Parameters
1025
+ ----------
1026
+ vars : Dict[str, str], default {}
1027
+ Dictionary of environment variables to set.
1116
1028
  """
1117
1029
  ...
1118
1030
 
1119
1031
  @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]]]:
1032
+ 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]]]:
1121
1033
  """
1122
- Specifies the resources needed when executing this step.
1123
-
1124
- Use `@resources` to specify the resource requirements
1125
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1034
+ Enables checkpointing for a step.
1126
1035
 
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`.
1137
1036
 
1138
1037
  Parameters
1139
1038
  ----------
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.
1039
+ load_policy : str, default: "fresh"
1040
+ The policy for loading the checkpoint. The following policies are supported:
1041
+ - "eager": Loads the the latest available checkpoint within the namespace.
1042
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1043
+ will be loaded at the start of the task.
1044
+ - "none": Do not load any checkpoint
1045
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1046
+ This mode helps loading checkpoints across various retry attempts of the same task.
1047
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1048
+ created within the task will be loaded when the task is retries execution on failure.
1049
+
1050
+ temp_dir_root : str, default: None
1051
+ The root directory under which `current.checkpoint.directory` will be created.
1052
+
1053
+
1054
+
1151
1055
  """
1152
1056
  ...
1153
1057
 
1154
1058
  @typing.overload
1155
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1059
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1156
1060
  ...
1157
1061
 
1158
1062
  @typing.overload
1159
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1063
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1160
1064
  ...
1161
1065
 
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):
1066
+ 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):
1163
1067
  """
1164
- Specifies the resources needed when executing this step.
1068
+ Enables checkpointing for a step.
1165
1069
 
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
1070
 
1180
1071
  Parameters
1181
1072
  ----------
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.
1073
+ load_policy : str, default: "fresh"
1074
+ The policy for loading the checkpoint. The following policies are supported:
1075
+ - "eager": Loads the the latest available checkpoint within the namespace.
1076
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1077
+ will be loaded at the start of the task.
1078
+ - "none": Do not load any checkpoint
1079
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1080
+ This mode helps loading checkpoints across various retry attempts of the same task.
1081
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1082
+ created within the task will be loaded when the task is retries execution on failure.
1083
+
1084
+ temp_dir_root : str, default: None
1085
+ The root directory under which `current.checkpoint.directory` will be created.
1086
+
1087
+
1088
+
1193
1089
  """
1194
1090
  ...
1195
1091
 
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]]:
1092
+ @typing.overload
1093
+ 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]]]:
1197
1094
  """
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.
1095
+ Specifies the number of times the task corresponding
1096
+ to a step needs to be retried.
1097
+
1098
+ This decorator is useful for handling transient errors, such as networking issues.
1099
+ If your task contains operations that can't be retried safely, e.g. database updates,
1100
+ it is advisable to annotate it with `@retry(times=0)`.
1101
+
1102
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1103
+ decorator will execute a no-op task after all retries have been exhausted,
1104
+ ensuring that the flow execution can continue.
1203
1105
 
1204
1106
  Parameters
1205
1107
  ----------
1206
- timeout : int
1207
- Time, in seconds before the task times out and fails. (Default: 3600)
1208
- poke_interval : int
1209
- Time in seconds that the job should wait in between each try. (Default: 60)
1210
- mode : str
1211
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1212
- exponential_backoff : bool
1213
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1214
- pool : str
1215
- the slot pool this task should run in,
1216
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1217
- soft_fail : bool
1218
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1219
- name : str
1220
- Name of the sensor on Airflow
1221
- description : str
1222
- Description of sensor in the Airflow UI
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)
1108
+ times : int, default 3
1109
+ Number of times to retry this task.
1110
+ minutes_between_retries : int, default 2
1111
+ Number of minutes between retries.
1235
1112
  """
1236
1113
  ...
1237
1114
 
1238
- def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1115
+ @typing.overload
1116
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1117
+ ...
1118
+
1119
+ @typing.overload
1120
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1121
+ ...
1122
+
1123
+ 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):
1239
1124
  """
1240
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1125
+ Specifies the number of times the task corresponding
1126
+ to a step needs to be retried.
1241
1127
 
1242
- User code call
1243
- -----------
1244
- @nim(
1245
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1246
- backend='managed'
1247
- )
1128
+ This decorator is useful for handling transient errors, such as networking issues.
1129
+ If your task contains operations that can't be retried safely, e.g. database updates,
1130
+ it is advisable to annotate it with `@retry(times=0)`.
1248
1131
 
1249
- Valid backend options
1250
- ---------------------
1251
- - 'managed': Outerbounds selects a compute provider based on the model.
1252
- - 🚧 'dataplane': Run in your account.
1132
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
1133
+ decorator will execute a no-op task after all retries have been exhausted,
1134
+ ensuring that the flow execution can continue.
1253
1135
 
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
1136
+ Parameters
1137
+ ----------
1138
+ times : int, default 3
1139
+ Number of times to retry this task.
1140
+ minutes_between_retries : int, default 2
1141
+ Number of minutes between retries.
1142
+ """
1143
+ ...
1144
+
1145
+ @typing.overload
1146
+ 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]]]:
1147
+ """
1148
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1149
+
1150
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1259
1151
 
1260
1152
  Parameters
1261
1153
  ----------
1262
- models: list[NIM]
1263
- List of NIM containers running models in sidecars.
1264
- backend: str
1265
- Compute provider to run the NIM container.
1154
+ type : str, default 'default'
1155
+ Card type.
1156
+ id : str, optional, default None
1157
+ If multiple cards are present, use this id to identify this card.
1158
+ options : Dict[str, Any], default {}
1159
+ Options passed to the card. The contents depend on the card type.
1160
+ timeout : int, default 45
1161
+ Interrupt reporting if it takes more than this many seconds.
1162
+
1163
+
1266
1164
  """
1267
1165
  ...
1268
1166
 
1269
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1167
+ @typing.overload
1168
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1169
+ ...
1170
+
1171
+ @typing.overload
1172
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1173
+ ...
1174
+
1175
+ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
1270
1176
  """
1271
- Specifies what flows belong to the same project.
1177
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1272
1178
 
1273
- A project-specific namespace is created for all flows that
1274
- use the same `@project(name)`.
1179
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1275
1180
 
1276
1181
  Parameters
1277
1182
  ----------
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.
1183
+ type : str, default 'default'
1184
+ Card type.
1185
+ id : str, optional, default None
1186
+ If multiple cards are present, use this id to identify this card.
1187
+ options : Dict[str, Any], default {}
1188
+ Options passed to the card. The contents depend on the card type.
1189
+ timeout : int, default 45
1190
+ Interrupt reporting if it takes more than this many seconds.
1282
1191
 
1283
1192
 
1284
1193
  """
@@ -1323,48 +1232,6 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
1323
1232
  """
1324
1233
  ...
1325
1234
 
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]]:
1327
- """
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.
1330
-
1331
- Parameters
1332
- ----------
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)
1365
- """
1366
- ...
1367
-
1368
1235
  @typing.overload
1369
1236
  def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1370
1237
  """
@@ -1449,120 +1316,22 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1449
1316
  @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1450
1317
  ```
1451
1318
 
1452
- Note that `branch` is typically one of:
1453
- - `prod`
1454
- - `user.bob`
1455
- - `test.my_experiment`
1456
- - `prod.staging`
1457
-
1458
- Parameters
1459
- ----------
1460
- flow : Union[str, Dict[str, str]], optional, default None
1461
- Upstream flow dependency for this flow.
1462
- flows : List[Union[str, Dict[str, str]]], default []
1463
- Upstream flow dependencies for this flow.
1464
- options : Dict[str, Any], default {}
1465
- Backend-specific configuration for tuning eventing behavior.
1466
-
1467
-
1468
- """
1469
- ...
1470
-
1471
- @typing.overload
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]]:
1473
- """
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.
1478
-
1479
- Parameters
1480
- ----------
1481
- packages : Dict[str, str], default {}
1482
- Packages to use for this flow. The key is the name of the package
1483
- and the value is the version to use.
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
1487
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
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.
1491
- """
1492
- ...
1493
-
1494
- @typing.overload
1495
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1496
- ...
1497
-
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):
1499
- """
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.
1504
-
1505
- Parameters
1506
- ----------
1507
- packages : Dict[str, str], default {}
1508
- Packages to use for this flow. The key is the name of the package
1509
- and the value is the version to use.
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
1513
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
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.
1319
+ Note that `branch` is typically one of:
1320
+ - `prod`
1321
+ - `user.bob`
1322
+ - `test.my_experiment`
1323
+ - `prod.staging`
1551
1324
 
1552
1325
  Parameters
1553
1326
  ----------
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).
1327
+ flow : Union[str, Dict[str, str]], optional, default None
1328
+ Upstream flow dependency for this flow.
1329
+ flows : List[Union[str, Dict[str, str]]], default []
1330
+ Upstream flow dependencies for this flow.
1331
+ options : Dict[str, Any], default {}
1332
+ Backend-specific configuration for tuning eventing behavior.
1333
+
1334
+
1566
1335
  """
1567
1336
  ...
1568
1337
 
@@ -1661,6 +1430,237 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1661
1430
  """
1662
1431
  ...
1663
1432
 
1433
+ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1434
+ """
1435
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1436
+
1437
+ User code call
1438
+ -----------
1439
+ @nim(
1440
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1441
+ backend='managed'
1442
+ )
1443
+
1444
+ Valid backend options
1445
+ ---------------------
1446
+ - 'managed': Outerbounds selects a compute provider based on the model.
1447
+ - 🚧 'dataplane': Run in your account.
1448
+
1449
+ Valid model options
1450
+ ----------------
1451
+ - 'meta/llama3-8b-instruct': 8B parameter model
1452
+ - 'meta/llama3-70b-instruct': 70B parameter model
1453
+ - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1454
+
1455
+ Parameters
1456
+ ----------
1457
+ models: list[NIM]
1458
+ List of NIM containers running models in sidecars.
1459
+ backend: str
1460
+ Compute provider to run the NIM container.
1461
+ """
1462
+ ...
1463
+
1464
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1465
+ """
1466
+ Specifies what flows belong to the same project.
1467
+
1468
+ A project-specific namespace is created for all flows that
1469
+ use the same `@project(name)`.
1470
+
1471
+ Parameters
1472
+ ----------
1473
+ name : str
1474
+ Project name. Make sure that the name is unique amongst all
1475
+ projects that use the same production scheduler. The name may
1476
+ contain only lowercase alphanumeric characters and underscores.
1477
+
1478
+
1479
+ """
1480
+ ...
1481
+
1482
+ @typing.overload
1483
+ def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1484
+ """
1485
+ Specifies the times when the flow should be run when running on a
1486
+ production scheduler.
1487
+
1488
+ Parameters
1489
+ ----------
1490
+ hourly : bool, default False
1491
+ Run the workflow hourly.
1492
+ daily : bool, default True
1493
+ Run the workflow daily.
1494
+ weekly : bool, default False
1495
+ Run the workflow weekly.
1496
+ cron : str, optional, default None
1497
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1498
+ specified by this expression.
1499
+ timezone : str, optional, default None
1500
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1501
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1502
+ """
1503
+ ...
1504
+
1505
+ @typing.overload
1506
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1507
+ ...
1508
+
1509
+ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1510
+ """
1511
+ Specifies the times when the flow should be run when running on a
1512
+ production scheduler.
1513
+
1514
+ Parameters
1515
+ ----------
1516
+ hourly : bool, default False
1517
+ Run the workflow hourly.
1518
+ daily : bool, default True
1519
+ Run the workflow daily.
1520
+ weekly : bool, default False
1521
+ Run the workflow weekly.
1522
+ cron : str, optional, default None
1523
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1524
+ specified by this expression.
1525
+ timezone : str, optional, default None
1526
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1527
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1528
+ """
1529
+ ...
1530
+
1531
+ 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]]:
1532
+ """
1533
+ 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.
1534
+ 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.
1535
+
1536
+ Parameters
1537
+ ----------
1538
+ timeout : int
1539
+ Time, in seconds before the task times out and fails. (Default: 3600)
1540
+ poke_interval : int
1541
+ Time in seconds that the job should wait in between each try. (Default: 60)
1542
+ mode : str
1543
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1544
+ exponential_backoff : bool
1545
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1546
+ pool : str
1547
+ the slot pool this task should run in,
1548
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1549
+ soft_fail : bool
1550
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1551
+ name : str
1552
+ Name of the sensor on Airflow
1553
+ description : str
1554
+ Description of sensor in the Airflow UI
1555
+ external_dag_id : str
1556
+ The dag_id that contains the task you want to wait for.
1557
+ external_task_ids : List[str]
1558
+ The list of task_ids that you want to wait for.
1559
+ If None (default value) the sensor waits for the DAG. (Default: None)
1560
+ allowed_states : List[str]
1561
+ Iterable of allowed states, (Default: ['success'])
1562
+ failed_states : List[str]
1563
+ Iterable of failed or dis-allowed states. (Default: None)
1564
+ execution_delta : datetime.timedelta
1565
+ time difference with the previous execution to look at,
1566
+ the default is the same logical date as the current task or DAG. (Default: None)
1567
+ check_existence: bool
1568
+ Set to True to check if the external task exists or check if
1569
+ the DAG to wait for exists. (Default: True)
1570
+ """
1571
+ ...
1572
+
1573
+ 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]]:
1574
+ """
1575
+ 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)
1576
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1577
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1578
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1579
+ starts only after all sensors finish.
1580
+
1581
+ Parameters
1582
+ ----------
1583
+ timeout : int
1584
+ Time, in seconds before the task times out and fails. (Default: 3600)
1585
+ poke_interval : int
1586
+ Time in seconds that the job should wait in between each try. (Default: 60)
1587
+ mode : str
1588
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1589
+ exponential_backoff : bool
1590
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1591
+ pool : str
1592
+ the slot pool this task should run in,
1593
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1594
+ soft_fail : bool
1595
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1596
+ name : str
1597
+ Name of the sensor on Airflow
1598
+ description : str
1599
+ Description of sensor in the Airflow UI
1600
+ bucket_key : Union[str, List[str]]
1601
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1602
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1603
+ bucket_name : str
1604
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1605
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1606
+ wildcard_match : bool
1607
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1608
+ aws_conn_id : str
1609
+ a reference to the s3 connection on Airflow. (Default: None)
1610
+ verify : bool
1611
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1612
+ """
1613
+ ...
1614
+
1615
+ @typing.overload
1616
+ 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]]:
1617
+ """
1618
+ Specifies the Conda environment for all steps of the flow.
1619
+
1620
+ Use `@conda_base` to set common libraries required by all
1621
+ steps and use `@conda` to specify step-specific additions.
1622
+
1623
+ Parameters
1624
+ ----------
1625
+ packages : Dict[str, str], default {}
1626
+ Packages to use for this flow. The key is the name of the package
1627
+ and the value is the version to use.
1628
+ libraries : Dict[str, str], default {}
1629
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1630
+ python : str, optional, default None
1631
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1632
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1633
+ disabled : bool, default False
1634
+ If set to True, disables Conda.
1635
+ """
1636
+ ...
1637
+
1638
+ @typing.overload
1639
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1640
+ ...
1641
+
1642
+ 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):
1643
+ """
1644
+ Specifies the Conda environment for all steps of the flow.
1645
+
1646
+ Use `@conda_base` to set common libraries required by all
1647
+ steps and use `@conda` to specify step-specific additions.
1648
+
1649
+ Parameters
1650
+ ----------
1651
+ packages : Dict[str, str], default {}
1652
+ Packages to use for this flow. The key is the name of the package
1653
+ and the value is the version to use.
1654
+ libraries : Dict[str, str], default {}
1655
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1656
+ python : str, optional, default None
1657
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1658
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1659
+ disabled : bool, default False
1660
+ If set to True, disables Conda.
1661
+ """
1662
+ ...
1663
+
1664
1664
  def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
1665
1665
  """
1666
1666
  Switch namespace to the one provided.