ob-metaflow-stubs 6.0.3.105__py2.py3-none-any.whl → 6.0.3.106__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 +583 -583
  2. metaflow-stubs/cards.pyi +3 -3
  3. metaflow-stubs/cli.pyi +1 -1
  4. metaflow-stubs/client/__init__.pyi +3 -3
  5. metaflow-stubs/client/core.pyi +5 -5
  6. metaflow-stubs/client/filecache.pyi +2 -2
  7. metaflow-stubs/clone_util.pyi +1 -1
  8. metaflow-stubs/events.pyi +2 -2
  9. metaflow-stubs/exception.pyi +1 -1
  10. metaflow-stubs/flowspec.pyi +5 -5
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +4 -4
  13. metaflow-stubs/info_file.pyi +1 -1
  14. metaflow-stubs/metadata/metadata.pyi +2 -2
  15. metaflow-stubs/metadata/util.pyi +1 -1
  16. metaflow-stubs/metaflow_config.pyi +1 -1
  17. metaflow-stubs/metaflow_current.pyi +78 -78
  18. metaflow-stubs/mflog/mflog.pyi +1 -1
  19. metaflow-stubs/multicore_utils.pyi +1 -1
  20. metaflow-stubs/parameters.pyi +2 -2
  21. metaflow-stubs/plugins/__init__.pyi +1 -1
  22. metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
  23. metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
  24. metaflow-stubs/plugins/airflow/exception.pyi +1 -1
  25. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
  26. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
  28. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
  29. metaflow-stubs/plugins/argo/__init__.pyi +1 -1
  30. metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
  31. metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
  32. metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +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 +1 -1
  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 +1 -1
  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 +4 -4
  61. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  62. metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
  63. metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
  64. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  65. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
  66. metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
  67. metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
  68. metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
  69. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
  70. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
  71. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
  73. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  74. metaflow-stubs/plugins/cards/exception.pyi +1 -1
  75. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  76. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  77. metaflow-stubs/plugins/datatools/local.pyi +1 -1
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  79. metaflow-stubs/plugins/datatools/s3/s3.pyi +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 +1 -1
  90. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
  91. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
  92. metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
  93. metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
  94. metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
  95. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
  96. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
  97. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
  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 +3 -3
  109. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
  110. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  111. metaflow-stubs/plugins/pypi/utils.pyi +1 -1
  112. metaflow-stubs/plugins/resources_decorator.pyi +1 -1
  113. metaflow-stubs/plugins/retry_decorator.pyi +1 -1
  114. metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
  115. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +1 -1
  116. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
  117. metaflow-stubs/plugins/storage_executor.pyi +1 -1
  118. metaflow-stubs/plugins/tag_cli.pyi +3 -3
  119. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
  120. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  121. metaflow-stubs/procpoll.pyi +1 -1
  122. metaflow-stubs/profilers/__init__.pyi +1 -1
  123. metaflow-stubs/pylint_wrapper.pyi +1 -1
  124. metaflow-stubs/runner/__init__.pyi +1 -1
  125. metaflow-stubs/runner/deployer.pyi +1 -1
  126. metaflow-stubs/runner/metaflow_runner.pyi +3 -3
  127. metaflow-stubs/runner/nbdeploy.pyi +1 -1
  128. metaflow-stubs/runner/nbrun.pyi +1 -1
  129. metaflow-stubs/runner/subprocess_manager.pyi +1 -1
  130. metaflow-stubs/runner/utils.pyi +1 -1
  131. metaflow-stubs/system/__init__.pyi +2 -2
  132. metaflow-stubs/system/system_logger.pyi +2 -2
  133. metaflow-stubs/system/system_monitor.pyi +1 -1
  134. metaflow-stubs/tagging_util.pyi +1 -1
  135. metaflow-stubs/tuple_util.pyi +1 -1
  136. {ob_metaflow_stubs-6.0.3.105.dist-info → ob_metaflow_stubs-6.0.3.106.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.106.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.105.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.105.dist-info → ob_metaflow_stubs-6.0.3.106.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.105.dist-info → ob_metaflow_stubs-6.0.3.106.dist-info}/top_level.txt +0 -0
@@ -1,24 +1,24 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
3
  # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
- # Generated on 2024-10-04T10:13:10.624136 #
4
+ # Generated on 2024-10-04T19:10:58.884265 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
+ import metaflow._vendor.click.types
12
+ import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
13
+ import metaflow.parameters
11
14
  import metaflow.metaflow_current
12
- import typing
13
- import metaflow.flowspec
14
15
  import datetime
16
+ import typing
15
17
  import metaflow.events
16
- import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
17
- import metaflow.datastore.inputs
18
- import metaflow.parameters
19
18
  import metaflow.runner.metaflow_runner
19
+ import metaflow.datastore.inputs
20
+ import metaflow.flowspec
20
21
  import metaflow.client.core
21
- import metaflow._vendor.click.types
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -513,51 +513,63 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
513
513
  ...
514
514
 
515
515
  @typing.overload
516
- 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]]]:
516
+ def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
517
517
  """
518
- Specifies the PyPI packages for the step.
518
+ Enables loading / saving of models within a step.
519
519
 
520
- Information in this decorator will augment any
521
- attributes set in the `@pyi_base` flow-level decorator. Hence,
522
- you can use `@pypi_base` to set packages required by all
523
- steps and use `@pypi` to specify step-specific overrides.
524
520
 
525
521
  Parameters
526
522
  ----------
527
- packages : Dict[str, str], default: {}
528
- Packages to use for this step. The key is the name of the package
529
- and the value is the version to use.
530
- python : str, optional, default: None
531
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
532
- that the version used will correspond to the version of the Python interpreter used to start the run.
523
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
524
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
525
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
526
+ - `current.checkpoint`
527
+ - `current.model`
528
+ - `current.huggingface_hub`
529
+
530
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
531
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
532
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
533
+
534
+ temp_dir_root : str, default: None
535
+ The root directory under which `current.model.loaded` will store loaded models
536
+
537
+
538
+
533
539
  """
534
540
  ...
535
541
 
536
542
  @typing.overload
537
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
543
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
538
544
  ...
539
545
 
540
546
  @typing.overload
541
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
547
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
542
548
  ...
543
549
 
544
- 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):
550
+ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
545
551
  """
546
- Specifies the PyPI packages for the step.
552
+ Enables loading / saving of models within a step.
547
553
 
548
- Information in this decorator will augment any
549
- attributes set in the `@pyi_base` flow-level decorator. Hence,
550
- you can use `@pypi_base` to set packages required by all
551
- steps and use `@pypi` to specify step-specific overrides.
552
554
 
553
555
  Parameters
554
556
  ----------
555
- packages : Dict[str, str], default: {}
556
- Packages to use for this step. The key is the name of the package
557
- and the value is the version to use.
558
- python : str, optional, default: None
559
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
560
- that the version used will correspond to the version of the Python interpreter used to start the run.
557
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
558
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
559
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
560
+ - `current.checkpoint`
561
+ - `current.model`
562
+ - `current.huggingface_hub`
563
+
564
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
565
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
566
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
567
+
568
+ temp_dir_root : str, default: None
569
+ The root directory under which `current.model.loaded` will store loaded models
570
+
571
+
572
+
561
573
  """
562
574
  ...
563
575
 
@@ -619,176 +631,209 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
619
631
  ...
620
632
 
621
633
  @typing.overload
622
- 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]]]:
634
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
623
635
  """
624
- Creates a human-readable report, a Metaflow Card, after this step completes.
636
+ Internal decorator to support Fast bakery
637
+ """
638
+ ...
639
+
640
+ @typing.overload
641
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
642
+ ...
643
+
644
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
645
+ """
646
+ Internal decorator to support Fast bakery
647
+ """
648
+ ...
649
+
650
+ @typing.overload
651
+ def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
652
+ """
653
+ Specifies that the step will success under all circumstances.
625
654
 
626
- Note that you may add multiple `@card` decorators in a step with different parameters.
655
+ The decorator will create an optional artifact, specified by `var`, which
656
+ contains the exception raised. You can use it to detect the presence
657
+ of errors, indicating that all happy-path artifacts produced by the step
658
+ are missing.
627
659
 
628
660
  Parameters
629
661
  ----------
630
- type : str, default 'default'
631
- Card type.
632
- id : str, optional, default None
633
- If multiple cards are present, use this id to identify this card.
634
- options : Dict[str, Any], default {}
635
- Options passed to the card. The contents depend on the card type.
636
- timeout : int, default 45
637
- Interrupt reporting if it takes more than this many seconds.
638
-
639
-
662
+ var : str, optional, default None
663
+ Name of the artifact in which to store the caught exception.
664
+ If not specified, the exception is not stored.
665
+ print_exception : bool, default True
666
+ Determines whether or not the exception is printed to
667
+ stdout when caught.
640
668
  """
641
669
  ...
642
670
 
643
671
  @typing.overload
644
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
672
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
645
673
  ...
646
674
 
647
675
  @typing.overload
648
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
676
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
649
677
  ...
650
678
 
651
- 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):
679
+ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
652
680
  """
653
- Creates a human-readable report, a Metaflow Card, after this step completes.
681
+ Specifies that the step will success under all circumstances.
654
682
 
655
- Note that you may add multiple `@card` decorators in a step with different parameters.
683
+ The decorator will create an optional artifact, specified by `var`, which
684
+ contains the exception raised. You can use it to detect the presence
685
+ of errors, indicating that all happy-path artifacts produced by the step
686
+ are missing.
656
687
 
657
688
  Parameters
658
689
  ----------
659
- type : str, default 'default'
660
- Card type.
661
- id : str, optional, default None
662
- If multiple cards are present, use this id to identify this card.
663
- options : Dict[str, Any], default {}
664
- Options passed to the card. The contents depend on the card type.
665
- timeout : int, default 45
666
- Interrupt reporting if it takes more than this many seconds.
667
-
668
-
690
+ var : str, optional, default None
691
+ Name of the artifact in which to store the caught exception.
692
+ If not specified, the exception is not stored.
693
+ print_exception : bool, default True
694
+ Determines whether or not the exception is printed to
695
+ stdout when caught.
669
696
  """
670
697
  ...
671
698
 
672
699
  @typing.overload
673
- 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]]]:
700
+ 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]]]:
674
701
  """
675
- Specifies a timeout for your step.
676
-
677
- This decorator is useful if this step may hang indefinitely.
678
-
679
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
680
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
681
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
682
-
683
- Note that all the values specified in parameters are added together so if you specify
684
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
702
+ Specifies secrets to be retrieved and injected as environment variables prior to
703
+ the execution of a step.
685
704
 
686
705
  Parameters
687
706
  ----------
688
- seconds : int, default 0
689
- Number of seconds to wait prior to timing out.
690
- minutes : int, default 0
691
- Number of minutes to wait prior to timing out.
692
- hours : int, default 0
693
- Number of hours to wait prior to timing out.
707
+ sources : List[Union[str, Dict[str, Any]]], default: []
708
+ List of secret specs, defining how the secrets are to be retrieved
694
709
  """
695
710
  ...
696
711
 
697
712
  @typing.overload
698
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
713
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
699
714
  ...
700
715
 
701
716
  @typing.overload
702
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
717
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
703
718
  ...
704
719
 
705
- 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):
720
+ 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]]] = []):
706
721
  """
707
- Specifies a timeout for your step.
708
-
709
- This decorator is useful if this step may hang indefinitely.
722
+ Specifies secrets to be retrieved and injected as environment variables prior to
723
+ the execution of a step.
710
724
 
711
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
712
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
713
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
725
+ Parameters
726
+ ----------
727
+ sources : List[Union[str, Dict[str, Any]]], default: []
728
+ List of secret specs, defining how the secrets are to be retrieved
729
+ """
730
+ ...
731
+
732
+ @typing.overload
733
+ def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
734
+ """
735
+ Specifies environment variables to be set prior to the execution of a step.
714
736
 
715
- Note that all the values specified in parameters are added together so if you specify
716
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
737
+ Parameters
738
+ ----------
739
+ vars : Dict[str, str], default {}
740
+ Dictionary of environment variables to set.
741
+ """
742
+ ...
743
+
744
+ @typing.overload
745
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
746
+ ...
747
+
748
+ @typing.overload
749
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
750
+ ...
751
+
752
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
753
+ """
754
+ Specifies environment variables to be set prior to the execution of a step.
717
755
 
718
756
  Parameters
719
757
  ----------
720
- seconds : int, default 0
721
- Number of seconds to wait prior to timing out.
722
- minutes : int, default 0
723
- Number of minutes to wait prior to timing out.
724
- hours : int, default 0
725
- Number of hours to wait prior to timing out.
758
+ vars : Dict[str, str], default {}
759
+ Dictionary of environment variables to set.
726
760
  """
727
761
  ...
728
762
 
729
- 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]]]:
763
+ @typing.overload
764
+ def resources(*, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
730
765
  """
731
- Specifies that this step should execute on Kubernetes.
766
+ Specifies the resources needed when executing this step.
767
+
768
+ Use `@resources` to specify the resource requirements
769
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
770
+
771
+ You can choose the compute layer on the command line by executing e.g.
772
+ ```
773
+ python myflow.py run --with batch
774
+ ```
775
+ or
776
+ ```
777
+ python myflow.py run --with kubernetes
778
+ ```
779
+ which executes the flow on the desired system using the
780
+ requirements specified in `@resources`.
732
781
 
733
782
  Parameters
734
783
  ----------
735
784
  cpu : int, default 1
736
- Number of CPUs required for this step. If `@resources` is
737
- also present, the maximum value from all decorators is used.
785
+ Number of CPUs required for this step.
786
+ gpu : int, default 0
787
+ Number of GPUs required for this step.
788
+ disk : int, optional, default None
789
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
738
790
  memory : int, default 4096
739
- Memory size (in MB) required for this step. If
740
- `@resources` is also present, the maximum value from all decorators is
741
- used.
742
- disk : int, default 10240
743
- Disk size (in MB) required for this step. If
744
- `@resources` is also present, the maximum value from all decorators is
745
- used.
746
- image : str, optional, default None
747
- Docker image to use when launching on Kubernetes. If not specified, and
748
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
749
- not, a default Docker image mapping to the current version of Python is used.
750
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
751
- If given, the imagePullPolicy to be applied to the Docker image of the step.
752
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
753
- Kubernetes service account to use when launching pod in Kubernetes.
754
- secrets : List[str], optional, default None
755
- Kubernetes secrets to use when launching pod in Kubernetes. These
756
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
757
- in Metaflow configuration.
758
- node_selector: Union[Dict[str,str], str], optional, default None
759
- Kubernetes node selector(s) to apply to the pod running the task.
760
- Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
761
- or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
762
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
763
- Kubernetes namespace to use when launching pod in Kubernetes.
764
- gpu : int, optional, default None
765
- Number of GPUs required for this step. A value of zero implies that
766
- the scheduled node should not have GPUs.
767
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
768
- The vendor of the GPUs to be used for this step.
769
- tolerations : List[str], default []
770
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
771
- Kubernetes tolerations to use when launching pod in Kubernetes.
772
- use_tmpfs : bool, default False
773
- This enables an explicit tmpfs mount for this step.
774
- tmpfs_tempdir : bool, default True
775
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
776
- tmpfs_size : int, optional, default: None
777
- The value for the size (in MiB) of the tmpfs mount for this step.
778
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
779
- memory allocated for this step.
780
- tmpfs_path : str, optional, default /metaflow_temp
781
- Path to tmpfs mount for this step.
782
- persistent_volume_claims : Dict[str, str], optional, default None
783
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
784
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
785
- shared_memory: int, optional
786
- Shared memory size (in MiB) required for this step
787
- port: int, optional
788
- Port number to specify in the Kubernetes job object
789
- compute_pool : str, optional, default None
790
- Compute pool to be used for for this step.
791
- If not specified, any accessible compute pool within the perimeter is used.
791
+ Memory size (in MB) required for this step.
792
+ shared_memory : int, optional, default None
793
+ The value for the size (in MiB) of the /dev/shm volume for this step.
794
+ This parameter maps to the `--shm-size` option in Docker.
795
+ """
796
+ ...
797
+
798
+ @typing.overload
799
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
800
+ ...
801
+
802
+ @typing.overload
803
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
804
+ ...
805
+
806
+ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
807
+ """
808
+ Specifies the resources needed when executing this step.
809
+
810
+ Use `@resources` to specify the resource requirements
811
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
812
+
813
+ You can choose the compute layer on the command line by executing e.g.
814
+ ```
815
+ python myflow.py run --with batch
816
+ ```
817
+ or
818
+ ```
819
+ python myflow.py run --with kubernetes
820
+ ```
821
+ which executes the flow on the desired system using the
822
+ requirements specified in `@resources`.
823
+
824
+ Parameters
825
+ ----------
826
+ cpu : int, default 1
827
+ Number of CPUs required for this step.
828
+ gpu : int, default 0
829
+ Number of GPUs required for this step.
830
+ disk : int, optional, default None
831
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
832
+ memory : int, default 4096
833
+ Memory size (in MB) required for this step.
834
+ shared_memory : int, optional, default None
835
+ The value for the size (in MiB) of the /dev/shm volume for this step.
836
+ This parameter maps to the `--shm-size` option in Docker.
792
837
  """
793
838
  ...
794
839
 
@@ -846,159 +891,225 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
846
891
  ...
847
892
 
848
893
  @typing.overload
849
- 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]]]:
894
+ 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]]]:
850
895
  """
851
- Specifies the resources needed when executing this step.
852
-
853
- Use `@resources` to specify the resource requirements
854
- independently of the specific compute layer (`@batch`, `@kubernetes`).
896
+ Creates a human-readable report, a Metaflow Card, after this step completes.
855
897
 
856
- You can choose the compute layer on the command line by executing e.g.
857
- ```
858
- python myflow.py run --with batch
859
- ```
860
- or
861
- ```
862
- python myflow.py run --with kubernetes
863
- ```
864
- which executes the flow on the desired system using the
865
- requirements specified in `@resources`.
898
+ Note that you may add multiple `@card` decorators in a step with different parameters.
866
899
 
867
900
  Parameters
868
901
  ----------
869
- cpu : int, default 1
870
- Number of CPUs required for this step.
871
- gpu : int, default 0
872
- Number of GPUs required for this step.
873
- disk : int, optional, default None
874
- Disk size (in MB) required for this step. Only applies on Kubernetes.
875
- memory : int, default 4096
876
- Memory size (in MB) required for this step.
877
- shared_memory : int, optional, default None
878
- The value for the size (in MiB) of the /dev/shm volume for this step.
879
- This parameter maps to the `--shm-size` option in Docker.
902
+ type : str, default 'default'
903
+ Card type.
904
+ id : str, optional, default None
905
+ If multiple cards are present, use this id to identify this card.
906
+ options : Dict[str, Any], default {}
907
+ Options passed to the card. The contents depend on the card type.
908
+ timeout : int, default 45
909
+ Interrupt reporting if it takes more than this many seconds.
910
+
911
+
880
912
  """
881
913
  ...
882
914
 
883
915
  @typing.overload
884
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
916
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
885
917
  ...
886
918
 
887
919
  @typing.overload
888
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
920
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
889
921
  ...
890
922
 
891
- 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):
923
+ 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):
892
924
  """
893
- Specifies the resources needed when executing this step.
894
-
895
- Use `@resources` to specify the resource requirements
896
- independently of the specific compute layer (`@batch`, `@kubernetes`).
925
+ Creates a human-readable report, a Metaflow Card, after this step completes.
897
926
 
898
- You can choose the compute layer on the command line by executing e.g.
899
- ```
900
- python myflow.py run --with batch
901
- ```
902
- or
903
- ```
904
- python myflow.py run --with kubernetes
905
- ```
906
- which executes the flow on the desired system using the
907
- requirements specified in `@resources`.
927
+ Note that you may add multiple `@card` decorators in a step with different parameters.
908
928
 
909
929
  Parameters
910
930
  ----------
911
- cpu : int, default 1
912
- Number of CPUs required for this step.
913
- gpu : int, default 0
914
- Number of GPUs required for this step.
915
- disk : int, optional, default None
916
- Disk size (in MB) required for this step. Only applies on Kubernetes.
917
- memory : int, default 4096
918
- Memory size (in MB) required for this step.
919
- shared_memory : int, optional, default None
920
- The value for the size (in MiB) of the /dev/shm volume for this step.
921
- This parameter maps to the `--shm-size` option in Docker.
931
+ type : str, default 'default'
932
+ Card type.
933
+ id : str, optional, default None
934
+ If multiple cards are present, use this id to identify this card.
935
+ options : Dict[str, Any], default {}
936
+ Options passed to the card. The contents depend on the card type.
937
+ timeout : int, default 45
938
+ Interrupt reporting if it takes more than this many seconds.
939
+
940
+
922
941
  """
923
942
  ...
924
943
 
925
944
  @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]]]:
945
+ def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
927
946
  """
928
- Specifies that the step will success under all circumstances.
947
+ Specifies the PyPI packages for the step.
929
948
 
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.
949
+ Information in this decorator will augment any
950
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
951
+ you can use `@pypi_base` to set packages required by all
952
+ steps and use `@pypi` to specify step-specific overrides.
934
953
 
935
954
  Parameters
936
955
  ----------
937
- var : str, optional, default None
938
- Name of the artifact in which to store the caught exception.
939
- If not specified, the exception is not stored.
940
- print_exception : bool, default True
941
- Determines whether or not the exception is printed to
942
- stdout when caught.
956
+ packages : Dict[str, str], default: {}
957
+ Packages to use for this step. The key is the name of the package
958
+ and the value is the version to use.
959
+ python : str, optional, default: None
960
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
961
+ that the version used will correspond to the version of the Python interpreter used to start the run.
943
962
  """
944
963
  ...
945
964
 
946
965
  @typing.overload
947
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
966
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
948
967
  ...
949
968
 
950
969
  @typing.overload
951
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
970
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
952
971
  ...
953
972
 
954
- 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):
973
+ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
955
974
  """
956
- Specifies that the step will success under all circumstances.
975
+ Specifies the PyPI packages for the step.
957
976
 
958
- The decorator will create an optional artifact, specified by `var`, which
959
- contains the exception raised. You can use it to detect the presence
960
- of errors, indicating that all happy-path artifacts produced by the step
961
- are missing.
977
+ Information in this decorator will augment any
978
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
979
+ you can use `@pypi_base` to set packages required by all
980
+ steps and use `@pypi` to specify step-specific overrides.
962
981
 
963
982
  Parameters
964
983
  ----------
965
- var : str, optional, default None
966
- Name of the artifact in which to store the caught exception.
967
- If not specified, the exception is not stored.
968
- print_exception : bool, default True
969
- Determines whether or not the exception is printed to
970
- stdout when caught.
984
+ packages : Dict[str, str], default: {}
985
+ Packages to use for this step. The key is the name of the package
986
+ and the value is the version to use.
987
+ python : str, optional, default: None
988
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
989
+ that the version used will correspond to the version of the Python interpreter used to start the run.
971
990
  """
972
991
  ...
973
992
 
974
993
  @typing.overload
975
- 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]]]:
994
+ def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
976
995
  """
977
- Specifies environment variables to be set prior to the execution of a step.
996
+ Specifies a timeout for your step.
997
+
998
+ This decorator is useful if this step may hang indefinitely.
999
+
1000
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1001
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1002
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1003
+
1004
+ Note that all the values specified in parameters are added together so if you specify
1005
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
978
1006
 
979
1007
  Parameters
980
1008
  ----------
981
- vars : Dict[str, str], default {}
982
- Dictionary of environment variables to set.
1009
+ seconds : int, default 0
1010
+ Number of seconds to wait prior to timing out.
1011
+ minutes : int, default 0
1012
+ Number of minutes to wait prior to timing out.
1013
+ hours : int, default 0
1014
+ Number of hours to wait prior to timing out.
983
1015
  """
984
1016
  ...
985
1017
 
986
1018
  @typing.overload
987
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1019
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
988
1020
  ...
989
1021
 
990
1022
  @typing.overload
991
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1023
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
992
1024
  ...
993
1025
 
994
- 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
+ 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):
995
1027
  """
996
- Specifies environment variables to be set prior to the execution of a step.
1028
+ Specifies a timeout for your step.
997
1029
 
998
- Parameters
999
- ----------
1000
- vars : Dict[str, str], default {}
1001
- Dictionary of environment variables to set.
1030
+ This decorator is useful if this step may hang indefinitely.
1031
+
1032
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1033
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1034
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1035
+
1036
+ Note that all the values specified in parameters are added together so if you specify
1037
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1038
+
1039
+ Parameters
1040
+ ----------
1041
+ seconds : int, default 0
1042
+ Number of seconds to wait prior to timing out.
1043
+ minutes : int, default 0
1044
+ Number of minutes to wait prior to timing out.
1045
+ hours : int, default 0
1046
+ Number of hours to wait prior to timing out.
1047
+ """
1048
+ ...
1049
+
1050
+ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1051
+ """
1052
+ Specifies that this step should execute on Kubernetes.
1053
+
1054
+ Parameters
1055
+ ----------
1056
+ cpu : int, default 1
1057
+ Number of CPUs required for this step. If `@resources` is
1058
+ also present, the maximum value from all decorators is used.
1059
+ memory : int, default 4096
1060
+ Memory size (in MB) required for this step. If
1061
+ `@resources` is also present, the maximum value from all decorators is
1062
+ used.
1063
+ disk : int, default 10240
1064
+ Disk size (in MB) required for this step. If
1065
+ `@resources` is also present, the maximum value from all decorators is
1066
+ used.
1067
+ image : str, optional, default None
1068
+ Docker image to use when launching on Kubernetes. If not specified, and
1069
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
1070
+ not, a default Docker image mapping to the current version of Python is used.
1071
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
1072
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
1073
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
1074
+ Kubernetes service account to use when launching pod in Kubernetes.
1075
+ secrets : List[str], optional, default None
1076
+ Kubernetes secrets to use when launching pod in Kubernetes. These
1077
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
1078
+ in Metaflow configuration.
1079
+ node_selector: Union[Dict[str,str], str], optional, default None
1080
+ Kubernetes node selector(s) to apply to the pod running the task.
1081
+ Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
1082
+ or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
1083
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
1084
+ Kubernetes namespace to use when launching pod in Kubernetes.
1085
+ gpu : int, optional, default None
1086
+ Number of GPUs required for this step. A value of zero implies that
1087
+ the scheduled node should not have GPUs.
1088
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
1089
+ The vendor of the GPUs to be used for this step.
1090
+ tolerations : List[str], default []
1091
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
1092
+ Kubernetes tolerations to use when launching pod in Kubernetes.
1093
+ use_tmpfs : bool, default False
1094
+ This enables an explicit tmpfs mount for this step.
1095
+ tmpfs_tempdir : bool, default True
1096
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1097
+ tmpfs_size : int, optional, default: None
1098
+ The value for the size (in MiB) of the tmpfs mount for this step.
1099
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1100
+ memory allocated for this step.
1101
+ tmpfs_path : str, optional, default /metaflow_temp
1102
+ Path to tmpfs mount for this step.
1103
+ persistent_volume_claims : Dict[str, str], optional, default None
1104
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
1105
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
1106
+ shared_memory: int, optional
1107
+ Shared memory size (in MiB) required for this step
1108
+ port: int, optional
1109
+ Port number to specify in the Kubernetes job object
1110
+ compute_pool : str, optional, default None
1111
+ Compute pool to be used for for this step.
1112
+ If not specified, any accessible compute pool within the perimeter is used.
1002
1113
  """
1003
1114
  ...
1004
1115
 
@@ -1060,84 +1171,6 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
1060
1171
 
1061
1172
 
1062
1173
 
1063
- """
1064
- ...
1065
-
1066
- @typing.overload
1067
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1068
- """
1069
- Internal decorator to support Fast bakery
1070
- """
1071
- ...
1072
-
1073
- @typing.overload
1074
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1075
- ...
1076
-
1077
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1078
- """
1079
- Internal decorator to support Fast bakery
1080
- """
1081
- ...
1082
-
1083
- @typing.overload
1084
- 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]]]:
1085
- """
1086
- Enables loading / saving of models within a step.
1087
-
1088
-
1089
- Parameters
1090
- ----------
1091
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
1092
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
1093
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
1094
- - `current.checkpoint`
1095
- - `current.model`
1096
- - `current.huggingface_hub`
1097
-
1098
- 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
1099
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
1100
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
1101
-
1102
- temp_dir_root : str, default: None
1103
- The root directory under which `current.model.loaded` will store loaded models
1104
-
1105
-
1106
-
1107
- """
1108
- ...
1109
-
1110
- @typing.overload
1111
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1112
- ...
1113
-
1114
- @typing.overload
1115
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1116
- ...
1117
-
1118
- 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):
1119
- """
1120
- Enables loading / saving of models within a step.
1121
-
1122
-
1123
- Parameters
1124
- ----------
1125
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
1126
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
1127
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
1128
- - `current.checkpoint`
1129
- - `current.model`
1130
- - `current.huggingface_hub`
1131
-
1132
- 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
1133
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
1134
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
1135
-
1136
- temp_dir_root : str, default: None
1137
- The root directory under which `current.model.loaded` will store loaded models
1138
-
1139
-
1140
-
1141
1174
  """
1142
1175
  ...
1143
1176
 
@@ -1160,141 +1193,10 @@ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
1160
1193
  """
1161
1194
  ...
1162
1195
 
1163
- @typing.overload
1164
- 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]]]:
1165
- """
1166
- Specifies secrets to be retrieved and injected as environment variables prior to
1167
- the execution of a step.
1168
-
1169
- Parameters
1170
- ----------
1171
- sources : List[Union[str, Dict[str, Any]]], default: []
1172
- List of secret specs, defining how the secrets are to be retrieved
1173
- """
1174
- ...
1175
-
1176
- @typing.overload
1177
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1178
- ...
1179
-
1180
- @typing.overload
1181
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1182
- ...
1183
-
1184
- 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]]] = []):
1185
- """
1186
- Specifies secrets to be retrieved and injected as environment variables prior to
1187
- the execution of a step.
1188
-
1189
- Parameters
1190
- ----------
1191
- sources : List[Union[str, Dict[str, Any]]], default: []
1192
- List of secret specs, defining how the secrets are to be retrieved
1193
- """
1194
- ...
1195
-
1196
- @typing.overload
1197
- 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]]:
1198
- """
1199
- Specifies the event(s) that this flow depends on.
1200
-
1201
- ```
1202
- @trigger(event='foo')
1203
- ```
1204
- or
1205
- ```
1206
- @trigger(events=['foo', 'bar'])
1207
- ```
1208
-
1209
- Additionally, you can specify the parameter mappings
1210
- to map event payload to Metaflow parameters for the flow.
1211
- ```
1212
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1213
- ```
1214
- or
1215
- ```
1216
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1217
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1218
- ```
1219
-
1220
- 'parameters' can also be a list of strings and tuples like so:
1221
- ```
1222
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1223
- ```
1224
- This is equivalent to:
1225
- ```
1226
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1227
- ```
1228
-
1229
- Parameters
1230
- ----------
1231
- event : Union[str, Dict[str, Any]], optional, default None
1232
- Event dependency for this flow.
1233
- events : List[Union[str, Dict[str, Any]]], default []
1234
- Events dependency for this flow.
1235
- options : Dict[str, Any], default {}
1236
- Backend-specific configuration for tuning eventing behavior.
1237
-
1238
-
1239
- """
1240
- ...
1241
-
1242
- @typing.overload
1243
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1244
- ...
1245
-
1246
- 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] = {}):
1247
- """
1248
- Specifies the event(s) that this flow depends on.
1249
-
1250
- ```
1251
- @trigger(event='foo')
1252
- ```
1253
- or
1254
- ```
1255
- @trigger(events=['foo', 'bar'])
1256
- ```
1257
-
1258
- Additionally, you can specify the parameter mappings
1259
- to map event payload to Metaflow parameters for the flow.
1260
- ```
1261
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1262
- ```
1263
- or
1264
- ```
1265
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1266
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1267
- ```
1268
-
1269
- 'parameters' can also be a list of strings and tuples like so:
1270
- ```
1271
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1272
- ```
1273
- This is equivalent to:
1274
- ```
1275
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1276
- ```
1277
-
1278
- Parameters
1279
- ----------
1280
- event : Union[str, Dict[str, Any]], optional, default None
1281
- Event dependency for this flow.
1282
- events : List[Union[str, Dict[str, Any]]], default []
1283
- Events dependency for this flow.
1284
- options : Dict[str, Any], default {}
1285
- Backend-specific configuration for tuning eventing behavior.
1286
-
1287
-
1288
- """
1289
- ...
1290
-
1291
- 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]]:
1196
+ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1292
1197
  """
1293
- 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)
1294
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1295
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1296
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1297
- starts only after all sensors finish.
1198
+ The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1199
+ This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
1298
1200
 
1299
1201
  Parameters
1300
1202
  ----------
@@ -1315,49 +1217,21 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1315
1217
  Name of the sensor on Airflow
1316
1218
  description : str
1317
1219
  Description of sensor in the Airflow UI
1318
- bucket_key : Union[str, List[str]]
1319
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1320
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1321
- bucket_name : str
1322
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1323
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1324
- wildcard_match : bool
1325
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1326
- aws_conn_id : str
1327
- a reference to the s3 connection on Airflow. (Default: None)
1328
- verify : bool
1329
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1330
- """
1331
- ...
1332
-
1333
- def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1334
- """
1335
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1336
-
1337
- User code call
1338
- -----------
1339
- @nim(
1340
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1341
- backend='managed'
1342
- )
1343
-
1344
- Valid backend options
1345
- ---------------------
1346
- - 'managed': Outerbounds selects a compute provider based on the model.
1347
- - 🚧 'dataplane': Run in your account.
1348
-
1349
- Valid model options
1350
- ----------------
1351
- - 'meta/llama3-8b-instruct': 8B parameter model
1352
- - 'meta/llama3-70b-instruct': 70B parameter model
1353
- - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1354
-
1355
- Parameters
1356
- ----------
1357
- models: list[NIM]
1358
- List of NIM containers running models in sidecars.
1359
- backend: str
1360
- Compute provider to run the NIM container.
1220
+ external_dag_id : str
1221
+ The dag_id that contains the task you want to wait for.
1222
+ external_task_ids : List[str]
1223
+ The list of task_ids that you want to wait for.
1224
+ If None (default value) the sensor waits for the DAG. (Default: None)
1225
+ allowed_states : List[str]
1226
+ Iterable of allowed states, (Default: ['success'])
1227
+ failed_states : List[str]
1228
+ Iterable of failed or dis-allowed states. (Default: None)
1229
+ execution_delta : datetime.timedelta
1230
+ time difference with the previous execution to look at,
1231
+ the default is the same logical date as the current task or DAG. (Default: None)
1232
+ check_existence: bool
1233
+ Set to True to check if the external task exists or check if
1234
+ the DAG to wait for exists. (Default: True)
1361
1235
  """
1362
1236
  ...
1363
1237
 
@@ -1379,6 +1253,55 @@ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typ
1379
1253
  """
1380
1254
  ...
1381
1255
 
1256
+ @typing.overload
1257
+ def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1258
+ """
1259
+ Specifies the times when the flow should be run when running on a
1260
+ production scheduler.
1261
+
1262
+ Parameters
1263
+ ----------
1264
+ hourly : bool, default False
1265
+ Run the workflow hourly.
1266
+ daily : bool, default True
1267
+ Run the workflow daily.
1268
+ weekly : bool, default False
1269
+ Run the workflow weekly.
1270
+ cron : str, optional, default None
1271
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1272
+ specified by this expression.
1273
+ timezone : str, optional, default None
1274
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1275
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1276
+ """
1277
+ ...
1278
+
1279
+ @typing.overload
1280
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1281
+ ...
1282
+
1283
+ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1284
+ """
1285
+ Specifies the times when the flow should be run when running on a
1286
+ production scheduler.
1287
+
1288
+ Parameters
1289
+ ----------
1290
+ hourly : bool, default False
1291
+ Run the workflow hourly.
1292
+ daily : bool, default True
1293
+ Run the workflow daily.
1294
+ weekly : bool, default False
1295
+ Run the workflow weekly.
1296
+ cron : str, optional, default None
1297
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1298
+ specified by this expression.
1299
+ timezone : str, optional, default None
1300
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1301
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1302
+ """
1303
+ ...
1304
+
1382
1305
  @typing.overload
1383
1306
  def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1384
1307
  """
@@ -1428,45 +1351,34 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1428
1351
  """
1429
1352
  ...
1430
1353
 
1431
- 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]]:
1354
+ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1432
1355
  """
1433
- 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.
1434
- 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.
1356
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1357
+
1358
+ User code call
1359
+ -----------
1360
+ @nim(
1361
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1362
+ backend='managed'
1363
+ )
1364
+
1365
+ Valid backend options
1366
+ ---------------------
1367
+ - 'managed': Outerbounds selects a compute provider based on the model.
1368
+ - 🚧 'dataplane': Run in your account.
1369
+
1370
+ Valid model options
1371
+ ----------------
1372
+ - 'meta/llama3-8b-instruct': 8B parameter model
1373
+ - 'meta/llama3-70b-instruct': 70B parameter model
1374
+ - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1435
1375
 
1436
1376
  Parameters
1437
1377
  ----------
1438
- timeout : int
1439
- Time, in seconds before the task times out and fails. (Default: 3600)
1440
- poke_interval : int
1441
- Time in seconds that the job should wait in between each try. (Default: 60)
1442
- mode : str
1443
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1444
- exponential_backoff : bool
1445
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1446
- pool : str
1447
- the slot pool this task should run in,
1448
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1449
- soft_fail : bool
1450
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1451
- name : str
1452
- Name of the sensor on Airflow
1453
- description : str
1454
- Description of sensor in the Airflow UI
1455
- external_dag_id : str
1456
- The dag_id that contains the task you want to wait for.
1457
- external_task_ids : List[str]
1458
- The list of task_ids that you want to wait for.
1459
- If None (default value) the sensor waits for the DAG. (Default: None)
1460
- allowed_states : List[str]
1461
- Iterable of allowed states, (Default: ['success'])
1462
- failed_states : List[str]
1463
- Iterable of failed or dis-allowed states. (Default: None)
1464
- execution_delta : datetime.timedelta
1465
- time difference with the previous execution to look at,
1466
- the default is the same logical date as the current task or DAG. (Default: None)
1467
- check_existence: bool
1468
- Set to True to check if the external task exists or check if
1469
- the DAG to wait for exists. (Default: True)
1378
+ models: list[NIM]
1379
+ List of NIM containers running models in sidecars.
1380
+ backend: str
1381
+ Compute provider to run the NIM container.
1470
1382
  """
1471
1383
  ...
1472
1384
 
@@ -1573,55 +1485,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1573
1485
  """
1574
1486
  ...
1575
1487
 
1576
- @typing.overload
1577
- 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]]:
1578
- """
1579
- Specifies the times when the flow should be run when running on a
1580
- production scheduler.
1581
-
1582
- Parameters
1583
- ----------
1584
- hourly : bool, default False
1585
- Run the workflow hourly.
1586
- daily : bool, default True
1587
- Run the workflow daily.
1588
- weekly : bool, default False
1589
- Run the workflow weekly.
1590
- cron : str, optional, default None
1591
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1592
- specified by this expression.
1593
- timezone : str, optional, default None
1594
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1595
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1596
- """
1597
- ...
1598
-
1599
- @typing.overload
1600
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1601
- ...
1602
-
1603
- 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):
1604
- """
1605
- Specifies the times when the flow should be run when running on a
1606
- production scheduler.
1607
-
1608
- Parameters
1609
- ----------
1610
- hourly : bool, default False
1611
- Run the workflow hourly.
1612
- daily : bool, default True
1613
- Run the workflow daily.
1614
- weekly : bool, default False
1615
- Run the workflow weekly.
1616
- cron : str, optional, default None
1617
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1618
- specified by this expression.
1619
- timezone : str, optional, default None
1620
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1621
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1622
- """
1623
- ...
1624
-
1625
1488
  @typing.overload
1626
1489
  def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1627
1490
  """
@@ -1661,6 +1524,143 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
1661
1524
  """
1662
1525
  ...
1663
1526
 
1527
+ @typing.overload
1528
+ 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]]:
1529
+ """
1530
+ Specifies the event(s) that this flow depends on.
1531
+
1532
+ ```
1533
+ @trigger(event='foo')
1534
+ ```
1535
+ or
1536
+ ```
1537
+ @trigger(events=['foo', 'bar'])
1538
+ ```
1539
+
1540
+ Additionally, you can specify the parameter mappings
1541
+ to map event payload to Metaflow parameters for the flow.
1542
+ ```
1543
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1544
+ ```
1545
+ or
1546
+ ```
1547
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1548
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1549
+ ```
1550
+
1551
+ 'parameters' can also be a list of strings and tuples like so:
1552
+ ```
1553
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1554
+ ```
1555
+ This is equivalent to:
1556
+ ```
1557
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1558
+ ```
1559
+
1560
+ Parameters
1561
+ ----------
1562
+ event : Union[str, Dict[str, Any]], optional, default None
1563
+ Event dependency for this flow.
1564
+ events : List[Union[str, Dict[str, Any]]], default []
1565
+ Events dependency for this flow.
1566
+ options : Dict[str, Any], default {}
1567
+ Backend-specific configuration for tuning eventing behavior.
1568
+
1569
+
1570
+ """
1571
+ ...
1572
+
1573
+ @typing.overload
1574
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1575
+ ...
1576
+
1577
+ 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] = {}):
1578
+ """
1579
+ Specifies the event(s) that this flow depends on.
1580
+
1581
+ ```
1582
+ @trigger(event='foo')
1583
+ ```
1584
+ or
1585
+ ```
1586
+ @trigger(events=['foo', 'bar'])
1587
+ ```
1588
+
1589
+ Additionally, you can specify the parameter mappings
1590
+ to map event payload to Metaflow parameters for the flow.
1591
+ ```
1592
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1593
+ ```
1594
+ or
1595
+ ```
1596
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1597
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1598
+ ```
1599
+
1600
+ 'parameters' can also be a list of strings and tuples like so:
1601
+ ```
1602
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1603
+ ```
1604
+ This is equivalent to:
1605
+ ```
1606
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1607
+ ```
1608
+
1609
+ Parameters
1610
+ ----------
1611
+ event : Union[str, Dict[str, Any]], optional, default None
1612
+ Event dependency for this flow.
1613
+ events : List[Union[str, Dict[str, Any]]], default []
1614
+ Events dependency for this flow.
1615
+ options : Dict[str, Any], default {}
1616
+ Backend-specific configuration for tuning eventing behavior.
1617
+
1618
+
1619
+ """
1620
+ ...
1621
+
1622
+ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1623
+ """
1624
+ The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
1625
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1626
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1627
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1628
+ starts only after all sensors finish.
1629
+
1630
+ Parameters
1631
+ ----------
1632
+ timeout : int
1633
+ Time, in seconds before the task times out and fails. (Default: 3600)
1634
+ poke_interval : int
1635
+ Time in seconds that the job should wait in between each try. (Default: 60)
1636
+ mode : str
1637
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1638
+ exponential_backoff : bool
1639
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1640
+ pool : str
1641
+ the slot pool this task should run in,
1642
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1643
+ soft_fail : bool
1644
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1645
+ name : str
1646
+ Name of the sensor on Airflow
1647
+ description : str
1648
+ Description of sensor in the Airflow UI
1649
+ bucket_key : Union[str, List[str]]
1650
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1651
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1652
+ bucket_name : str
1653
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1654
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1655
+ wildcard_match : bool
1656
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1657
+ aws_conn_id : str
1658
+ a reference to the s3 connection on Airflow. (Default: None)
1659
+ verify : bool
1660
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1661
+ """
1662
+ ...
1663
+
1664
1664
  def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
1665
1665
  """
1666
1666
  Switch namespace to the one provided.