ob-metaflow-stubs 6.0.3.110__py2.py3-none-any.whl → 6.0.3.112__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. metaflow-stubs/__init__.pyi +551 -551
  2. metaflow-stubs/cards.pyi +5 -5
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/client/__init__.pyi +2 -2
  5. metaflow-stubs/client/core.pyi +6 -6
  6. metaflow-stubs/client/filecache.pyi +2 -2
  7. metaflow-stubs/clone_util.pyi +1 -1
  8. metaflow-stubs/events.pyi +1 -1
  9. metaflow-stubs/exception.pyi +1 -1
  10. metaflow-stubs/flowspec.pyi +5 -5
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +3 -3
  13. metaflow-stubs/info_file.pyi +1 -1
  14. metaflow-stubs/metadata/metadata.pyi +1 -1
  15. metaflow-stubs/metadata/util.pyi +1 -1
  16. metaflow-stubs/metaflow_config.pyi +1 -1
  17. metaflow-stubs/metaflow_current.pyi +90 -90
  18. metaflow-stubs/mflog/mflog.pyi +1 -1
  19. metaflow-stubs/multicore_utils.pyi +1 -1
  20. metaflow-stubs/parameters.pyi +3 -3
  21. metaflow-stubs/plugins/__init__.pyi +2 -2
  22. metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
  23. metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
  24. metaflow-stubs/plugins/airflow/exception.pyi +1 -1
  25. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
  26. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
  27. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  29. metaflow-stubs/plugins/argo/__init__.pyi +1 -1
  30. metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
  31. metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
  32. metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +6 -6
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +5 -5
  35. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +1 -1
  36. metaflow-stubs/plugins/aws/__init__.pyi +1 -1
  37. metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
  38. metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
  39. metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
  40. metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
  41. metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
  42. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  43. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
  44. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
  45. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
  46. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
  47. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +1 -1
  48. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
  49. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
  50. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
  51. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +1 -1
  52. metaflow-stubs/plugins/azure/__init__.pyi +1 -1
  53. metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
  54. metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
  55. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
  56. metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
  57. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
  58. metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
  59. metaflow-stubs/plugins/cards/__init__.pyi +1 -1
  60. metaflow-stubs/plugins/cards/card_cli.pyi +3 -3
  61. metaflow-stubs/plugins/cards/card_client.pyi +1 -1
  62. metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
  63. metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
  64. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  65. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
  66. metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
  67. metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
  68. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  69. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
  70. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
  71. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
  72. metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
  73. metaflow-stubs/plugins/cards/component_serializer.pyi +3 -3
  74. metaflow-stubs/plugins/cards/exception.pyi +1 -1
  75. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  76. metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
  77. metaflow-stubs/plugins/datatools/local.pyi +1 -1
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  79. metaflow-stubs/plugins/datatools/s3/s3.pyi +5 -5
  80. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
  81. metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
  82. metaflow-stubs/plugins/debug_logger.pyi +1 -1
  83. metaflow-stubs/plugins/debug_monitor.pyi +1 -1
  84. metaflow-stubs/plugins/environment_decorator.pyi +1 -1
  85. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  86. metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
  87. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  88. metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
  89. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
  90. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
  91. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
  92. metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
  93. metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
  94. metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
  95. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
  96. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  97. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +2 -2
  98. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
  99. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  100. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
  101. metaflow-stubs/plugins/logs_cli.pyi +2 -2
  102. metaflow-stubs/plugins/package_cli.pyi +1 -1
  103. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  104. metaflow-stubs/plugins/perimeters.pyi +1 -1
  105. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  106. metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
  107. metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
  108. metaflow-stubs/plugins/pypi/conda_environment.pyi +2 -2
  109. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
  110. metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
  111. metaflow-stubs/plugins/pypi/utils.pyi +1 -1
  112. metaflow-stubs/plugins/resources_decorator.pyi +1 -1
  113. metaflow-stubs/plugins/retry_decorator.pyi +1 -1
  114. metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
  115. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +1 -1
  116. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
  117. metaflow-stubs/plugins/storage_executor.pyi +1 -1
  118. metaflow-stubs/plugins/tag_cli.pyi +4 -4
  119. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
  120. metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
  121. metaflow-stubs/procpoll.pyi +1 -1
  122. metaflow-stubs/profilers/__init__.pyi +1 -1
  123. metaflow-stubs/pylint_wrapper.pyi +1 -1
  124. metaflow-stubs/runner/__init__.pyi +1 -1
  125. metaflow-stubs/runner/deployer.pyi +1 -1
  126. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  127. metaflow-stubs/runner/nbdeploy.pyi +1 -1
  128. metaflow-stubs/runner/nbrun.pyi +1 -1
  129. metaflow-stubs/runner/subprocess_manager.pyi +1 -1
  130. metaflow-stubs/runner/utils.pyi +1 -1
  131. metaflow-stubs/system/__init__.pyi +2 -2
  132. metaflow-stubs/system/system_logger.pyi +1 -1
  133. metaflow-stubs/system/system_monitor.pyi +2 -2
  134. metaflow-stubs/tagging_util.pyi +1 -1
  135. metaflow-stubs/tuple_util.pyi +1 -1
  136. {ob_metaflow_stubs-6.0.3.110.dist-info → ob_metaflow_stubs-6.0.3.112.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.112.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.110.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.110.dist-info → ob_metaflow_stubs-6.0.3.112.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.110.dist-info → ob_metaflow_stubs-6.0.3.112.dist-info}/top_level.txt +0 -0
@@ -1,24 +1,24 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
3
  # MF version: 2.12.25.2+obcheckpoint(0.1.0);ob(v1) #
4
- # Generated on 2024-10-16T01:27:45.836502 #
4
+ # Generated on 2024-10-21T21:22:37.544481 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import metaflow.datastore.inputs
12
- import metaflow.runner.metaflow_runner
11
+ import typing
13
12
  import metaflow.flowspec
14
- import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
15
- import metaflow.parameters
16
- import datetime
17
- import metaflow.metaflow_current
18
13
  import metaflow.client.core
19
- import typing
20
14
  import metaflow.events
15
+ import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
16
+ import metaflow.metaflow_current
17
+ import metaflow.runner.metaflow_runner
18
+ import metaflow.datastore.inputs
21
19
  import metaflow._vendor.click.types
20
+ import metaflow.parameters
21
+ import datetime
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -512,19 +512,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
512
512
  """
513
513
  ...
514
514
 
515
- def huggingface_hub(*, temp_dir_root: 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]]]:
516
- """
517
- Decorator that helps cache, version and store models/datasets from huggingface hub.
518
-
519
- Parameters
520
- ----------
521
- temp_dir_root : str, optional
522
- The root directory that will hold the temporary directory where objects will be downloaded.
523
-
524
-
525
- """
526
- ...
527
-
528
515
  def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
529
516
  """
530
517
  Specifies that this step should execute on Kubernetes.
@@ -591,79 +578,195 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
591
578
  """
592
579
  ...
593
580
 
581
+ def huggingface_hub(*, temp_dir_root: 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]]]:
582
+ """
583
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
584
+
585
+ Parameters
586
+ ----------
587
+ temp_dir_root : str, optional
588
+ The root directory that will hold the temporary directory where objects will be downloaded.
589
+
590
+
591
+ """
592
+ ...
593
+
594
594
  @typing.overload
595
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
595
+ 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]]]:
596
596
  """
597
- Internal decorator to support Fast bakery
597
+ Specifies the resources needed when executing this step.
598
+
599
+ Use `@resources` to specify the resource requirements
600
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
601
+
602
+ You can choose the compute layer on the command line by executing e.g.
603
+ ```
604
+ python myflow.py run --with batch
605
+ ```
606
+ or
607
+ ```
608
+ python myflow.py run --with kubernetes
609
+ ```
610
+ which executes the flow on the desired system using the
611
+ requirements specified in `@resources`.
612
+
613
+ Parameters
614
+ ----------
615
+ cpu : int, default 1
616
+ Number of CPUs required for this step.
617
+ gpu : int, default 0
618
+ Number of GPUs required for this step.
619
+ disk : int, optional, default None
620
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
621
+ memory : int, default 4096
622
+ Memory size (in MB) required for this step.
623
+ shared_memory : int, optional, default None
624
+ The value for the size (in MiB) of the /dev/shm volume for this step.
625
+ This parameter maps to the `--shm-size` option in Docker.
598
626
  """
599
627
  ...
600
628
 
601
629
  @typing.overload
602
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
630
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
603
631
  ...
604
632
 
605
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
633
+ @typing.overload
634
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
635
+ ...
636
+
637
+ 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):
606
638
  """
607
- Internal decorator to support Fast bakery
639
+ Specifies the resources needed when executing this step.
640
+
641
+ Use `@resources` to specify the resource requirements
642
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
643
+
644
+ You can choose the compute layer on the command line by executing e.g.
645
+ ```
646
+ python myflow.py run --with batch
647
+ ```
648
+ or
649
+ ```
650
+ python myflow.py run --with kubernetes
651
+ ```
652
+ which executes the flow on the desired system using the
653
+ requirements specified in `@resources`.
654
+
655
+ Parameters
656
+ ----------
657
+ cpu : int, default 1
658
+ Number of CPUs required for this step.
659
+ gpu : int, default 0
660
+ Number of GPUs required for this step.
661
+ disk : int, optional, default None
662
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
663
+ memory : int, default 4096
664
+ Memory size (in MB) required for this step.
665
+ shared_memory : int, optional, default None
666
+ The value for the size (in MiB) of the /dev/shm volume for this step.
667
+ This parameter maps to the `--shm-size` option in Docker.
608
668
  """
609
669
  ...
610
670
 
611
671
  @typing.overload
612
- 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]]]:
672
+ def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
613
673
  """
614
- Enables loading / saving of models within a step.
674
+ Specifies the number of times the task corresponding
675
+ to a step needs to be retried.
676
+
677
+ This decorator is useful for handling transient errors, such as networking issues.
678
+ If your task contains operations that can't be retried safely, e.g. database updates,
679
+ it is advisable to annotate it with `@retry(times=0)`.
615
680
 
681
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
682
+ decorator will execute a no-op task after all retries have been exhausted,
683
+ ensuring that the flow execution can continue.
616
684
 
617
685
  Parameters
618
686
  ----------
619
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
620
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
621
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
622
- - `current.checkpoint`
623
- - `current.model`
624
- - `current.huggingface_hub`
687
+ times : int, default 3
688
+ Number of times to retry this task.
689
+ minutes_between_retries : int, default 2
690
+ Number of minutes between retries.
691
+ """
692
+ ...
693
+
694
+ @typing.overload
695
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
696
+ ...
697
+
698
+ @typing.overload
699
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
700
+ ...
701
+
702
+ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
703
+ """
704
+ Specifies the number of times the task corresponding
705
+ to a step needs to be retried.
625
706
 
626
- 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
627
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
628
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
707
+ This decorator is useful for handling transient errors, such as networking issues.
708
+ If your task contains operations that can't be retried safely, e.g. database updates,
709
+ it is advisable to annotate it with `@retry(times=0)`.
629
710
 
630
- temp_dir_root : str, default: None
631
- The root directory under which `current.model.loaded` will store loaded models
711
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
712
+ decorator will execute a no-op task after all retries have been exhausted,
713
+ ensuring that the flow execution can continue.
714
+
715
+ Parameters
716
+ ----------
717
+ times : int, default 3
718
+ Number of times to retry this task.
719
+ minutes_between_retries : int, default 2
720
+ Number of minutes between retries.
721
+ """
722
+ ...
723
+
724
+ @typing.overload
725
+ def card(*, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
726
+ """
727
+ Creates a human-readable report, a Metaflow Card, after this step completes.
632
728
 
729
+ Note that you may add multiple `@card` decorators in a step with different parameters.
730
+
731
+ Parameters
732
+ ----------
733
+ type : str, default 'default'
734
+ Card type.
735
+ id : str, optional, default None
736
+ If multiple cards are present, use this id to identify this card.
737
+ options : Dict[str, Any], default {}
738
+ Options passed to the card. The contents depend on the card type.
739
+ timeout : int, default 45
740
+ Interrupt reporting if it takes more than this many seconds.
633
741
 
634
742
 
635
743
  """
636
744
  ...
637
745
 
638
746
  @typing.overload
639
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
747
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
640
748
  ...
641
749
 
642
750
  @typing.overload
643
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
751
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
644
752
  ...
645
753
 
646
- 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):
754
+ 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):
647
755
  """
648
- Enables loading / saving of models within a step.
756
+ Creates a human-readable report, a Metaflow Card, after this step completes.
649
757
 
758
+ Note that you may add multiple `@card` decorators in a step with different parameters.
650
759
 
651
760
  Parameters
652
761
  ----------
653
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
654
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
655
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
656
- - `current.checkpoint`
657
- - `current.model`
658
- - `current.huggingface_hub`
659
-
660
- 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
661
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
662
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
663
-
664
- temp_dir_root : str, default: None
665
- The root directory under which `current.model.loaded` will store loaded models
666
-
762
+ type : str, default 'default'
763
+ Card type.
764
+ id : str, optional, default None
765
+ If multiple cards are present, use this id to identify this card.
766
+ options : Dict[str, Any], default {}
767
+ Options passed to the card. The contents depend on the card type.
768
+ timeout : int, default 45
769
+ Interrupt reporting if it takes more than this many seconds.
667
770
 
668
771
 
669
772
  """
@@ -719,35 +822,21 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
719
822
  ...
720
823
 
721
824
  @typing.overload
722
- 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]]]:
825
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
723
826
  """
724
- Specifies secrets to be retrieved and injected as environment variables prior to
725
- the execution of a step.
726
-
727
- Parameters
728
- ----------
729
- sources : List[Union[str, Dict[str, Any]]], default: []
730
- List of secret specs, defining how the secrets are to be retrieved
827
+ Decorator prototype for all step decorators. This function gets specialized
828
+ and imported for all decorators types by _import_plugin_decorators().
731
829
  """
732
830
  ...
733
831
 
734
832
  @typing.overload
735
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
736
- ...
737
-
738
- @typing.overload
739
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
833
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
740
834
  ...
741
835
 
742
- 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]]] = []):
836
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
743
837
  """
744
- Specifies secrets to be retrieved and injected as environment variables prior to
745
- the execution of a step.
746
-
747
- Parameters
748
- ----------
749
- sources : List[Union[str, Dict[str, Any]]], default: []
750
- List of secret specs, defining how the secrets are to be retrieved
838
+ Decorator prototype for all step decorators. This function gets specialized
839
+ and imported for all decorators types by _import_plugin_decorators().
751
840
  """
752
841
  ...
753
842
 
@@ -809,128 +898,14 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
809
898
  ...
810
899
 
811
900
  @typing.overload
812
- 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]]]:
901
+ 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]]]:
813
902
  """
814
- Enables checkpointing for a step.
903
+ Specifies that the step will success under all circumstances.
815
904
 
816
-
817
- Parameters
818
- ----------
819
- load_policy : str, default: "fresh"
820
- The policy for loading the checkpoint. The following policies are supported:
821
- - "eager": Loads the the latest available checkpoint within the namespace.
822
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
823
- will be loaded at the start of the task.
824
- - "none": Do not load any checkpoint
825
- - "fresh": Loads the lastest checkpoint created within the running Task.
826
- This mode helps loading checkpoints across various retry attempts of the same task.
827
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
828
- created within the task will be loaded when the task is retries execution on failure.
829
-
830
- temp_dir_root : str, default: None
831
- The root directory under which `current.checkpoint.directory` will be created.
832
-
833
-
834
-
835
- """
836
- ...
837
-
838
- @typing.overload
839
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
840
- ...
841
-
842
- @typing.overload
843
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
844
- ...
845
-
846
- 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):
847
- """
848
- Enables checkpointing for a step.
849
-
850
-
851
- Parameters
852
- ----------
853
- load_policy : str, default: "fresh"
854
- The policy for loading the checkpoint. The following policies are supported:
855
- - "eager": Loads the the latest available checkpoint within the namespace.
856
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
857
- will be loaded at the start of the task.
858
- - "none": Do not load any checkpoint
859
- - "fresh": Loads the lastest checkpoint created within the running Task.
860
- This mode helps loading checkpoints across various retry attempts of the same task.
861
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
862
- created within the task will be loaded when the task is retries execution on failure.
863
-
864
- temp_dir_root : str, default: None
865
- The root directory under which `current.checkpoint.directory` will be created.
866
-
867
-
868
-
869
- """
870
- ...
871
-
872
- @typing.overload
873
- 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]]]:
874
- """
875
- Specifies the number of times the task corresponding
876
- to a step needs to be retried.
877
-
878
- This decorator is useful for handling transient errors, such as networking issues.
879
- If your task contains operations that can't be retried safely, e.g. database updates,
880
- it is advisable to annotate it with `@retry(times=0)`.
881
-
882
- This can be used in conjunction with the `@catch` decorator. The `@catch`
883
- decorator will execute a no-op task after all retries have been exhausted,
884
- ensuring that the flow execution can continue.
885
-
886
- Parameters
887
- ----------
888
- times : int, default 3
889
- Number of times to retry this task.
890
- minutes_between_retries : int, default 2
891
- Number of minutes between retries.
892
- """
893
- ...
894
-
895
- @typing.overload
896
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
897
- ...
898
-
899
- @typing.overload
900
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
901
- ...
902
-
903
- 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):
904
- """
905
- Specifies the number of times the task corresponding
906
- to a step needs to be retried.
907
-
908
- This decorator is useful for handling transient errors, such as networking issues.
909
- If your task contains operations that can't be retried safely, e.g. database updates,
910
- it is advisable to annotate it with `@retry(times=0)`.
911
-
912
- This can be used in conjunction with the `@catch` decorator. The `@catch`
913
- decorator will execute a no-op task after all retries have been exhausted,
914
- ensuring that the flow execution can continue.
915
-
916
- Parameters
917
- ----------
918
- times : int, default 3
919
- Number of times to retry this task.
920
- minutes_between_retries : int, default 2
921
- Number of minutes between retries.
922
- """
923
- ...
924
-
925
- @typing.overload
926
- 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]]]:
927
- """
928
- Specifies that the step will success under all circumstances.
929
-
930
- The decorator will create an optional artifact, specified by `var`, which
931
- contains the exception raised. You can use it to detect the presence
932
- of errors, indicating that all happy-path artifacts produced by the step
933
- are missing.
905
+ The decorator will create an optional artifact, specified by `var`, which
906
+ contains the exception raised. You can use it to detect the presence
907
+ of errors, indicating that all happy-path artifacts produced by the step
908
+ are missing.
934
909
 
935
910
  Parameters
936
911
  ----------
@@ -972,21 +947,35 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
972
947
  ...
973
948
 
974
949
  @typing.overload
975
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
950
+ def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
976
951
  """
977
- Decorator prototype for all step decorators. This function gets specialized
978
- and imported for all decorators types by _import_plugin_decorators().
952
+ Specifies secrets to be retrieved and injected as environment variables prior to
953
+ the execution of a step.
954
+
955
+ Parameters
956
+ ----------
957
+ sources : List[Union[str, Dict[str, Any]]], default: []
958
+ List of secret specs, defining how the secrets are to be retrieved
979
959
  """
980
960
  ...
981
961
 
982
962
  @typing.overload
983
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
963
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
984
964
  ...
985
965
 
986
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
966
+ @typing.overload
967
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
968
+ ...
969
+
970
+ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
987
971
  """
988
- Decorator prototype for all step decorators. This function gets specialized
989
- and imported for all decorators types by _import_plugin_decorators().
972
+ Specifies secrets to be retrieved and injected as environment variables prior to
973
+ the execution of a step.
974
+
975
+ Parameters
976
+ ----------
977
+ sources : List[Union[str, Dict[str, Any]]], default: []
978
+ List of secret specs, defining how the secrets are to be retrieved
990
979
  """
991
980
  ...
992
981
 
@@ -1022,228 +1011,158 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
1022
1011
  ...
1023
1012
 
1024
1013
  @typing.overload
1025
- 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]]]:
1014
+ def checkpoint(*, load_policy: str = "fresh", temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1026
1015
  """
1027
- Specifies the resources needed when executing this step.
1028
-
1029
- Use `@resources` to specify the resource requirements
1030
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1016
+ Enables checkpointing for a step.
1031
1017
 
1032
- You can choose the compute layer on the command line by executing e.g.
1033
- ```
1034
- python myflow.py run --with batch
1035
- ```
1036
- or
1037
- ```
1038
- python myflow.py run --with kubernetes
1039
- ```
1040
- which executes the flow on the desired system using the
1041
- requirements specified in `@resources`.
1042
1018
 
1043
1019
  Parameters
1044
1020
  ----------
1045
- cpu : int, default 1
1046
- Number of CPUs required for this step.
1047
- gpu : int, default 0
1048
- Number of GPUs required for this step.
1049
- disk : int, optional, default None
1050
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1051
- memory : int, default 4096
1052
- Memory size (in MB) required for this step.
1053
- shared_memory : int, optional, default None
1054
- The value for the size (in MiB) of the /dev/shm volume for this step.
1055
- This parameter maps to the `--shm-size` option in Docker.
1021
+ load_policy : str, default: "fresh"
1022
+ The policy for loading the checkpoint. The following policies are supported:
1023
+ - "eager": Loads the the latest available checkpoint within the namespace.
1024
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1025
+ will be loaded at the start of the task.
1026
+ - "none": Do not load any checkpoint
1027
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1028
+ This mode helps loading checkpoints across various retry attempts of the same task.
1029
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1030
+ created within the task will be loaded when the task is retries execution on failure.
1031
+
1032
+ temp_dir_root : str, default: None
1033
+ The root directory under which `current.checkpoint.directory` will be created.
1034
+
1035
+
1036
+
1056
1037
  """
1057
1038
  ...
1058
1039
 
1059
1040
  @typing.overload
1060
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1041
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1061
1042
  ...
1062
1043
 
1063
1044
  @typing.overload
1064
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1045
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1065
1046
  ...
1066
1047
 
1067
- 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):
1048
+ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = "fresh", temp_dir_root: str = None):
1068
1049
  """
1069
- Specifies the resources needed when executing this step.
1070
-
1071
- Use `@resources` to specify the resource requirements
1072
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1050
+ Enables checkpointing for a step.
1073
1051
 
1074
- You can choose the compute layer on the command line by executing e.g.
1075
- ```
1076
- python myflow.py run --with batch
1077
- ```
1078
- or
1079
- ```
1080
- python myflow.py run --with kubernetes
1081
- ```
1082
- which executes the flow on the desired system using the
1083
- requirements specified in `@resources`.
1084
1052
 
1085
1053
  Parameters
1086
1054
  ----------
1087
- cpu : int, default 1
1088
- Number of CPUs required for this step.
1089
- gpu : int, default 0
1090
- Number of GPUs required for this step.
1091
- disk : int, optional, default None
1092
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1093
- memory : int, default 4096
1094
- Memory size (in MB) required for this step.
1095
- shared_memory : int, optional, default None
1096
- The value for the size (in MiB) of the /dev/shm volume for this step.
1097
- This parameter maps to the `--shm-size` option in Docker.
1055
+ load_policy : str, default: "fresh"
1056
+ The policy for loading the checkpoint. The following policies are supported:
1057
+ - "eager": Loads the the latest available checkpoint within the namespace.
1058
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1059
+ will be loaded at the start of the task.
1060
+ - "none": Do not load any checkpoint
1061
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1062
+ This mode helps loading checkpoints across various retry attempts of the same task.
1063
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1064
+ created within the task will be loaded when the task is retries execution on failure.
1065
+
1066
+ temp_dir_root : str, default: None
1067
+ The root directory under which `current.checkpoint.directory` will be created.
1068
+
1069
+
1070
+
1098
1071
  """
1099
1072
  ...
1100
1073
 
1101
1074
  @typing.overload
1102
- 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]]]:
1075
+ def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1103
1076
  """
1104
- Specifies the Conda environment for the step.
1077
+ Enables loading / saving of models within a step.
1105
1078
 
1106
- Information in this decorator will augment any
1107
- attributes set in the `@conda_base` flow-level decorator. Hence,
1108
- you can use `@conda_base` to set packages required by all
1109
- steps and use `@conda` to specify step-specific overrides.
1110
1079
 
1111
1080
  Parameters
1112
1081
  ----------
1113
- packages : Dict[str, str], default {}
1114
- Packages to use for this step. The key is the name of the package
1115
- and the value is the version to use.
1116
- libraries : Dict[str, str], default {}
1117
- Supported for backward compatibility. When used with packages, packages will take precedence.
1118
- python : str, optional, default None
1119
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1120
- that the version used will correspond to the version of the Python interpreter used to start the run.
1121
- disabled : bool, default False
1122
- If set to True, disables @conda.
1123
- """
1124
- ...
1125
-
1126
- @typing.overload
1127
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1128
- ...
1129
-
1130
- @typing.overload
1131
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1132
- ...
1133
-
1134
- 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):
1135
- """
1136
- Specifies the Conda environment for the step.
1137
-
1138
- Information in this decorator will augment any
1139
- attributes set in the `@conda_base` flow-level decorator. Hence,
1140
- you can use `@conda_base` to set packages required by all
1141
- steps and use `@conda` to specify step-specific overrides.
1082
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
1083
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
1084
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
1085
+ - `current.checkpoint`
1086
+ - `current.model`
1087
+ - `current.huggingface_hub`
1142
1088
 
1143
- Parameters
1144
- ----------
1145
- packages : Dict[str, str], default {}
1146
- Packages to use for this step. The key is the name of the package
1147
- and the value is the version to use.
1148
- libraries : Dict[str, str], default {}
1149
- Supported for backward compatibility. When used with packages, packages will take precedence.
1150
- python : str, optional, default None
1151
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1152
- that the version used will correspond to the version of the Python interpreter used to start the run.
1153
- disabled : bool, default False
1154
- If set to True, disables @conda.
1155
- """
1156
- ...
1157
-
1158
- @typing.overload
1159
- 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]]]:
1160
- """
1161
- Creates a human-readable report, a Metaflow Card, after this step completes.
1089
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
1090
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
1091
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
1162
1092
 
1163
- Note that you may add multiple `@card` decorators in a step with different parameters.
1093
+ temp_dir_root : str, default: None
1094
+ The root directory under which `current.model.loaded` will store loaded models
1164
1095
 
1165
- Parameters
1166
- ----------
1167
- type : str, default 'default'
1168
- Card type.
1169
- id : str, optional, default None
1170
- If multiple cards are present, use this id to identify this card.
1171
- options : Dict[str, Any], default {}
1172
- Options passed to the card. The contents depend on the card type.
1173
- timeout : int, default 45
1174
- Interrupt reporting if it takes more than this many seconds.
1175
1096
 
1176
1097
 
1177
1098
  """
1178
1099
  ...
1179
1100
 
1180
1101
  @typing.overload
1181
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1102
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1182
1103
  ...
1183
1104
 
1184
1105
  @typing.overload
1185
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1106
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1186
1107
  ...
1187
1108
 
1188
- 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):
1109
+ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
1189
1110
  """
1190
- Creates a human-readable report, a Metaflow Card, after this step completes.
1111
+ Enables loading / saving of models within a step.
1191
1112
 
1192
- Note that you may add multiple `@card` decorators in a step with different parameters.
1193
1113
 
1194
1114
  Parameters
1195
1115
  ----------
1196
- type : str, default 'default'
1197
- Card type.
1198
- id : str, optional, default None
1199
- If multiple cards are present, use this id to identify this card.
1200
- options : Dict[str, Any], default {}
1201
- Options passed to the card. The contents depend on the card type.
1202
- timeout : int, default 45
1203
- Interrupt reporting if it takes more than this many seconds.
1116
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
1117
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
1118
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
1119
+ - `current.checkpoint`
1120
+ - `current.model`
1121
+ - `current.huggingface_hub`
1122
+
1123
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
1124
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
1125
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
1126
+
1127
+ temp_dir_root : str, default: None
1128
+ The root directory under which `current.model.loaded` will store loaded models
1129
+
1204
1130
 
1205
1131
 
1206
1132
  """
1207
1133
  ...
1208
1134
 
1209
1135
  @typing.overload
1210
- 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]]:
1136
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1211
1137
  """
1212
- Specifies the Conda environment for all steps of the flow.
1213
-
1214
- Use `@conda_base` to set common libraries required by all
1215
- steps and use `@conda` to specify step-specific additions.
1216
-
1217
- Parameters
1218
- ----------
1219
- packages : Dict[str, str], default {}
1220
- Packages to use for this flow. The key is the name of the package
1221
- and the value is the version to use.
1222
- libraries : Dict[str, str], default {}
1223
- Supported for backward compatibility. When used with packages, packages will take precedence.
1224
- python : str, optional, default None
1225
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1226
- that the version used will correspond to the version of the Python interpreter used to start the run.
1227
- disabled : bool, default False
1228
- If set to True, disables Conda.
1138
+ Internal decorator to support Fast bakery
1229
1139
  """
1230
1140
  ...
1231
1141
 
1232
1142
  @typing.overload
1233
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1143
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1234
1144
  ...
1235
1145
 
1236
- 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):
1146
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1237
1147
  """
1238
- Specifies the Conda environment for all steps of the flow.
1148
+ Internal decorator to support Fast bakery
1149
+ """
1150
+ ...
1151
+
1152
+ @typing.overload
1153
+ def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1154
+ """
1155
+ Specifies the Conda environment for the step.
1239
1156
 
1240
- Use `@conda_base` to set common libraries required by all
1241
- steps and use `@conda` to specify step-specific additions.
1157
+ Information in this decorator will augment any
1158
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1159
+ you can use `@conda_base` to set packages required by all
1160
+ steps and use `@conda` to specify step-specific overrides.
1242
1161
 
1243
1162
  Parameters
1244
1163
  ----------
1245
1164
  packages : Dict[str, str], default {}
1246
- Packages to use for this flow. The key is the name of the package
1165
+ Packages to use for this step. The key is the name of the package
1247
1166
  and the value is the version to use.
1248
1167
  libraries : Dict[str, str], default {}
1249
1168
  Supported for backward compatibility. When used with packages, packages will take precedence.
@@ -1251,119 +1170,85 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1251
1170
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1252
1171
  that the version used will correspond to the version of the Python interpreter used to start the run.
1253
1172
  disabled : bool, default False
1254
- If set to True, disables Conda.
1173
+ If set to True, disables @conda.
1255
1174
  """
1256
1175
  ...
1257
1176
 
1258
1177
  @typing.overload
1259
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1260
- """
1261
- Specifies the PyPI packages for all steps of the flow.
1262
-
1263
- Use `@pypi_base` to set common packages required by all
1264
- steps and use `@pypi` to specify step-specific overrides.
1265
- Parameters
1266
- ----------
1267
- packages : Dict[str, str], default: {}
1268
- Packages to use for this flow. The key is the name of the package
1269
- and the value is the version to use.
1270
- python : str, optional, default: None
1271
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1272
- that the version used will correspond to the version of the Python interpreter used to start the run.
1273
- """
1178
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1274
1179
  ...
1275
1180
 
1276
1181
  @typing.overload
1277
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1182
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1278
1183
  ...
1279
1184
 
1280
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1185
+ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1281
1186
  """
1282
- Specifies the PyPI packages for all steps of the flow.
1187
+ Specifies the Conda environment for the step.
1188
+
1189
+ Information in this decorator will augment any
1190
+ attributes set in the `@conda_base` flow-level decorator. Hence,
1191
+ you can use `@conda_base` to set packages required by all
1192
+ steps and use `@conda` to specify step-specific overrides.
1283
1193
 
1284
- Use `@pypi_base` to set common packages required by all
1285
- steps and use `@pypi` to specify step-specific overrides.
1286
1194
  Parameters
1287
1195
  ----------
1288
- packages : Dict[str, str], default: {}
1289
- Packages to use for this flow. The key is the name of the package
1196
+ packages : Dict[str, str], default {}
1197
+ Packages to use for this step. The key is the name of the package
1290
1198
  and the value is the version to use.
1291
- python : str, optional, default: None
1199
+ libraries : Dict[str, str], default {}
1200
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1201
+ python : str, optional, default None
1292
1202
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1293
1203
  that the version used will correspond to the version of the Python interpreter used to start the run.
1294
- """
1295
- ...
1296
-
1297
- def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1298
- """
1299
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1300
-
1301
- User code call
1302
- -----------
1303
- @nim(
1304
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1305
- backend='managed'
1306
- )
1307
-
1308
- Valid backend options
1309
- ---------------------
1310
- - 'managed': Outerbounds selects a compute provider based on the model.
1311
- - 🚧 'dataplane': Run in your account.
1312
-
1313
- Valid model options
1314
- ----------------
1315
- - 'meta/llama3-8b-instruct': 8B parameter model
1316
- - 'meta/llama3-70b-instruct': 70B parameter model
1317
- - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1318
-
1319
- Parameters
1320
- ----------
1321
- models: list[NIM]
1322
- List of NIM containers running models in sidecars.
1323
- backend: str
1324
- Compute provider to run the NIM container.
1204
+ disabled : bool, default False
1205
+ If set to True, disables @conda.
1325
1206
  """
1326
1207
  ...
1327
1208
 
1328
1209
  @typing.overload
1329
- 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]]:
1210
+ 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]]:
1330
1211
  """
1331
- Specifies the event(s) that this flow depends on.
1212
+ Specifies the flow(s) that this flow depends on.
1332
1213
 
1333
1214
  ```
1334
- @trigger(event='foo')
1215
+ @trigger_on_finish(flow='FooFlow')
1335
1216
  ```
1336
1217
  or
1337
1218
  ```
1338
- @trigger(events=['foo', 'bar'])
1219
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1339
1220
  ```
1221
+ This decorator respects the @project decorator and triggers the flow
1222
+ when upstream runs within the same namespace complete successfully
1340
1223
 
1341
- Additionally, you can specify the parameter mappings
1342
- to map event payload to Metaflow parameters for the flow.
1224
+ Additionally, you can specify project aware upstream flow dependencies
1225
+ by specifying the fully qualified project_flow_name.
1343
1226
  ```
1344
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1227
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1345
1228
  ```
1346
1229
  or
1347
1230
  ```
1348
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1349
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1231
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1350
1232
  ```
1351
1233
 
1352
- 'parameters' can also be a list of strings and tuples like so:
1353
- ```
1354
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1355
- ```
1356
- This is equivalent to:
1234
+ You can also specify just the project or project branch (other values will be
1235
+ inferred from the current project or project branch):
1357
1236
  ```
1358
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1237
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1359
1238
  ```
1360
1239
 
1240
+ Note that `branch` is typically one of:
1241
+ - `prod`
1242
+ - `user.bob`
1243
+ - `test.my_experiment`
1244
+ - `prod.staging`
1245
+
1361
1246
  Parameters
1362
1247
  ----------
1363
- event : Union[str, Dict[str, Any]], optional, default None
1364
- Event dependency for this flow.
1365
- events : List[Union[str, Dict[str, Any]]], default []
1366
- Events dependency for this flow.
1248
+ flow : Union[str, Dict[str, str]], optional, default None
1249
+ Upstream flow dependency for this flow.
1250
+ flows : List[Union[str, Dict[str, str]]], default []
1251
+ Upstream flow dependencies for this flow.
1367
1252
  options : Dict[str, Any], default {}
1368
1253
  Backend-specific configuration for tuning eventing behavior.
1369
1254
 
@@ -1372,47 +1257,51 @@ def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = No
1372
1257
  ...
1373
1258
 
1374
1259
  @typing.overload
1375
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1260
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1376
1261
  ...
1377
1262
 
1378
- def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1263
+ 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] = {}):
1379
1264
  """
1380
- Specifies the event(s) that this flow depends on.
1265
+ Specifies the flow(s) that this flow depends on.
1381
1266
 
1382
1267
  ```
1383
- @trigger(event='foo')
1268
+ @trigger_on_finish(flow='FooFlow')
1384
1269
  ```
1385
1270
  or
1386
1271
  ```
1387
- @trigger(events=['foo', 'bar'])
1272
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1388
1273
  ```
1274
+ This decorator respects the @project decorator and triggers the flow
1275
+ when upstream runs within the same namespace complete successfully
1389
1276
 
1390
- Additionally, you can specify the parameter mappings
1391
- to map event payload to Metaflow parameters for the flow.
1277
+ Additionally, you can specify project aware upstream flow dependencies
1278
+ by specifying the fully qualified project_flow_name.
1392
1279
  ```
1393
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1280
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1394
1281
  ```
1395
1282
  or
1396
1283
  ```
1397
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1398
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1284
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1399
1285
  ```
1400
1286
 
1401
- 'parameters' can also be a list of strings and tuples like so:
1402
- ```
1403
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1404
- ```
1405
- This is equivalent to:
1287
+ You can also specify just the project or project branch (other values will be
1288
+ inferred from the current project or project branch):
1406
1289
  ```
1407
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1290
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1408
1291
  ```
1409
1292
 
1293
+ Note that `branch` is typically one of:
1294
+ - `prod`
1295
+ - `user.bob`
1296
+ - `test.my_experiment`
1297
+ - `prod.staging`
1298
+
1410
1299
  Parameters
1411
1300
  ----------
1412
- event : Union[str, Dict[str, Any]], optional, default None
1413
- Event dependency for this flow.
1414
- events : List[Union[str, Dict[str, Any]]], default []
1415
- Events dependency for this flow.
1301
+ flow : Union[str, Dict[str, str]], optional, default None
1302
+ Upstream flow dependency for this flow.
1303
+ flows : List[Union[str, Dict[str, str]]], default []
1304
+ Upstream flow dependencies for this flow.
1416
1305
  options : Dict[str, Any], default {}
1417
1306
  Backend-specific configuration for tuning eventing behavior.
1418
1307
 
@@ -1420,70 +1309,52 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1420
1309
  """
1421
1310
  ...
1422
1311
 
1423
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1424
- """
1425
- Specifies what flows belong to the same project.
1426
-
1427
- A project-specific namespace is created for all flows that
1428
- use the same `@project(name)`.
1429
-
1430
- Parameters
1431
- ----------
1432
- name : str
1433
- Project name. Make sure that the name is unique amongst all
1434
- projects that use the same production scheduler. The name may
1435
- contain only lowercase alphanumeric characters and underscores.
1436
-
1437
-
1438
- """
1439
- ...
1440
-
1441
1312
  @typing.overload
1442
- 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]]:
1313
+ def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1443
1314
  """
1444
- Specifies the times when the flow should be run when running on a
1445
- production scheduler.
1315
+ Specifies the Conda environment for all steps of the flow.
1316
+
1317
+ Use `@conda_base` to set common libraries required by all
1318
+ steps and use `@conda` to specify step-specific additions.
1446
1319
 
1447
1320
  Parameters
1448
1321
  ----------
1449
- hourly : bool, default False
1450
- Run the workflow hourly.
1451
- daily : bool, default True
1452
- Run the workflow daily.
1453
- weekly : bool, default False
1454
- Run the workflow weekly.
1455
- cron : str, optional, default None
1456
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1457
- specified by this expression.
1458
- timezone : str, optional, default None
1459
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1460
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1322
+ packages : Dict[str, str], default {}
1323
+ Packages to use for this flow. The key is the name of the package
1324
+ and the value is the version to use.
1325
+ libraries : Dict[str, str], default {}
1326
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1327
+ python : str, optional, default None
1328
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1329
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1330
+ disabled : bool, default False
1331
+ If set to True, disables Conda.
1461
1332
  """
1462
1333
  ...
1463
1334
 
1464
1335
  @typing.overload
1465
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1336
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1466
1337
  ...
1467
1338
 
1468
- 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):
1339
+ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1469
1340
  """
1470
- Specifies the times when the flow should be run when running on a
1471
- production scheduler.
1341
+ Specifies the Conda environment for all steps of the flow.
1342
+
1343
+ Use `@conda_base` to set common libraries required by all
1344
+ steps and use `@conda` to specify step-specific additions.
1472
1345
 
1473
1346
  Parameters
1474
1347
  ----------
1475
- hourly : bool, default False
1476
- Run the workflow hourly.
1477
- daily : bool, default True
1478
- Run the workflow daily.
1479
- weekly : bool, default False
1480
- Run the workflow weekly.
1481
- cron : str, optional, default None
1482
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1483
- specified by this expression.
1484
- timezone : str, optional, default None
1485
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1486
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1348
+ packages : Dict[str, str], default {}
1349
+ Packages to use for this flow. The key is the name of the package
1350
+ and the value is the version to use.
1351
+ libraries : Dict[str, str], default {}
1352
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1353
+ python : str, optional, default None
1354
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1355
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1356
+ disabled : bool, default False
1357
+ If set to True, disables Conda.
1487
1358
  """
1488
1359
  ...
1489
1360
 
@@ -1529,6 +1400,24 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1529
1400
  """
1530
1401
  ...
1531
1402
 
1403
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1404
+ """
1405
+ Specifies what flows belong to the same project.
1406
+
1407
+ A project-specific namespace is created for all flows that
1408
+ use the same `@project(name)`.
1409
+
1410
+ Parameters
1411
+ ----------
1412
+ name : str
1413
+ Project name. Make sure that the name is unique amongst all
1414
+ projects that use the same production scheduler. The name may
1415
+ contain only lowercase alphanumeric characters and underscores.
1416
+
1417
+
1418
+ """
1419
+ ...
1420
+
1532
1421
  def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1533
1422
  """
1534
1423
  The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
@@ -1572,48 +1461,163 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1572
1461
  ...
1573
1462
 
1574
1463
  @typing.overload
1575
- 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]]:
1464
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1576
1465
  """
1577
- Specifies the flow(s) that this flow depends on.
1466
+ Specifies the PyPI packages for all steps of the flow.
1467
+
1468
+ Use `@pypi_base` to set common packages required by all
1469
+ steps and use `@pypi` to specify step-specific overrides.
1470
+ Parameters
1471
+ ----------
1472
+ packages : Dict[str, str], default: {}
1473
+ Packages to use for this flow. The key is the name of the package
1474
+ and the value is the version to use.
1475
+ python : str, optional, default: None
1476
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1477
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1478
+ """
1479
+ ...
1480
+
1481
+ @typing.overload
1482
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1483
+ ...
1484
+
1485
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1486
+ """
1487
+ Specifies the PyPI packages for all steps of the flow.
1488
+
1489
+ Use `@pypi_base` to set common packages required by all
1490
+ steps and use `@pypi` to specify step-specific overrides.
1491
+ Parameters
1492
+ ----------
1493
+ packages : Dict[str, str], default: {}
1494
+ Packages to use for this flow. The key is the name of the package
1495
+ and the value is the version to use.
1496
+ python : str, optional, default: None
1497
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1498
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1499
+ """
1500
+ ...
1501
+
1502
+ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1503
+ """
1504
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1505
+
1506
+ User code call
1507
+ -----------
1508
+ @nim(
1509
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1510
+ backend='managed'
1511
+ )
1512
+
1513
+ Valid backend options
1514
+ ---------------------
1515
+ - 'managed': Outerbounds selects a compute provider based on the model.
1516
+ - 🚧 'dataplane': Run in your account.
1517
+
1518
+ Valid model options
1519
+ ----------------
1520
+ - 'meta/llama3-8b-instruct': 8B parameter model
1521
+ - 'meta/llama3-70b-instruct': 70B parameter model
1522
+ - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1523
+
1524
+ Parameters
1525
+ ----------
1526
+ models: list[NIM]
1527
+ List of NIM containers running models in sidecars.
1528
+ backend: str
1529
+ Compute provider to run the NIM container.
1530
+ """
1531
+ ...
1532
+
1533
+ @typing.overload
1534
+ def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1535
+ """
1536
+ Specifies the times when the flow should be run when running on a
1537
+ production scheduler.
1538
+
1539
+ Parameters
1540
+ ----------
1541
+ hourly : bool, default False
1542
+ Run the workflow hourly.
1543
+ daily : bool, default True
1544
+ Run the workflow daily.
1545
+ weekly : bool, default False
1546
+ Run the workflow weekly.
1547
+ cron : str, optional, default None
1548
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1549
+ specified by this expression.
1550
+ timezone : str, optional, default None
1551
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1552
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1553
+ """
1554
+ ...
1555
+
1556
+ @typing.overload
1557
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1558
+ ...
1559
+
1560
+ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1561
+ """
1562
+ Specifies the times when the flow should be run when running on a
1563
+ production scheduler.
1564
+
1565
+ Parameters
1566
+ ----------
1567
+ hourly : bool, default False
1568
+ Run the workflow hourly.
1569
+ daily : bool, default True
1570
+ Run the workflow daily.
1571
+ weekly : bool, default False
1572
+ Run the workflow weekly.
1573
+ cron : str, optional, default None
1574
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1575
+ specified by this expression.
1576
+ timezone : str, optional, default None
1577
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1578
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1579
+ """
1580
+ ...
1581
+
1582
+ @typing.overload
1583
+ def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1584
+ """
1585
+ Specifies the event(s) that this flow depends on.
1578
1586
 
1579
1587
  ```
1580
- @trigger_on_finish(flow='FooFlow')
1588
+ @trigger(event='foo')
1581
1589
  ```
1582
1590
  or
1583
1591
  ```
1584
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1592
+ @trigger(events=['foo', 'bar'])
1585
1593
  ```
1586
- This decorator respects the @project decorator and triggers the flow
1587
- when upstream runs within the same namespace complete successfully
1588
1594
 
1589
- Additionally, you can specify project aware upstream flow dependencies
1590
- by specifying the fully qualified project_flow_name.
1595
+ Additionally, you can specify the parameter mappings
1596
+ to map event payload to Metaflow parameters for the flow.
1591
1597
  ```
1592
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1598
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1593
1599
  ```
1594
1600
  or
1595
1601
  ```
1596
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1602
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1603
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1597
1604
  ```
1598
1605
 
1599
- You can also specify just the project or project branch (other values will be
1600
- inferred from the current project or project branch):
1606
+ 'parameters' can also be a list of strings and tuples like so:
1601
1607
  ```
1602
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1608
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1609
+ ```
1610
+ This is equivalent to:
1611
+ ```
1612
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1603
1613
  ```
1604
-
1605
- Note that `branch` is typically one of:
1606
- - `prod`
1607
- - `user.bob`
1608
- - `test.my_experiment`
1609
- - `prod.staging`
1610
1614
 
1611
1615
  Parameters
1612
1616
  ----------
1613
- flow : Union[str, Dict[str, str]], optional, default None
1614
- Upstream flow dependency for this flow.
1615
- flows : List[Union[str, Dict[str, str]]], default []
1616
- Upstream flow dependencies for this flow.
1617
+ event : Union[str, Dict[str, Any]], optional, default None
1618
+ Event dependency for this flow.
1619
+ events : List[Union[str, Dict[str, Any]]], default []
1620
+ Events dependency for this flow.
1617
1621
  options : Dict[str, Any], default {}
1618
1622
  Backend-specific configuration for tuning eventing behavior.
1619
1623
 
@@ -1622,51 +1626,47 @@ def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] =
1622
1626
  ...
1623
1627
 
1624
1628
  @typing.overload
1625
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1629
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1626
1630
  ...
1627
1631
 
1628
- 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] = {}):
1632
+ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
1629
1633
  """
1630
- Specifies the flow(s) that this flow depends on.
1634
+ Specifies the event(s) that this flow depends on.
1631
1635
 
1632
1636
  ```
1633
- @trigger_on_finish(flow='FooFlow')
1637
+ @trigger(event='foo')
1634
1638
  ```
1635
1639
  or
1636
1640
  ```
1637
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1641
+ @trigger(events=['foo', 'bar'])
1638
1642
  ```
1639
- This decorator respects the @project decorator and triggers the flow
1640
- when upstream runs within the same namespace complete successfully
1641
1643
 
1642
- Additionally, you can specify project aware upstream flow dependencies
1643
- by specifying the fully qualified project_flow_name.
1644
+ Additionally, you can specify the parameter mappings
1645
+ to map event payload to Metaflow parameters for the flow.
1644
1646
  ```
1645
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1647
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1646
1648
  ```
1647
1649
  or
1648
1650
  ```
1649
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1651
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1652
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1650
1653
  ```
1651
1654
 
1652
- You can also specify just the project or project branch (other values will be
1653
- inferred from the current project or project branch):
1655
+ 'parameters' can also be a list of strings and tuples like so:
1654
1656
  ```
1655
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1657
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1658
+ ```
1659
+ This is equivalent to:
1660
+ ```
1661
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1656
1662
  ```
1657
-
1658
- Note that `branch` is typically one of:
1659
- - `prod`
1660
- - `user.bob`
1661
- - `test.my_experiment`
1662
- - `prod.staging`
1663
1663
 
1664
1664
  Parameters
1665
1665
  ----------
1666
- flow : Union[str, Dict[str, str]], optional, default None
1667
- Upstream flow dependency for this flow.
1668
- flows : List[Union[str, Dict[str, str]]], default []
1669
- Upstream flow dependencies for this flow.
1666
+ event : Union[str, Dict[str, Any]], optional, default None
1667
+ Event dependency for this flow.
1668
+ events : List[Union[str, Dict[str, Any]]], default []
1669
+ Events dependency for this flow.
1670
1670
  options : Dict[str, Any], default {}
1671
1671
  Backend-specific configuration for tuning eventing behavior.
1672
1672