ob-metaflow-stubs 6.0.3.102rc8__py2.py3-none-any.whl → 6.0.3.103__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 +546 -546
  2. metaflow-stubs/cards.pyi +6 -6
  3. metaflow-stubs/cli.pyi +3 -3
  4. metaflow-stubs/client/__init__.pyi +3 -3
  5. metaflow-stubs/client/core.pyi +7 -7
  6. metaflow-stubs/client/filecache.pyi +3 -3
  7. metaflow-stubs/clone_util.pyi +2 -2
  8. metaflow-stubs/events.pyi +3 -3
  9. metaflow-stubs/exception.pyi +2 -2
  10. metaflow-stubs/flowspec.pyi +5 -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 +3 -3
  15. metaflow-stubs/metadata/util.pyi +2 -2
  16. metaflow-stubs/metaflow_config.pyi +2 -2
  17. metaflow-stubs/metaflow_current.pyi +86 -86
  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 +3 -3
  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 +5 -5
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +7 -7
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +7 -7
  35. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  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 +4 -4
  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 +4 -4
  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 +3 -3
  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 +2 -2
  72. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  73. metaflow-stubs/plugins/cards/component_serializer.pyi +3 -3
  74. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  75. metaflow-stubs/plugins/catch_decorator.pyi +4 -4
  76. metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
  77. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  79. metaflow-stubs/plugins/datatools/s3/s3.pyi +7 -7
  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 +3 -3
  98. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  99. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +4 -4
  100. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  101. metaflow-stubs/plugins/logs_cli.pyi +3 -3
  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 +4 -4
  109. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  110. metaflow-stubs/plugins/pypi/pypi_environment.pyi +3 -3
  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 +5 -5
  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 +5 -5
  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.102rc8.dist-info → ob_metaflow_stubs-6.0.3.103.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.103.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.102rc8.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.102rc8.dist-info → ob_metaflow_stubs-6.0.3.103.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.102rc8.dist-info → ob_metaflow_stubs-6.0.3.103.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.22.1+obcheckpoint(0.0.10);ob(v1) #
4
- # Generated on 2024-09-20T19:35:46.753101 #
3
+ # MF version: 2.12.22.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-09-20T20:42:33.459900 #
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.client.core
12
- import metaflow.metaflow_current
13
- import typing
14
- import metaflow.flowspec
15
- import datetime
16
- import metaflow.runner.metaflow_runner
11
+ import metaflow._vendor.click.types
17
12
  import metaflow.datastore.inputs
13
+ import metaflow.runner.metaflow_runner
14
+ import datetime
15
+ import metaflow.flowspec
16
+ import metaflow.events
18
17
  import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
19
- import metaflow._vendor.click.types
18
+ import metaflow.metaflow_current
20
19
  import metaflow.parameters
21
- import metaflow.events
20
+ import metaflow.client.core
21
+ import typing
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -434,67 +434,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
434
434
  """
435
435
  ...
436
436
 
437
- @typing.overload
438
- 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]]]:
439
- """
440
- Enables loading / saving of models within a step.
441
-
442
-
443
- Parameters
444
- ----------
445
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
446
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
447
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
448
- - `current.checkpoint`
449
- - `current.model`
450
- - `current.huggingface_hub`
451
-
452
- 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
453
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
454
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
455
-
456
- temp_dir_root : str, default: None
457
- The root directory under which `current.model.loaded` will store loaded models
458
-
459
-
460
-
461
- """
462
- ...
463
-
464
- @typing.overload
465
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
466
- ...
467
-
468
- @typing.overload
469
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
470
- ...
471
-
472
- 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):
473
- """
474
- Enables loading / saving of models within a step.
475
-
476
-
477
- Parameters
478
- ----------
479
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
480
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
481
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
482
- - `current.checkpoint`
483
- - `current.model`
484
- - `current.huggingface_hub`
485
-
486
- 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
487
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
488
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
489
-
490
- temp_dir_root : str, default: None
491
- The root directory under which `current.model.loaded` will store loaded models
492
-
493
-
494
-
495
- """
496
- ...
497
-
498
437
  @typing.overload
499
438
  def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
500
439
  """
@@ -514,59 +453,6 @@ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
514
453
  """
515
454
  ...
516
455
 
517
- @typing.overload
518
- 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]]]:
519
- """
520
- Specifies the number of times the task corresponding
521
- to a step needs to be retried.
522
-
523
- This decorator is useful for handling transient errors, such as networking issues.
524
- If your task contains operations that can't be retried safely, e.g. database updates,
525
- it is advisable to annotate it with `@retry(times=0)`.
526
-
527
- This can be used in conjunction with the `@catch` decorator. The `@catch`
528
- decorator will execute a no-op task after all retries have been exhausted,
529
- ensuring that the flow execution can continue.
530
-
531
- Parameters
532
- ----------
533
- times : int, default 3
534
- Number of times to retry this task.
535
- minutes_between_retries : int, default 2
536
- Number of minutes between retries.
537
- """
538
- ...
539
-
540
- @typing.overload
541
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
542
- ...
543
-
544
- @typing.overload
545
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
546
- ...
547
-
548
- 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):
549
- """
550
- Specifies the number of times the task corresponding
551
- to a step needs to be retried.
552
-
553
- This decorator is useful for handling transient errors, such as networking issues.
554
- If your task contains operations that can't be retried safely, e.g. database updates,
555
- it is advisable to annotate it with `@retry(times=0)`.
556
-
557
- This can be used in conjunction with the `@catch` decorator. The `@catch`
558
- decorator will execute a no-op task after all retries have been exhausted,
559
- ensuring that the flow execution can continue.
560
-
561
- Parameters
562
- ----------
563
- times : int, default 3
564
- Number of times to retry this task.
565
- minutes_between_retries : int, default 2
566
- Number of minutes between retries.
567
- """
568
- ...
569
-
570
456
  @typing.overload
571
457
  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]]]:
572
458
  """
@@ -645,198 +531,153 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
645
531
  ...
646
532
 
647
533
  @typing.overload
648
- 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]]]:
534
+ 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]]]:
649
535
  """
650
- Creates a human-readable report, a Metaflow Card, after this step completes.
536
+ Specifies that the step will success under all circumstances.
651
537
 
652
- Note that you may add multiple `@card` decorators in a step with different parameters.
538
+ The decorator will create an optional artifact, specified by `var`, which
539
+ contains the exception raised. You can use it to detect the presence
540
+ of errors, indicating that all happy-path artifacts produced by the step
541
+ are missing.
653
542
 
654
543
  Parameters
655
544
  ----------
656
- type : str, default 'default'
657
- Card type.
658
- id : str, optional, default None
659
- If multiple cards are present, use this id to identify this card.
660
- options : Dict[str, Any], default {}
661
- Options passed to the card. The contents depend on the card type.
662
- timeout : int, default 45
663
- Interrupt reporting if it takes more than this many seconds.
664
-
665
-
545
+ var : str, optional, default None
546
+ Name of the artifact in which to store the caught exception.
547
+ If not specified, the exception is not stored.
548
+ print_exception : bool, default True
549
+ Determines whether or not the exception is printed to
550
+ stdout when caught.
666
551
  """
667
552
  ...
668
553
 
669
554
  @typing.overload
670
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
555
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
671
556
  ...
672
557
 
673
558
  @typing.overload
674
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
559
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
675
560
  ...
676
561
 
677
- 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):
562
+ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
678
563
  """
679
- Creates a human-readable report, a Metaflow Card, after this step completes.
564
+ Specifies that the step will success under all circumstances.
680
565
 
681
- Note that you may add multiple `@card` decorators in a step with different parameters.
566
+ The decorator will create an optional artifact, specified by `var`, which
567
+ contains the exception raised. You can use it to detect the presence
568
+ of errors, indicating that all happy-path artifacts produced by the step
569
+ are missing.
682
570
 
683
571
  Parameters
684
572
  ----------
685
- type : str, default 'default'
686
- Card type.
687
- id : str, optional, default None
688
- If multiple cards are present, use this id to identify this card.
689
- options : Dict[str, Any], default {}
690
- Options passed to the card. The contents depend on the card type.
691
- timeout : int, default 45
692
- Interrupt reporting if it takes more than this many seconds.
693
-
694
-
573
+ var : str, optional, default None
574
+ Name of the artifact in which to store the caught exception.
575
+ If not specified, the exception is not stored.
576
+ print_exception : bool, default True
577
+ Determines whether or not the exception is printed to
578
+ stdout when caught.
695
579
  """
696
580
  ...
697
581
 
698
582
  @typing.overload
699
- 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]]]:
583
+ 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]]]:
700
584
  """
701
- Specifies environment variables to be set prior to the execution of a step.
585
+ Specifies the number of times the task corresponding
586
+ to a step needs to be retried.
587
+
588
+ This decorator is useful for handling transient errors, such as networking issues.
589
+ If your task contains operations that can't be retried safely, e.g. database updates,
590
+ it is advisable to annotate it with `@retry(times=0)`.
591
+
592
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
593
+ decorator will execute a no-op task after all retries have been exhausted,
594
+ ensuring that the flow execution can continue.
702
595
 
703
596
  Parameters
704
597
  ----------
705
- vars : Dict[str, str], default {}
706
- Dictionary of environment variables to set.
598
+ times : int, default 3
599
+ Number of times to retry this task.
600
+ minutes_between_retries : int, default 2
601
+ Number of minutes between retries.
707
602
  """
708
603
  ...
709
604
 
710
605
  @typing.overload
711
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
606
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
712
607
  ...
713
608
 
714
609
  @typing.overload
715
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
610
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
716
611
  ...
717
612
 
718
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
613
+ 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):
719
614
  """
720
- Specifies environment variables to be set prior to the execution of a step.
615
+ Specifies the number of times the task corresponding
616
+ to a step needs to be retried.
617
+
618
+ This decorator is useful for handling transient errors, such as networking issues.
619
+ If your task contains operations that can't be retried safely, e.g. database updates,
620
+ it is advisable to annotate it with `@retry(times=0)`.
621
+
622
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
623
+ decorator will execute a no-op task after all retries have been exhausted,
624
+ ensuring that the flow execution can continue.
721
625
 
722
626
  Parameters
723
627
  ----------
724
- vars : Dict[str, str], default {}
725
- Dictionary of environment variables to set.
628
+ times : int, default 3
629
+ Number of times to retry this task.
630
+ minutes_between_retries : int, default 2
631
+ Number of minutes between retries.
726
632
  """
727
633
  ...
728
634
 
729
635
  @typing.overload
730
- 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]]]:
636
+ 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]]]:
731
637
  """
732
- Specifies a timeout for your step.
733
-
734
- This decorator is useful if this step may hang indefinitely.
735
-
736
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
737
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
738
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
638
+ Specifies the PyPI packages for the step.
739
639
 
740
- Note that all the values specified in parameters are added together so if you specify
741
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
640
+ Information in this decorator will augment any
641
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
642
+ you can use `@pypi_base` to set packages required by all
643
+ steps and use `@pypi` to specify step-specific overrides.
742
644
 
743
645
  Parameters
744
646
  ----------
745
- seconds : int, default 0
746
- Number of seconds to wait prior to timing out.
747
- minutes : int, default 0
748
- Number of minutes to wait prior to timing out.
749
- hours : int, default 0
750
- Number of hours to wait prior to timing out.
647
+ packages : Dict[str, str], default: {}
648
+ Packages to use for this step. The key is the name of the package
649
+ and the value is the version to use.
650
+ python : str, optional, default: None
651
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
652
+ that the version used will correspond to the version of the Python interpreter used to start the run.
751
653
  """
752
654
  ...
753
655
 
754
656
  @typing.overload
755
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
657
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
756
658
  ...
757
659
 
758
660
  @typing.overload
759
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
760
- ...
761
-
762
- 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):
763
- """
764
- Specifies a timeout for your step.
765
-
766
- This decorator is useful if this step may hang indefinitely.
767
-
768
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
769
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
770
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
771
-
772
- Note that all the values specified in parameters are added together so if you specify
773
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
774
-
775
- Parameters
776
- ----------
777
- seconds : int, default 0
778
- Number of seconds to wait prior to timing out.
779
- minutes : int, default 0
780
- Number of minutes to wait prior to timing out.
781
- hours : int, default 0
782
- Number of hours to wait prior to timing out.
783
- """
784
- ...
785
-
786
- @typing.overload
787
- 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]]]:
788
- """
789
- Specifies the Conda environment for the step.
790
-
791
- Information in this decorator will augment any
792
- attributes set in the `@conda_base` flow-level decorator. Hence,
793
- you can use `@conda_base` to set packages required by all
794
- steps and use `@conda` to specify step-specific overrides.
795
-
796
- Parameters
797
- ----------
798
- packages : Dict[str, str], default {}
799
- Packages to use for this step. The key is the name of the package
800
- and the value is the version to use.
801
- libraries : Dict[str, str], default {}
802
- Supported for backward compatibility. When used with packages, packages will take precedence.
803
- python : str, optional, default None
804
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
805
- that the version used will correspond to the version of the Python interpreter used to start the run.
806
- disabled : bool, default False
807
- If set to True, disables @conda.
808
- """
809
- ...
810
-
811
- @typing.overload
812
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
813
- ...
814
-
815
- @typing.overload
816
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
661
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
817
662
  ...
818
663
 
819
- 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):
664
+ 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):
820
665
  """
821
- Specifies the Conda environment for the step.
666
+ Specifies the PyPI packages for the step.
822
667
 
823
668
  Information in this decorator will augment any
824
- attributes set in the `@conda_base` flow-level decorator. Hence,
825
- you can use `@conda_base` to set packages required by all
826
- steps and use `@conda` to specify step-specific overrides.
669
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
670
+ you can use `@pypi_base` to set packages required by all
671
+ steps and use `@pypi` to specify step-specific overrides.
827
672
 
828
673
  Parameters
829
674
  ----------
830
- packages : Dict[str, str], default {}
675
+ packages : Dict[str, str], default: {}
831
676
  Packages to use for this step. The key is the name of the package
832
677
  and the value is the version to use.
833
- libraries : Dict[str, str], default {}
834
- Supported for backward compatibility. When used with packages, packages will take precedence.
835
- python : str, optional, default None
678
+ python : str, optional, default: None
836
679
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
837
680
  that the version used will correspond to the version of the Python interpreter used to start the run.
838
- disabled : bool, default False
839
- If set to True, disables @conda.
840
681
  """
841
682
  ...
842
683
 
@@ -907,51 +748,59 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
907
748
  ...
908
749
 
909
750
  @typing.overload
910
- 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]]]:
751
+ 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]]]:
911
752
  """
912
- Specifies the PyPI packages for the step.
753
+ Specifies a timeout for your step.
913
754
 
914
- Information in this decorator will augment any
915
- attributes set in the `@pyi_base` flow-level decorator. Hence,
916
- you can use `@pypi_base` to set packages required by all
917
- steps and use `@pypi` to specify step-specific overrides.
755
+ This decorator is useful if this step may hang indefinitely.
756
+
757
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
758
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
759
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
760
+
761
+ Note that all the values specified in parameters are added together so if you specify
762
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
918
763
 
919
764
  Parameters
920
765
  ----------
921
- packages : Dict[str, str], default: {}
922
- Packages to use for this step. The key is the name of the package
923
- and the value is the version to use.
924
- python : str, optional, default: None
925
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
926
- that the version used will correspond to the version of the Python interpreter used to start the run.
766
+ seconds : int, default 0
767
+ Number of seconds to wait prior to timing out.
768
+ minutes : int, default 0
769
+ Number of minutes to wait prior to timing out.
770
+ hours : int, default 0
771
+ Number of hours to wait prior to timing out.
927
772
  """
928
773
  ...
929
774
 
930
775
  @typing.overload
931
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
776
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
932
777
  ...
933
778
 
934
779
  @typing.overload
935
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
780
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
936
781
  ...
937
782
 
938
- 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):
783
+ 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):
939
784
  """
940
- Specifies the PyPI packages for the step.
785
+ Specifies a timeout for your step.
941
786
 
942
- Information in this decorator will augment any
943
- attributes set in the `@pyi_base` flow-level decorator. Hence,
944
- you can use `@pypi_base` to set packages required by all
945
- steps and use `@pypi` to specify step-specific overrides.
787
+ This decorator is useful if this step may hang indefinitely.
788
+
789
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
790
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
791
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
792
+
793
+ Note that all the values specified in parameters are added together so if you specify
794
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
946
795
 
947
796
  Parameters
948
797
  ----------
949
- packages : Dict[str, str], default: {}
950
- Packages to use for this step. The key is the name of the package
951
- and the value is the version to use.
952
- python : str, optional, default: None
953
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
954
- that the version used will correspond to the version of the Python interpreter used to start the run.
798
+ seconds : int, default 0
799
+ Number of seconds to wait prior to timing out.
800
+ minutes : int, default 0
801
+ Number of minutes to wait prior to timing out.
802
+ hours : int, default 0
803
+ Number of hours to wait prior to timing out.
955
804
  """
956
805
  ...
957
806
 
@@ -973,84 +822,123 @@ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepF
973
822
  ...
974
823
 
975
824
  @typing.overload
976
- 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]]]:
825
+ 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]]]:
977
826
  """
978
- Specifies that the step will success under all circumstances.
979
-
980
- The decorator will create an optional artifact, specified by `var`, which
981
- contains the exception raised. You can use it to detect the presence
982
- of errors, indicating that all happy-path artifacts produced by the step
983
- are missing.
827
+ Specifies secrets to be retrieved and injected as environment variables prior to
828
+ the execution of a step.
984
829
 
985
830
  Parameters
986
831
  ----------
987
- var : str, optional, default None
988
- Name of the artifact in which to store the caught exception.
989
- If not specified, the exception is not stored.
990
- print_exception : bool, default True
991
- Determines whether or not the exception is printed to
992
- stdout when caught.
832
+ sources : List[Union[str, Dict[str, Any]]], default: []
833
+ List of secret specs, defining how the secrets are to be retrieved
993
834
  """
994
835
  ...
995
836
 
996
837
  @typing.overload
997
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
838
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
998
839
  ...
999
840
 
1000
841
  @typing.overload
1001
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
842
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1002
843
  ...
1003
844
 
1004
- def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
845
+ 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]]] = []):
1005
846
  """
1006
- Specifies that the step will success under all circumstances.
847
+ Specifies secrets to be retrieved and injected as environment variables prior to
848
+ the execution of a step.
1007
849
 
1008
- The decorator will create an optional artifact, specified by `var`, which
1009
- contains the exception raised. You can use it to detect the presence
1010
- of errors, indicating that all happy-path artifacts produced by the step
1011
- are missing.
850
+ Parameters
851
+ ----------
852
+ sources : List[Union[str, Dict[str, Any]]], default: []
853
+ List of secret specs, defining how the secrets are to be retrieved
854
+ """
855
+ ...
856
+
857
+ @typing.overload
858
+ 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]]]:
859
+ """
860
+ Specifies environment variables to be set prior to the execution of a step.
1012
861
 
1013
862
  Parameters
1014
863
  ----------
1015
- var : str, optional, default None
1016
- Name of the artifact in which to store the caught exception.
1017
- If not specified, the exception is not stored.
1018
- print_exception : bool, default True
1019
- Determines whether or not the exception is printed to
1020
- stdout when caught.
864
+ vars : Dict[str, str], default {}
865
+ Dictionary of environment variables to set.
1021
866
  """
1022
867
  ...
1023
868
 
1024
869
  @typing.overload
1025
- 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]]]:
870
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
871
+ ...
872
+
873
+ @typing.overload
874
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
875
+ ...
876
+
877
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1026
878
  """
1027
- Specifies secrets to be retrieved and injected as environment variables prior to
1028
- the execution of a step.
879
+ Specifies environment variables to be set prior to the execution of a step.
1029
880
 
1030
881
  Parameters
1031
882
  ----------
1032
- sources : List[Union[str, Dict[str, Any]]], default: []
1033
- List of secret specs, defining how the secrets are to be retrieved
883
+ vars : Dict[str, str], default {}
884
+ Dictionary of environment variables to set.
1034
885
  """
1035
886
  ...
1036
887
 
1037
888
  @typing.overload
1038
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
889
+ 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]]]:
890
+ """
891
+ Specifies the Conda environment for the step.
892
+
893
+ Information in this decorator will augment any
894
+ attributes set in the `@conda_base` flow-level decorator. Hence,
895
+ you can use `@conda_base` to set packages required by all
896
+ steps and use `@conda` to specify step-specific overrides.
897
+
898
+ Parameters
899
+ ----------
900
+ packages : Dict[str, str], default {}
901
+ Packages to use for this step. The key is the name of the package
902
+ and the value is the version to use.
903
+ libraries : Dict[str, str], default {}
904
+ Supported for backward compatibility. When used with packages, packages will take precedence.
905
+ python : str, optional, default None
906
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
907
+ that the version used will correspond to the version of the Python interpreter used to start the run.
908
+ disabled : bool, default False
909
+ If set to True, disables @conda.
910
+ """
1039
911
  ...
1040
912
 
1041
913
  @typing.overload
1042
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
914
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1043
915
  ...
1044
916
 
1045
- 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]]] = []):
917
+ @typing.overload
918
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
919
+ ...
920
+
921
+ 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):
1046
922
  """
1047
- Specifies secrets to be retrieved and injected as environment variables prior to
1048
- the execution of a step.
923
+ Specifies the Conda environment for the step.
924
+
925
+ Information in this decorator will augment any
926
+ attributes set in the `@conda_base` flow-level decorator. Hence,
927
+ you can use `@conda_base` to set packages required by all
928
+ steps and use `@conda` to specify step-specific overrides.
1049
929
 
1050
930
  Parameters
1051
931
  ----------
1052
- sources : List[Union[str, Dict[str, Any]]], default: []
1053
- List of secret specs, defining how the secrets are to be retrieved
932
+ packages : Dict[str, str], default {}
933
+ Packages to use for this step. The key is the name of the package
934
+ and the value is the version to use.
935
+ libraries : Dict[str, str], default {}
936
+ Supported for backward compatibility. When used with packages, packages will take precedence.
937
+ python : str, optional, default None
938
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
939
+ that the version used will correspond to the version of the Python interpreter used to start the run.
940
+ disabled : bool, default False
941
+ If set to True, disables @conda.
1054
942
  """
1055
943
  ...
1056
944
 
@@ -1115,8 +1003,138 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
1115
1003
  """
1116
1004
  ...
1117
1005
 
1118
- 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]]:
1119
- """
1006
+ @typing.overload
1007
+ 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]]]:
1008
+ """
1009
+ Enables loading / saving of models within a step.
1010
+
1011
+
1012
+ Parameters
1013
+ ----------
1014
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
1015
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
1016
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
1017
+ - `current.checkpoint`
1018
+ - `current.model`
1019
+ - `current.huggingface_hub`
1020
+
1021
+ 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
1022
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
1023
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
1024
+
1025
+ temp_dir_root : str, default: None
1026
+ The root directory under which `current.model.loaded` will store loaded models
1027
+
1028
+
1029
+
1030
+ """
1031
+ ...
1032
+
1033
+ @typing.overload
1034
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1035
+ ...
1036
+
1037
+ @typing.overload
1038
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1039
+ ...
1040
+
1041
+ 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):
1042
+ """
1043
+ Enables loading / saving of models within a step.
1044
+
1045
+
1046
+ Parameters
1047
+ ----------
1048
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
1049
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
1050
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
1051
+ - `current.checkpoint`
1052
+ - `current.model`
1053
+ - `current.huggingface_hub`
1054
+
1055
+ 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
1056
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
1057
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
1058
+
1059
+ temp_dir_root : str, default: None
1060
+ The root directory under which `current.model.loaded` will store loaded models
1061
+
1062
+
1063
+
1064
+ """
1065
+ ...
1066
+
1067
+ @typing.overload
1068
+ 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]]]:
1069
+ """
1070
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1071
+
1072
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1073
+
1074
+ Parameters
1075
+ ----------
1076
+ type : str, default 'default'
1077
+ Card type.
1078
+ id : str, optional, default None
1079
+ If multiple cards are present, use this id to identify this card.
1080
+ options : Dict[str, Any], default {}
1081
+ Options passed to the card. The contents depend on the card type.
1082
+ timeout : int, default 45
1083
+ Interrupt reporting if it takes more than this many seconds.
1084
+
1085
+
1086
+ """
1087
+ ...
1088
+
1089
+ @typing.overload
1090
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1091
+ ...
1092
+
1093
+ @typing.overload
1094
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1095
+ ...
1096
+
1097
+ 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):
1098
+ """
1099
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1100
+
1101
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1102
+
1103
+ Parameters
1104
+ ----------
1105
+ type : str, default 'default'
1106
+ Card type.
1107
+ id : str, optional, default None
1108
+ If multiple cards are present, use this id to identify this card.
1109
+ options : Dict[str, Any], default {}
1110
+ Options passed to the card. The contents depend on the card type.
1111
+ timeout : int, default 45
1112
+ Interrupt reporting if it takes more than this many seconds.
1113
+
1114
+
1115
+ """
1116
+ ...
1117
+
1118
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1119
+ """
1120
+ Specifies what flows belong to the same project.
1121
+
1122
+ A project-specific namespace is created for all flows that
1123
+ use the same `@project(name)`.
1124
+
1125
+ Parameters
1126
+ ----------
1127
+ name : str
1128
+ Project name. Make sure that the name is unique amongst all
1129
+ projects that use the same production scheduler. The name may
1130
+ contain only lowercase alphanumeric characters and underscores.
1131
+
1132
+
1133
+ """
1134
+ ...
1135
+
1136
+ 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]]:
1137
+ """
1120
1138
  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)
1121
1139
  before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1122
1140
  and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
@@ -1157,149 +1175,104 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1157
1175
  """
1158
1176
  ...
1159
1177
 
1160
- 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]]:
1161
- """
1162
- 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.
1163
- 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.
1164
-
1165
- Parameters
1166
- ----------
1167
- timeout : int
1168
- Time, in seconds before the task times out and fails. (Default: 3600)
1169
- poke_interval : int
1170
- Time in seconds that the job should wait in between each try. (Default: 60)
1171
- mode : str
1172
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1173
- exponential_backoff : bool
1174
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1175
- pool : str
1176
- the slot pool this task should run in,
1177
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1178
- soft_fail : bool
1179
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1180
- name : str
1181
- Name of the sensor on Airflow
1182
- description : str
1183
- Description of sensor in the Airflow UI
1184
- external_dag_id : str
1185
- The dag_id that contains the task you want to wait for.
1186
- external_task_ids : List[str]
1187
- The list of task_ids that you want to wait for.
1188
- If None (default value) the sensor waits for the DAG. (Default: None)
1189
- allowed_states : List[str]
1190
- Iterable of allowed states, (Default: ['success'])
1191
- failed_states : List[str]
1192
- Iterable of failed or dis-allowed states. (Default: None)
1193
- execution_delta : datetime.timedelta
1194
- time difference with the previous execution to look at,
1195
- the default is the same logical date as the current task or DAG. (Default: None)
1196
- check_existence: bool
1197
- Set to True to check if the external task exists or check if
1198
- the DAG to wait for exists. (Default: True)
1199
- """
1200
- ...
1201
-
1202
1178
  @typing.overload
1203
- 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]]:
1179
+ 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]]:
1204
1180
  """
1205
- Specifies the Conda environment for all steps of the flow.
1181
+ Specifies the flow(s) that this flow depends on.
1206
1182
 
1207
- Use `@conda_base` to set common libraries required by all
1208
- steps and use `@conda` to specify step-specific additions.
1183
+ ```
1184
+ @trigger_on_finish(flow='FooFlow')
1185
+ ```
1186
+ or
1187
+ ```
1188
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1189
+ ```
1190
+ This decorator respects the @project decorator and triggers the flow
1191
+ when upstream runs within the same namespace complete successfully
1209
1192
 
1210
- Parameters
1211
- ----------
1212
- packages : Dict[str, str], default {}
1213
- Packages to use for this flow. The key is the name of the package
1214
- and the value is the version to use.
1215
- libraries : Dict[str, str], default {}
1216
- Supported for backward compatibility. When used with packages, packages will take precedence.
1217
- python : str, optional, default None
1218
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1219
- that the version used will correspond to the version of the Python interpreter used to start the run.
1220
- disabled : bool, default False
1221
- If set to True, disables Conda.
1222
- """
1223
- ...
1224
-
1225
- @typing.overload
1226
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1227
- ...
1228
-
1229
- 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):
1230
- """
1231
- Specifies the Conda environment for all steps of the flow.
1193
+ Additionally, you can specify project aware upstream flow dependencies
1194
+ by specifying the fully qualified project_flow_name.
1195
+ ```
1196
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1197
+ ```
1198
+ or
1199
+ ```
1200
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1201
+ ```
1232
1202
 
1233
- Use `@conda_base` to set common libraries required by all
1234
- steps and use `@conda` to specify step-specific additions.
1203
+ You can also specify just the project or project branch (other values will be
1204
+ inferred from the current project or project branch):
1205
+ ```
1206
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1207
+ ```
1235
1208
 
1236
- Parameters
1237
- ----------
1238
- packages : Dict[str, str], default {}
1239
- Packages to use for this flow. The key is the name of the package
1240
- and the value is the version to use.
1241
- libraries : Dict[str, str], default {}
1242
- Supported for backward compatibility. When used with packages, packages will take precedence.
1243
- python : str, optional, default None
1244
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1245
- that the version used will correspond to the version of the Python interpreter used to start the run.
1246
- disabled : bool, default False
1247
- If set to True, disables Conda.
1248
- """
1249
- ...
1250
-
1251
- @typing.overload
1252
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1253
- """
1254
- Specifies the PyPI packages for all steps of the flow.
1209
+ Note that `branch` is typically one of:
1210
+ - `prod`
1211
+ - `user.bob`
1212
+ - `test.my_experiment`
1213
+ - `prod.staging`
1255
1214
 
1256
- Use `@pypi_base` to set common packages required by all
1257
- steps and use `@pypi` to specify step-specific overrides.
1258
1215
  Parameters
1259
1216
  ----------
1260
- packages : Dict[str, str], default: {}
1261
- Packages to use for this flow. The key is the name of the package
1262
- and the value is the version to use.
1263
- python : str, optional, default: None
1264
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1265
- that the version used will correspond to the version of the Python interpreter used to start the run.
1217
+ flow : Union[str, Dict[str, str]], optional, default None
1218
+ Upstream flow dependency for this flow.
1219
+ flows : List[Union[str, Dict[str, str]]], default []
1220
+ Upstream flow dependencies for this flow.
1221
+ options : Dict[str, Any], default {}
1222
+ Backend-specific configuration for tuning eventing behavior.
1223
+
1224
+
1266
1225
  """
1267
1226
  ...
1268
1227
 
1269
1228
  @typing.overload
1270
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1229
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1271
1230
  ...
1272
1231
 
1273
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1232
+ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, 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] = {}):
1274
1233
  """
1275
- Specifies the PyPI packages for all steps of the flow.
1234
+ Specifies the flow(s) that this flow depends on.
1276
1235
 
1277
- Use `@pypi_base` to set common packages required by all
1278
- steps and use `@pypi` to specify step-specific overrides.
1279
- Parameters
1280
- ----------
1281
- packages : Dict[str, str], default: {}
1282
- Packages to use for this flow. The key is the name of the package
1283
- and the value is the version to use.
1284
- python : str, optional, default: None
1285
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1286
- that the version used will correspond to the version of the Python interpreter used to start the run.
1287
- """
1288
- ...
1289
-
1290
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1291
- """
1292
- Specifies what flows belong to the same project.
1236
+ ```
1237
+ @trigger_on_finish(flow='FooFlow')
1238
+ ```
1239
+ or
1240
+ ```
1241
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1242
+ ```
1243
+ This decorator respects the @project decorator and triggers the flow
1244
+ when upstream runs within the same namespace complete successfully
1293
1245
 
1294
- A project-specific namespace is created for all flows that
1295
- use the same `@project(name)`.
1246
+ Additionally, you can specify project aware upstream flow dependencies
1247
+ by specifying the fully qualified project_flow_name.
1248
+ ```
1249
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1250
+ ```
1251
+ or
1252
+ ```
1253
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1254
+ ```
1255
+
1256
+ You can also specify just the project or project branch (other values will be
1257
+ inferred from the current project or project branch):
1258
+ ```
1259
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1260
+ ```
1261
+
1262
+ Note that `branch` is typically one of:
1263
+ - `prod`
1264
+ - `user.bob`
1265
+ - `test.my_experiment`
1266
+ - `prod.staging`
1296
1267
 
1297
1268
  Parameters
1298
1269
  ----------
1299
- name : str
1300
- Project name. Make sure that the name is unique amongst all
1301
- projects that use the same production scheduler. The name may
1302
- contain only lowercase alphanumeric characters and underscores.
1270
+ flow : Union[str, Dict[str, str]], optional, default None
1271
+ Upstream flow dependency for this flow.
1272
+ flows : List[Union[str, Dict[str, str]]], default []
1273
+ Upstream flow dependencies for this flow.
1274
+ options : Dict[str, Any], default {}
1275
+ Backend-specific configuration for tuning eventing behavior.
1303
1276
 
1304
1277
 
1305
1278
  """
@@ -1354,37 +1327,6 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1354
1327
  """
1355
1328
  ...
1356
1329
 
1357
- def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1358
- """
1359
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1360
-
1361
- User code call
1362
- -----------
1363
- @nim(
1364
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1365
- backend='managed'
1366
- )
1367
-
1368
- Valid backend options
1369
- ---------------------
1370
- - 'managed': Outerbounds selects a compute provider based on the model.
1371
- - 🚧 'dataplane': Run in your account.
1372
-
1373
- Valid model options
1374
- ----------------
1375
- - 'meta/llama3-8b-instruct': 8B parameter model
1376
- - 'meta/llama3-70b-instruct': 70B parameter model
1377
- - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1378
-
1379
- Parameters
1380
- ----------
1381
- models: list[NIM]
1382
- List of NIM containers running models in sidecars.
1383
- backend: str
1384
- Compute provider to run the NIM container.
1385
- """
1386
- ...
1387
-
1388
1330
  @typing.overload
1389
1331
  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]]:
1390
1332
  """
@@ -1481,105 +1423,163 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1481
1423
  ...
1482
1424
 
1483
1425
  @typing.overload
1484
- 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]]:
1426
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1485
1427
  """
1486
- Specifies the flow(s) that this flow depends on.
1428
+ Specifies the PyPI packages for all steps of the flow.
1487
1429
 
1488
- ```
1489
- @trigger_on_finish(flow='FooFlow')
1490
- ```
1491
- or
1492
- ```
1493
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1494
- ```
1495
- This decorator respects the @project decorator and triggers the flow
1496
- when upstream runs within the same namespace complete successfully
1430
+ Use `@pypi_base` to set common packages required by all
1431
+ steps and use `@pypi` to specify step-specific overrides.
1432
+ Parameters
1433
+ ----------
1434
+ packages : Dict[str, str], default: {}
1435
+ Packages to use for this flow. The key is the name of the package
1436
+ and the value is the version to use.
1437
+ python : str, optional, default: None
1438
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1439
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1440
+ """
1441
+ ...
1442
+
1443
+ @typing.overload
1444
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1445
+ ...
1446
+
1447
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1448
+ """
1449
+ Specifies the PyPI packages for all steps of the flow.
1497
1450
 
1498
- Additionally, you can specify project aware upstream flow dependencies
1499
- by specifying the fully qualified project_flow_name.
1500
- ```
1501
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1502
- ```
1503
- or
1504
- ```
1505
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1506
- ```
1451
+ Use `@pypi_base` to set common packages required by all
1452
+ steps and use `@pypi` to specify step-specific overrides.
1453
+ Parameters
1454
+ ----------
1455
+ packages : Dict[str, str], default: {}
1456
+ Packages to use for this flow. The key is the name of the package
1457
+ and the value is the version to use.
1458
+ python : str, optional, default: None
1459
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1460
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1461
+ """
1462
+ ...
1463
+
1464
+ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1465
+ """
1466
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1507
1467
 
1508
- You can also specify just the project or project branch (other values will be
1509
- inferred from the current project or project branch):
1510
- ```
1511
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1512
- ```
1468
+ User code call
1469
+ -----------
1470
+ @nim(
1471
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1472
+ backend='managed'
1473
+ )
1513
1474
 
1514
- Note that `branch` is typically one of:
1515
- - `prod`
1516
- - `user.bob`
1517
- - `test.my_experiment`
1518
- - `prod.staging`
1475
+ Valid backend options
1476
+ ---------------------
1477
+ - 'managed': Outerbounds selects a compute provider based on the model.
1478
+ - 🚧 'dataplane': Run in your account.
1479
+
1480
+ Valid model options
1481
+ ----------------
1482
+ - 'meta/llama3-8b-instruct': 8B parameter model
1483
+ - 'meta/llama3-70b-instruct': 70B parameter model
1484
+ - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1519
1485
 
1520
1486
  Parameters
1521
1487
  ----------
1522
- flow : Union[str, Dict[str, str]], optional, default None
1523
- Upstream flow dependency for this flow.
1524
- flows : List[Union[str, Dict[str, str]]], default []
1525
- Upstream flow dependencies for this flow.
1526
- options : Dict[str, Any], default {}
1527
- Backend-specific configuration for tuning eventing behavior.
1488
+ models: list[NIM]
1489
+ List of NIM containers running models in sidecars.
1490
+ backend: str
1491
+ Compute provider to run the NIM container.
1492
+ """
1493
+ ...
1494
+
1495
+ 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]]:
1496
+ """
1497
+ 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.
1498
+ 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.
1499
+
1500
+ Parameters
1501
+ ----------
1502
+ timeout : int
1503
+ Time, in seconds before the task times out and fails. (Default: 3600)
1504
+ poke_interval : int
1505
+ Time in seconds that the job should wait in between each try. (Default: 60)
1506
+ mode : str
1507
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1508
+ exponential_backoff : bool
1509
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1510
+ pool : str
1511
+ the slot pool this task should run in,
1512
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1513
+ soft_fail : bool
1514
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1515
+ name : str
1516
+ Name of the sensor on Airflow
1517
+ description : str
1518
+ Description of sensor in the Airflow UI
1519
+ external_dag_id : str
1520
+ The dag_id that contains the task you want to wait for.
1521
+ external_task_ids : List[str]
1522
+ The list of task_ids that you want to wait for.
1523
+ If None (default value) the sensor waits for the DAG. (Default: None)
1524
+ allowed_states : List[str]
1525
+ Iterable of allowed states, (Default: ['success'])
1526
+ failed_states : List[str]
1527
+ Iterable of failed or dis-allowed states. (Default: None)
1528
+ execution_delta : datetime.timedelta
1529
+ time difference with the previous execution to look at,
1530
+ the default is the same logical date as the current task or DAG. (Default: None)
1531
+ check_existence: bool
1532
+ Set to True to check if the external task exists or check if
1533
+ the DAG to wait for exists. (Default: True)
1534
+ """
1535
+ ...
1536
+
1537
+ @typing.overload
1538
+ 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]]:
1539
+ """
1540
+ Specifies the Conda environment for all steps of the flow.
1528
1541
 
1542
+ Use `@conda_base` to set common libraries required by all
1543
+ steps and use `@conda` to specify step-specific additions.
1529
1544
 
1545
+ Parameters
1546
+ ----------
1547
+ packages : Dict[str, str], default {}
1548
+ Packages to use for this flow. The key is the name of the package
1549
+ and the value is the version to use.
1550
+ libraries : Dict[str, str], default {}
1551
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1552
+ python : str, optional, default None
1553
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1554
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1555
+ disabled : bool, default False
1556
+ If set to True, disables Conda.
1530
1557
  """
1531
1558
  ...
1532
1559
 
1533
1560
  @typing.overload
1534
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1561
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1535
1562
  ...
1536
1563
 
1537
- def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, 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] = {}):
1564
+ 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):
1538
1565
  """
1539
- Specifies the flow(s) that this flow depends on.
1540
-
1541
- ```
1542
- @trigger_on_finish(flow='FooFlow')
1543
- ```
1544
- or
1545
- ```
1546
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1547
- ```
1548
- This decorator respects the @project decorator and triggers the flow
1549
- when upstream runs within the same namespace complete successfully
1550
-
1551
- Additionally, you can specify project aware upstream flow dependencies
1552
- by specifying the fully qualified project_flow_name.
1553
- ```
1554
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1555
- ```
1556
- or
1557
- ```
1558
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1559
- ```
1560
-
1561
- You can also specify just the project or project branch (other values will be
1562
- inferred from the current project or project branch):
1563
- ```
1564
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1565
- ```
1566
+ Specifies the Conda environment for all steps of the flow.
1566
1567
 
1567
- Note that `branch` is typically one of:
1568
- - `prod`
1569
- - `user.bob`
1570
- - `test.my_experiment`
1571
- - `prod.staging`
1568
+ Use `@conda_base` to set common libraries required by all
1569
+ steps and use `@conda` to specify step-specific additions.
1572
1570
 
1573
1571
  Parameters
1574
1572
  ----------
1575
- flow : Union[str, Dict[str, str]], optional, default None
1576
- Upstream flow dependency for this flow.
1577
- flows : List[Union[str, Dict[str, str]]], default []
1578
- Upstream flow dependencies for this flow.
1579
- options : Dict[str, Any], default {}
1580
- Backend-specific configuration for tuning eventing behavior.
1581
-
1582
-
1573
+ packages : Dict[str, str], default {}
1574
+ Packages to use for this flow. The key is the name of the package
1575
+ and the value is the version to use.
1576
+ libraries : Dict[str, str], default {}
1577
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1578
+ python : str, optional, default None
1579
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1580
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1581
+ disabled : bool, default False
1582
+ If set to True, disables Conda.
1583
1583
  """
1584
1584
  ...
1585
1585