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