ob-metaflow-stubs 5.9.1__py2.py3-none-any.whl → 6.0.3.102__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. metaflow-stubs/__init__.pyi +819 -625
  2. metaflow-stubs/cards.pyi +3 -3
  3. metaflow-stubs/cli.pyi +3 -3
  4. metaflow-stubs/client/__init__.pyi +3 -3
  5. metaflow-stubs/client/core.pyi +6 -6
  6. metaflow-stubs/client/filecache.pyi +3 -3
  7. metaflow-stubs/clone_util.pyi +2 -2
  8. metaflow-stubs/events.pyi +3 -3
  9. metaflow-stubs/exception.pyi +2 -2
  10. metaflow-stubs/flowspec.pyi +5 -5
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +4 -4
  13. metaflow-stubs/info_file.pyi +16 -0
  14. metaflow-stubs/metadata/metadata.pyi +3 -3
  15. metaflow-stubs/metadata/util.pyi +2 -2
  16. metaflow-stubs/metaflow_config.pyi +2 -2
  17. metaflow-stubs/metaflow_current.pyi +142 -18
  18. metaflow-stubs/mflog/mflog.pyi +2 -2
  19. metaflow-stubs/multicore_utils.pyi +2 -2
  20. metaflow-stubs/parameters.pyi +4 -4
  21. metaflow-stubs/plugins/__init__.pyi +2 -2
  22. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  23. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  24. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
  27. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
  28. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
  29. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  30. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  31. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  32. metaflow-stubs/plugins/argo/argo_workflows.pyi +5 -5
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +7 -7
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +6 -6
  35. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  36. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  37. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  38. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  39. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  40. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  41. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +4 -4
  43. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  44. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  45. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  46. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  47. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
  48. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
  52. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  53. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  54. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  55. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  56. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  57. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  58. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  59. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  60. metaflow-stubs/plugins/cards/card_cli.pyi +5 -5
  61. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  62. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  63. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  64. metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
  65. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  67. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  69. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  71. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  73. metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
  74. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  75. metaflow-stubs/plugins/catch_decorator.pyi +4 -4
  76. metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
  77. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  79. metaflow-stubs/plugins/datatools/s3/s3.pyi +6 -6
  80. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  81. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  82. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  83. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  84. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  85. metaflow-stubs/plugins/events_decorator.pyi +3 -3
  86. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  87. metaflow-stubs/plugins/frameworks/pytorch.pyi +4 -4
  88. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  89. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  90. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  91. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  92. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  93. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  94. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  95. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  96. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +3 -3
  97. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +4 -4
  98. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  99. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +4 -4
  100. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  101. metaflow-stubs/plugins/logs_cli.pyi +3 -3
  102. metaflow-stubs/plugins/package_cli.pyi +2 -2
  103. metaflow-stubs/plugins/parallel_decorator.pyi +3 -3
  104. metaflow-stubs/plugins/perimeters.pyi +2 -2
  105. metaflow-stubs/plugins/project_decorator.pyi +3 -3
  106. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  107. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  108. metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
  109. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  110. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  111. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  112. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  113. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  114. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  115. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  116. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  117. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  118. metaflow-stubs/plugins/tag_cli.pyi +5 -5
  119. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  120. metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
  121. metaflow-stubs/procpoll.pyi +2 -2
  122. metaflow-stubs/profilers/__init__.pyi +2 -2
  123. metaflow-stubs/pylint_wrapper.pyi +2 -2
  124. metaflow-stubs/runner/__init__.pyi +2 -2
  125. metaflow-stubs/runner/deployer.pyi +3 -3
  126. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  127. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  128. metaflow-stubs/runner/nbrun.pyi +2 -2
  129. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  130. metaflow-stubs/runner/utils.pyi +2 -2
  131. metaflow-stubs/system/__init__.pyi +3 -3
  132. metaflow-stubs/system/system_logger.pyi +2 -2
  133. metaflow-stubs/system/system_monitor.pyi +3 -3
  134. metaflow-stubs/tagging_util.pyi +2 -2
  135. metaflow-stubs/tuple_util.pyi +2 -2
  136. {ob_metaflow_stubs-5.9.1.dist-info → ob_metaflow_stubs-6.0.3.102.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.102.dist-info/RECORD +140 -0
  138. {ob_metaflow_stubs-5.9.1.dist-info → ob_metaflow_stubs-6.0.3.102.dist-info}/WHEEL +1 -1
  139. ob_metaflow_stubs-5.9.1.dist-info/RECORD +0 -139
  140. {ob_metaflow_stubs-5.9.1.dist-info → ob_metaflow_stubs-6.0.3.102.dist-info}/top_level.txt +0 -0
@@ -1,30 +1,27 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.20.1+ob(v1) #
4
- # Generated on 2024-09-16T18:41:26.221357 #
3
+ # MF version: 2.12.22.1+obcheckpoint(0.0.10);ob(v1) #
4
+ # Generated on 2024-09-20T19:48:37.143465 #
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.client.core
13
- import metaflow.runner.metaflow_runner
11
+ import metaflow.datastore.inputs
12
+ import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
14
13
  import datetime
15
- import metaflow.events
16
- import metaflow.metaflow_current
14
+ import metaflow.parameters
17
15
  import typing
16
+ import metaflow.runner.metaflow_runner
17
+ import metaflow.client.core
18
18
  import metaflow.flowspec
19
- import metaflow.parameters
20
- import metaflow.datastore.inputs
19
+ import metaflow.metaflow_current
20
+ import metaflow.events
21
+ import metaflow._vendor.click.types
21
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
22
23
  StepFlag = typing.NewType("StepFlag", bool)
23
24
 
24
- CURRENT_DIRECTORY: str
25
-
26
- INFO_FILE: str
27
-
28
25
  EXT_PKG: str
29
26
 
30
27
  def parallel_imap_unordered(func: typing.Callable[[typing.Any], typing.Any], iterable: typing.Iterable[typing.Any], max_parallel: typing.Optional[int] = None, dir: typing.Optional[str] = None) -> typing.Iterator[typing.Any]:
@@ -438,143 +435,112 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
438
435
  ...
439
436
 
440
437
  @typing.overload
441
- 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]]]:
438
+ 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]]]:
442
439
  """
443
- Specifies the resources needed when executing this step.
444
-
445
- Use `@resources` to specify the resource requirements
446
- independently of the specific compute layer (`@batch`, `@kubernetes`).
440
+ Specifies the PyPI packages for the step.
447
441
 
448
- You can choose the compute layer on the command line by executing e.g.
449
- ```
450
- python myflow.py run --with batch
451
- ```
452
- or
453
- ```
454
- python myflow.py run --with kubernetes
455
- ```
456
- which executes the flow on the desired system using the
457
- requirements specified in `@resources`.
442
+ Information in this decorator will augment any
443
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
444
+ you can use `@pypi_base` to set packages required by all
445
+ steps and use `@pypi` to specify step-specific overrides.
458
446
 
459
447
  Parameters
460
448
  ----------
461
- cpu : int, default 1
462
- Number of CPUs required for this step.
463
- gpu : int, default 0
464
- Number of GPUs required for this step.
465
- disk : int, optional, default None
466
- Disk size (in MB) required for this step. Only applies on Kubernetes.
467
- memory : int, default 4096
468
- Memory size (in MB) required for this step.
469
- shared_memory : int, optional, default None
470
- The value for the size (in MiB) of the /dev/shm volume for this step.
471
- This parameter maps to the `--shm-size` option in Docker.
449
+ packages : Dict[str, str], default: {}
450
+ Packages to use for this step. The key is the name of the package
451
+ and the value is the version to use.
452
+ python : str, optional, default: None
453
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
454
+ that the version used will correspond to the version of the Python interpreter used to start the run.
472
455
  """
473
456
  ...
474
457
 
475
458
  @typing.overload
476
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
459
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
477
460
  ...
478
461
 
479
462
  @typing.overload
480
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
463
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
481
464
  ...
482
465
 
483
- 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):
466
+ 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):
484
467
  """
485
- Specifies the resources needed when executing this step.
486
-
487
- Use `@resources` to specify the resource requirements
488
- independently of the specific compute layer (`@batch`, `@kubernetes`).
468
+ Specifies the PyPI packages for the step.
489
469
 
490
- You can choose the compute layer on the command line by executing e.g.
491
- ```
492
- python myflow.py run --with batch
493
- ```
494
- or
495
- ```
496
- python myflow.py run --with kubernetes
497
- ```
498
- which executes the flow on the desired system using the
499
- requirements specified in `@resources`.
470
+ Information in this decorator will augment any
471
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
472
+ you can use `@pypi_base` to set packages required by all
473
+ steps and use `@pypi` to specify step-specific overrides.
500
474
 
501
475
  Parameters
502
476
  ----------
503
- cpu : int, default 1
504
- Number of CPUs required for this step.
505
- gpu : int, default 0
506
- Number of GPUs required for this step.
507
- disk : int, optional, default None
508
- Disk size (in MB) required for this step. Only applies on Kubernetes.
509
- memory : int, default 4096
510
- Memory size (in MB) required for this step.
511
- shared_memory : int, optional, default None
512
- The value for the size (in MiB) of the /dev/shm volume for this step.
513
- This parameter maps to the `--shm-size` option in Docker.
477
+ packages : Dict[str, str], default: {}
478
+ Packages to use for this step. The key is the name of the package
479
+ and the value is the version to use.
480
+ python : str, optional, default: None
481
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
482
+ that the version used will correspond to the version of the Python interpreter used to start the run.
514
483
  """
515
484
  ...
516
485
 
517
486
  @typing.overload
518
- 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]]]:
487
+ 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]]]:
519
488
  """
520
- Specifies environment variables to be set prior to the execution of a step.
489
+ Enables checkpointing for a step.
521
490
 
522
- Parameters
523
- ----------
524
- vars : Dict[str, str], default {}
525
- Dictionary of environment variables to set.
526
- """
527
- ...
528
-
529
- @typing.overload
530
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
531
- ...
532
-
533
- @typing.overload
534
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
535
- ...
536
-
537
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
538
- """
539
- Specifies environment variables to be set prior to the execution of a step.
540
491
 
541
492
  Parameters
542
493
  ----------
543
- vars : Dict[str, str], default {}
544
- Dictionary of environment variables to set.
545
- """
546
- ...
547
-
548
- @typing.overload
549
- 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]]]:
550
- """
551
- Specifies secrets to be retrieved and injected as environment variables prior to
552
- the execution of a step.
494
+ load_policy : str, default: "fresh"
495
+ The policy for loading the checkpoint. The following policies are supported:
496
+ - "eager": Loads the the latest available checkpoint within the namespace.
497
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
498
+ will be loaded at the start of the task.
499
+ - "none": Do not load any checkpoint
500
+ - "fresh": Loads the lastest checkpoint created within the running Task.
501
+ This mode helps loading checkpoints across various retry attempts of the same task.
502
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
503
+ created within the task will be loaded when the task is retries execution on failure.
504
+
505
+ temp_dir_root : str, default: None
506
+ The root directory under which `current.checkpoint.directory` will be created.
507
+
508
+
553
509
 
554
- Parameters
555
- ----------
556
- sources : List[Union[str, Dict[str, Any]]], default: []
557
- List of secret specs, defining how the secrets are to be retrieved
558
510
  """
559
511
  ...
560
512
 
561
513
  @typing.overload
562
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
514
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
563
515
  ...
564
516
 
565
517
  @typing.overload
566
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
518
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
567
519
  ...
568
520
 
569
- 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]]] = []):
521
+ 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):
570
522
  """
571
- Specifies secrets to be retrieved and injected as environment variables prior to
572
- the execution of a step.
523
+ Enables checkpointing for a step.
524
+
573
525
 
574
526
  Parameters
575
527
  ----------
576
- sources : List[Union[str, Dict[str, Any]]], default: []
577
- List of secret specs, defining how the secrets are to be retrieved
528
+ load_policy : str, default: "fresh"
529
+ The policy for loading the checkpoint. The following policies are supported:
530
+ - "eager": Loads the the latest available checkpoint within the namespace.
531
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
532
+ will be loaded at the start of the task.
533
+ - "none": Do not load any checkpoint
534
+ - "fresh": Loads the lastest checkpoint created within the running Task.
535
+ This mode helps loading checkpoints across various retry attempts of the same task.
536
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
537
+ created within the task will be loaded when the task is retries execution on failure.
538
+
539
+ temp_dir_root : str, default: None
540
+ The root directory under which `current.checkpoint.directory` will be created.
541
+
542
+
543
+
578
544
  """
579
545
  ...
580
546
 
@@ -635,169 +601,206 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
635
601
  """
636
602
  ...
637
603
 
638
- @typing.overload
639
- def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
604
+ 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]]]:
640
605
  """
641
- Specifies that the step will success under all circumstances.
606
+ Specifies that this step should execute on Kubernetes.
642
607
 
643
- The decorator will create an optional artifact, specified by `var`, which
644
- contains the exception raised. You can use it to detect the presence
645
- of errors, indicating that all happy-path artifacts produced by the step
646
- are missing.
608
+ Parameters
609
+ ----------
610
+ cpu : int, default 1
611
+ Number of CPUs required for this step. If `@resources` is
612
+ also present, the maximum value from all decorators is used.
613
+ memory : int, default 4096
614
+ Memory size (in MB) required for this step. If
615
+ `@resources` is also present, the maximum value from all decorators is
616
+ used.
617
+ disk : int, default 10240
618
+ Disk size (in MB) required for this step. If
619
+ `@resources` is also present, the maximum value from all decorators is
620
+ used.
621
+ image : str, optional, default None
622
+ Docker image to use when launching on Kubernetes. If not specified, and
623
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
624
+ not, a default Docker image mapping to the current version of Python is used.
625
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
626
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
627
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
628
+ Kubernetes service account to use when launching pod in Kubernetes.
629
+ secrets : List[str], optional, default None
630
+ Kubernetes secrets to use when launching pod in Kubernetes. These
631
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
632
+ in Metaflow configuration.
633
+ node_selector: Union[Dict[str,str], str], optional, default None
634
+ Kubernetes node selector(s) to apply to the pod running the task.
635
+ Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
636
+ or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
637
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
638
+ Kubernetes namespace to use when launching pod in Kubernetes.
639
+ gpu : int, optional, default None
640
+ Number of GPUs required for this step. A value of zero implies that
641
+ the scheduled node should not have GPUs.
642
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
643
+ The vendor of the GPUs to be used for this step.
644
+ tolerations : List[str], default []
645
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
646
+ Kubernetes tolerations to use when launching pod in Kubernetes.
647
+ use_tmpfs : bool, default False
648
+ This enables an explicit tmpfs mount for this step.
649
+ tmpfs_tempdir : bool, default True
650
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
651
+ tmpfs_size : int, optional, default: None
652
+ The value for the size (in MiB) of the tmpfs mount for this step.
653
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
654
+ memory allocated for this step.
655
+ tmpfs_path : str, optional, default /metaflow_temp
656
+ Path to tmpfs mount for this step.
657
+ persistent_volume_claims : Dict[str, str], optional, default None
658
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
659
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
660
+ shared_memory: int, optional
661
+ Shared memory size (in MiB) required for this step
662
+ port: int, optional
663
+ Port number to specify in the Kubernetes job object
664
+ compute_pool : str, optional, default None
665
+ Compute pool to be used for for this step.
666
+ If not specified, any accessible compute pool within the perimeter is used.
667
+ """
668
+ ...
669
+
670
+ @typing.overload
671
+ 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]]]:
672
+ """
673
+ Specifies environment variables to be set prior to the execution of a step.
647
674
 
648
675
  Parameters
649
676
  ----------
650
- var : str, optional, default None
651
- Name of the artifact in which to store the caught exception.
652
- If not specified, the exception is not stored.
653
- print_exception : bool, default True
654
- Determines whether or not the exception is printed to
655
- stdout when caught.
677
+ vars : Dict[str, str], default {}
678
+ Dictionary of environment variables to set.
656
679
  """
657
680
  ...
658
681
 
659
682
  @typing.overload
660
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
683
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
661
684
  ...
662
685
 
663
686
  @typing.overload
664
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
687
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
665
688
  ...
666
689
 
667
- 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):
690
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
668
691
  """
669
- Specifies that the step will success under all circumstances.
670
-
671
- The decorator will create an optional artifact, specified by `var`, which
672
- contains the exception raised. You can use it to detect the presence
673
- of errors, indicating that all happy-path artifacts produced by the step
674
- are missing.
692
+ Specifies environment variables to be set prior to the execution of a step.
675
693
 
676
694
  Parameters
677
695
  ----------
678
- var : str, optional, default None
679
- Name of the artifact in which to store the caught exception.
680
- If not specified, the exception is not stored.
681
- print_exception : bool, default True
682
- Determines whether or not the exception is printed to
683
- stdout when caught.
696
+ vars : Dict[str, str], default {}
697
+ Dictionary of environment variables to set.
684
698
  """
685
699
  ...
686
700
 
687
701
  @typing.overload
688
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
689
- """
690
- Internal decorator to support Fast bakery
702
+ 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]]]:
691
703
  """
692
- ...
693
-
694
- @typing.overload
695
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
696
- ...
697
-
698
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
699
- """
700
- Internal decorator to support Fast bakery
701
- """
702
- ...
703
-
704
- @typing.overload
705
- 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]]]:
706
- """
707
- Creates a human-readable report, a Metaflow Card, after this step completes.
704
+ Specifies a timeout for your step.
708
705
 
709
- Note that you may add multiple `@card` decorators in a step with different parameters.
706
+ This decorator is useful if this step may hang indefinitely.
710
707
 
711
- Parameters
712
- ----------
713
- type : str, default 'default'
714
- Card type.
715
- id : str, optional, default None
716
- If multiple cards are present, use this id to identify this card.
717
- options : Dict[str, Any], default {}
718
- Options passed to the card. The contents depend on the card type.
719
- timeout : int, default 45
720
- Interrupt reporting if it takes more than this many seconds.
708
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
709
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
710
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
721
711
 
712
+ Note that all the values specified in parameters are added together so if you specify
713
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
722
714
 
715
+ Parameters
716
+ ----------
717
+ seconds : int, default 0
718
+ Number of seconds to wait prior to timing out.
719
+ minutes : int, default 0
720
+ Number of minutes to wait prior to timing out.
721
+ hours : int, default 0
722
+ Number of hours to wait prior to timing out.
723
723
  """
724
724
  ...
725
725
 
726
726
  @typing.overload
727
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
727
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
728
728
  ...
729
729
 
730
730
  @typing.overload
731
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
731
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
732
732
  ...
733
733
 
734
- 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):
734
+ 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):
735
735
  """
736
- Creates a human-readable report, a Metaflow Card, after this step completes.
736
+ Specifies a timeout for your step.
737
737
 
738
- Note that you may add multiple `@card` decorators in a step with different parameters.
738
+ This decorator is useful if this step may hang indefinitely.
739
739
 
740
- Parameters
741
- ----------
742
- type : str, default 'default'
743
- Card type.
744
- id : str, optional, default None
745
- If multiple cards are present, use this id to identify this card.
746
- options : Dict[str, Any], default {}
747
- Options passed to the card. The contents depend on the card type.
748
- timeout : int, default 45
749
- Interrupt reporting if it takes more than this many seconds.
740
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
741
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
742
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
750
743
 
744
+ Note that all the values specified in parameters are added together so if you specify
745
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
751
746
 
747
+ Parameters
748
+ ----------
749
+ seconds : int, default 0
750
+ Number of seconds to wait prior to timing out.
751
+ minutes : int, default 0
752
+ Number of minutes to wait prior to timing out.
753
+ hours : int, default 0
754
+ Number of hours to wait prior to timing out.
752
755
  """
753
756
  ...
754
757
 
755
758
  @typing.overload
756
- 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]]]:
759
+ 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]]]:
757
760
  """
758
- Specifies the PyPI packages for the step.
761
+ Specifies that the step will success under all circumstances.
759
762
 
760
- Information in this decorator will augment any
761
- attributes set in the `@pyi_base` flow-level decorator. Hence,
762
- you can use `@pypi_base` to set packages required by all
763
- steps and use `@pypi` to specify step-specific overrides.
763
+ The decorator will create an optional artifact, specified by `var`, which
764
+ contains the exception raised. You can use it to detect the presence
765
+ of errors, indicating that all happy-path artifacts produced by the step
766
+ are missing.
764
767
 
765
768
  Parameters
766
769
  ----------
767
- packages : Dict[str, str], default: {}
768
- Packages to use for this step. The key is the name of the package
769
- and the value is the version to use.
770
- python : str, optional, default: None
771
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
772
- that the version used will correspond to the version of the Python interpreter used to start the run.
770
+ var : str, optional, default None
771
+ Name of the artifact in which to store the caught exception.
772
+ If not specified, the exception is not stored.
773
+ print_exception : bool, default True
774
+ Determines whether or not the exception is printed to
775
+ stdout when caught.
773
776
  """
774
777
  ...
775
778
 
776
779
  @typing.overload
777
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
780
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
778
781
  ...
779
782
 
780
783
  @typing.overload
781
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
784
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
782
785
  ...
783
786
 
784
- 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):
787
+ 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):
785
788
  """
786
- Specifies the PyPI packages for the step.
789
+ Specifies that the step will success under all circumstances.
787
790
 
788
- Information in this decorator will augment any
789
- attributes set in the `@pyi_base` flow-level decorator. Hence,
790
- you can use `@pypi_base` to set packages required by all
791
- steps and use `@pypi` to specify step-specific overrides.
791
+ The decorator will create an optional artifact, specified by `var`, which
792
+ contains the exception raised. You can use it to detect the presence
793
+ of errors, indicating that all happy-path artifacts produced by the step
794
+ are missing.
792
795
 
793
796
  Parameters
794
797
  ----------
795
- packages : Dict[str, str], default: {}
796
- Packages to use for this step. The key is the name of the package
797
- and the value is the version to use.
798
- python : str, optional, default: None
799
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
800
- that the version used will correspond to the version of the Python interpreter used to start the run.
798
+ var : str, optional, default None
799
+ Name of the artifact in which to store the caught exception.
800
+ If not specified, the exception is not stored.
801
+ print_exception : bool, default True
802
+ Determines whether or not the exception is printed to
803
+ stdout when caught.
801
804
  """
802
805
  ...
803
806
 
@@ -854,366 +857,508 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
854
857
  """
855
858
  ...
856
859
 
857
- 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]]]:
860
+ @typing.overload
861
+ 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]]]:
858
862
  """
859
- Specifies that this step should execute on Kubernetes.
863
+ Creates a human-readable report, a Metaflow Card, after this step completes.
864
+
865
+ Note that you may add multiple `@card` decorators in a step with different parameters.
860
866
 
861
867
  Parameters
862
868
  ----------
863
- cpu : int, default 1
864
- Number of CPUs required for this step. If `@resources` is
865
- also present, the maximum value from all decorators is used.
866
- memory : int, default 4096
867
- Memory size (in MB) required for this step. If
868
- `@resources` is also present, the maximum value from all decorators is
869
- used.
870
- disk : int, default 10240
871
- Disk size (in MB) required for this step. If
872
- `@resources` is also present, the maximum value from all decorators is
873
- used.
874
- image : str, optional, default None
875
- Docker image to use when launching on Kubernetes. If not specified, and
876
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
877
- not, a default Docker image mapping to the current version of Python is used.
878
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
879
- If given, the imagePullPolicy to be applied to the Docker image of the step.
880
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
881
- Kubernetes service account to use when launching pod in Kubernetes.
882
- secrets : List[str], optional, default None
883
- Kubernetes secrets to use when launching pod in Kubernetes. These
884
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
885
- in Metaflow configuration.
886
- node_selector: Union[Dict[str,str], str], optional, default None
887
- Kubernetes node selector(s) to apply to the pod running the task.
888
- Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
889
- or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
890
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
891
- Kubernetes namespace to use when launching pod in Kubernetes.
892
- gpu : int, optional, default None
893
- Number of GPUs required for this step. A value of zero implies that
894
- the scheduled node should not have GPUs.
895
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
896
- The vendor of the GPUs to be used for this step.
897
- tolerations : List[str], default []
898
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
899
- Kubernetes tolerations to use when launching pod in Kubernetes.
900
- use_tmpfs : bool, default False
901
- This enables an explicit tmpfs mount for this step.
902
- tmpfs_tempdir : bool, default True
903
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
904
- tmpfs_size : int, optional, default: None
905
- The value for the size (in MiB) of the tmpfs mount for this step.
906
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
907
- memory allocated for this step.
908
- tmpfs_path : str, optional, default /metaflow_temp
909
- Path to tmpfs mount for this step.
910
- persistent_volume_claims : Dict[str, str], optional, default None
911
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
912
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
913
- shared_memory: int, optional
914
- Shared memory size (in MiB) required for this step
915
- port: int, optional
916
- Port number to specify in the Kubernetes job object
917
- compute_pool : str, optional, default None
918
- Compute pool to be used for for this step.
919
- If not specified, any accessible compute pool within the perimeter is used.
869
+ type : str, default 'default'
870
+ Card type.
871
+ id : str, optional, default None
872
+ If multiple cards are present, use this id to identify this card.
873
+ options : Dict[str, Any], default {}
874
+ Options passed to the card. The contents depend on the card type.
875
+ timeout : int, default 45
876
+ Interrupt reporting if it takes more than this many seconds.
877
+
878
+
920
879
  """
921
880
  ...
922
881
 
923
882
  @typing.overload
924
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
925
- """
926
- Decorator prototype for all step decorators. This function gets specialized
927
- and imported for all decorators types by _import_plugin_decorators().
928
- """
883
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
929
884
  ...
930
885
 
931
886
  @typing.overload
932
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
887
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
933
888
  ...
934
889
 
935
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
890
+ 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):
936
891
  """
937
- Decorator prototype for all step decorators. This function gets specialized
938
- and imported for all decorators types by _import_plugin_decorators().
892
+ Creates a human-readable report, a Metaflow Card, after this step completes.
893
+
894
+ Note that you may add multiple `@card` decorators in a step with different parameters.
895
+
896
+ Parameters
897
+ ----------
898
+ type : str, default 'default'
899
+ Card type.
900
+ id : str, optional, default None
901
+ If multiple cards are present, use this id to identify this card.
902
+ options : Dict[str, Any], default {}
903
+ Options passed to the card. The contents depend on the card type.
904
+ timeout : int, default 45
905
+ Interrupt reporting if it takes more than this many seconds.
906
+
907
+
939
908
  """
940
909
  ...
941
910
 
942
911
  @typing.overload
943
- 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]]]:
912
+ 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]]]:
944
913
  """
945
- Specifies a timeout for your step.
946
-
947
- This decorator is useful if this step may hang indefinitely.
948
-
949
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
950
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
951
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
914
+ Enables loading / saving of models within a step.
952
915
 
953
- Note that all the values specified in parameters are added together so if you specify
954
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
955
916
 
956
917
  Parameters
957
918
  ----------
958
- seconds : int, default 0
959
- Number of seconds to wait prior to timing out.
960
- minutes : int, default 0
961
- Number of minutes to wait prior to timing out.
962
- hours : int, default 0
963
- Number of hours to wait prior to timing out.
919
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
920
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
921
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
922
+ - `current.checkpoint`
923
+ - `current.model`
924
+ - `current.huggingface_hub`
925
+
926
+ 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
927
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
928
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
929
+
930
+ temp_dir_root : str, default: None
931
+ The root directory under which `current.model.loaded` will store loaded models
932
+
933
+
934
+
964
935
  """
965
936
  ...
966
937
 
967
938
  @typing.overload
968
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
939
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
969
940
  ...
970
941
 
971
942
  @typing.overload
972
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
943
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
973
944
  ...
974
945
 
975
- 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):
946
+ 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):
976
947
  """
977
- Specifies a timeout for your step.
978
-
979
- This decorator is useful if this step may hang indefinitely.
948
+ Enables loading / saving of models within a step.
980
949
 
981
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
982
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
983
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
984
-
985
- Note that all the values specified in parameters are added together so if you specify
986
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
987
950
 
988
951
  Parameters
989
952
  ----------
990
- seconds : int, default 0
991
- Number of seconds to wait prior to timing out.
992
- minutes : int, default 0
993
- Number of minutes to wait prior to timing out.
994
- hours : int, default 0
995
- Number of hours to wait prior to timing out.
953
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
954
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
955
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
956
+ - `current.checkpoint`
957
+ - `current.model`
958
+ - `current.huggingface_hub`
959
+
960
+ 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
961
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
962
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
963
+
964
+ temp_dir_root : str, default: None
965
+ The root directory under which `current.model.loaded` will store loaded models
966
+
967
+
968
+
996
969
  """
997
970
  ...
998
971
 
999
972
  @typing.overload
1000
- 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]]:
973
+ 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]]]:
1001
974
  """
1002
- Specifies the times when the flow should be run when running on a
1003
- production scheduler.
975
+ Specifies the resources needed when executing this step.
976
+
977
+ Use `@resources` to specify the resource requirements
978
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
979
+
980
+ You can choose the compute layer on the command line by executing e.g.
981
+ ```
982
+ python myflow.py run --with batch
983
+ ```
984
+ or
985
+ ```
986
+ python myflow.py run --with kubernetes
987
+ ```
988
+ which executes the flow on the desired system using the
989
+ requirements specified in `@resources`.
1004
990
 
1005
991
  Parameters
1006
992
  ----------
1007
- hourly : bool, default False
1008
- Run the workflow hourly.
1009
- daily : bool, default True
1010
- Run the workflow daily.
1011
- weekly : bool, default False
1012
- Run the workflow weekly.
1013
- cron : str, optional, default None
1014
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1015
- specified by this expression.
1016
- timezone : str, optional, default None
1017
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1018
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
993
+ cpu : int, default 1
994
+ Number of CPUs required for this step.
995
+ gpu : int, default 0
996
+ Number of GPUs required for this step.
997
+ disk : int, optional, default None
998
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
999
+ memory : int, default 4096
1000
+ Memory size (in MB) required for this step.
1001
+ shared_memory : int, optional, default None
1002
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1003
+ This parameter maps to the `--shm-size` option in Docker.
1019
1004
  """
1020
1005
  ...
1021
1006
 
1022
1007
  @typing.overload
1023
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1008
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1024
1009
  ...
1025
1010
 
1026
- 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):
1011
+ @typing.overload
1012
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1013
+ ...
1014
+
1015
+ 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):
1027
1016
  """
1028
- Specifies the times when the flow should be run when running on a
1029
- production scheduler.
1017
+ Specifies the resources needed when executing this step.
1018
+
1019
+ Use `@resources` to specify the resource requirements
1020
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1021
+
1022
+ You can choose the compute layer on the command line by executing e.g.
1023
+ ```
1024
+ python myflow.py run --with batch
1025
+ ```
1026
+ or
1027
+ ```
1028
+ python myflow.py run --with kubernetes
1029
+ ```
1030
+ which executes the flow on the desired system using the
1031
+ requirements specified in `@resources`.
1030
1032
 
1031
1033
  Parameters
1032
1034
  ----------
1033
- hourly : bool, default False
1034
- Run the workflow hourly.
1035
- daily : bool, default True
1036
- Run the workflow daily.
1037
- weekly : bool, default False
1038
- Run the workflow weekly.
1039
- cron : str, optional, default None
1040
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1041
- specified by this expression.
1042
- timezone : str, optional, default None
1043
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1044
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1035
+ cpu : int, default 1
1036
+ Number of CPUs required for this step.
1037
+ gpu : int, default 0
1038
+ Number of GPUs required for this step.
1039
+ disk : int, optional, default None
1040
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
1041
+ memory : int, default 4096
1042
+ Memory size (in MB) required for this step.
1043
+ shared_memory : int, optional, default None
1044
+ The value for the size (in MiB) of the /dev/shm volume for this step.
1045
+ This parameter maps to the `--shm-size` option in Docker.
1045
1046
  """
1046
1047
  ...
1047
1048
 
1048
- 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]]:
1049
+ @typing.overload
1050
+ 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]]]:
1049
1051
  """
1050
- 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)
1051
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1052
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1053
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1054
- starts only after all sensors finish.
1052
+ Specifies secrets to be retrieved and injected as environment variables prior to
1053
+ the execution of a step.
1055
1054
 
1056
1055
  Parameters
1057
1056
  ----------
1058
- timeout : int
1059
- Time, in seconds before the task times out and fails. (Default: 3600)
1060
- poke_interval : int
1061
- Time in seconds that the job should wait in between each try. (Default: 60)
1062
- mode : str
1063
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1064
- exponential_backoff : bool
1065
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1066
- pool : str
1067
- the slot pool this task should run in,
1068
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1069
- soft_fail : bool
1070
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1071
- name : str
1072
- Name of the sensor on Airflow
1073
- description : str
1074
- Description of sensor in the Airflow UI
1075
- bucket_key : Union[str, List[str]]
1076
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1077
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1078
- bucket_name : str
1079
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1080
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1081
- wildcard_match : bool
1082
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1083
- aws_conn_id : str
1084
- a reference to the s3 connection on Airflow. (Default: None)
1085
- verify : bool
1086
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1057
+ sources : List[Union[str, Dict[str, Any]]], default: []
1058
+ List of secret specs, defining how the secrets are to be retrieved
1087
1059
  """
1088
1060
  ...
1089
1061
 
1090
- 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]]:
1062
+ @typing.overload
1063
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1064
+ ...
1065
+
1066
+ @typing.overload
1067
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1068
+ ...
1069
+
1070
+ 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]]] = []):
1091
1071
  """
1092
- 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.
1093
- 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.
1072
+ Specifies secrets to be retrieved and injected as environment variables prior to
1073
+ the execution of a step.
1094
1074
 
1095
1075
  Parameters
1096
1076
  ----------
1097
- timeout : int
1098
- Time, in seconds before the task times out and fails. (Default: 3600)
1099
- poke_interval : int
1100
- Time in seconds that the job should wait in between each try. (Default: 60)
1101
- mode : str
1102
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1103
- exponential_backoff : bool
1104
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1105
- pool : str
1106
- the slot pool this task should run in,
1107
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1108
- soft_fail : bool
1109
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1110
- name : str
1111
- Name of the sensor on Airflow
1112
- description : str
1113
- Description of sensor in the Airflow UI
1114
- external_dag_id : str
1115
- The dag_id that contains the task you want to wait for.
1116
- external_task_ids : List[str]
1117
- The list of task_ids that you want to wait for.
1118
- If None (default value) the sensor waits for the DAG. (Default: None)
1119
- allowed_states : List[str]
1120
- Iterable of allowed states, (Default: ['success'])
1121
- failed_states : List[str]
1122
- Iterable of failed or dis-allowed states. (Default: None)
1123
- execution_delta : datetime.timedelta
1124
- time difference with the previous execution to look at,
1125
- the default is the same logical date as the current task or DAG. (Default: None)
1126
- check_existence: bool
1127
- Set to True to check if the external task exists or check if
1128
- the DAG to wait for exists. (Default: True)
1077
+ sources : List[Union[str, Dict[str, Any]]], default: []
1078
+ List of secret specs, defining how the secrets are to be retrieved
1129
1079
  """
1130
1080
  ...
1131
1081
 
1132
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1082
+ @typing.overload
1083
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1133
1084
  """
1134
- Specifies what flows belong to the same project.
1085
+ Internal decorator to support Fast bakery
1086
+ """
1087
+ ...
1088
+
1089
+ @typing.overload
1090
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1091
+ ...
1092
+
1093
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1094
+ """
1095
+ Internal decorator to support Fast bakery
1096
+ """
1097
+ ...
1098
+
1099
+ @typing.overload
1100
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1101
+ """
1102
+ Decorator prototype for all step decorators. This function gets specialized
1103
+ and imported for all decorators types by _import_plugin_decorators().
1104
+ """
1105
+ ...
1106
+
1107
+ @typing.overload
1108
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1109
+ ...
1110
+
1111
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1112
+ """
1113
+ Decorator prototype for all step decorators. This function gets specialized
1114
+ and imported for all decorators types by _import_plugin_decorators().
1115
+ """
1116
+ ...
1117
+
1118
+ @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]]:
1120
+ """
1121
+ Specifies the flow(s) that this flow depends on.
1135
1122
 
1136
- A project-specific namespace is created for all flows that
1137
- use the same `@project(name)`.
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
1132
+
1133
+ Additionally, you can specify project aware upstream flow dependencies
1134
+ by specifying the fully qualified project_flow_name.
1135
+ ```
1136
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1137
+ ```
1138
+ or
1139
+ ```
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"})
1147
+ ```
1148
+
1149
+ Note that `branch` is typically one of:
1150
+ - `prod`
1151
+ - `user.bob`
1152
+ - `test.my_experiment`
1153
+ - `prod.staging`
1154
+
1155
+ Parameters
1156
+ ----------
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
+
1165
+ """
1166
+ ...
1167
+
1168
+ @typing.overload
1169
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1170
+ ...
1171
+
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] = {}):
1173
+ """
1174
+ Specifies the flow(s) that this flow depends on.
1175
+
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
1185
+
1186
+ Additionally, you can specify project aware upstream flow dependencies
1187
+ by specifying the fully qualified project_flow_name.
1188
+ ```
1189
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1190
+ ```
1191
+ or
1192
+ ```
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"})
1200
+ ```
1201
+
1202
+ Note that `branch` is typically one of:
1203
+ - `prod`
1204
+ - `user.bob`
1205
+ - `test.my_experiment`
1206
+ - `prod.staging`
1138
1207
 
1139
1208
  Parameters
1140
1209
  ----------
1141
- name : str
1142
- Project name. Make sure that the name is unique amongst all
1143
- projects that use the same production scheduler. The name may
1144
- contain only lowercase alphanumeric characters and underscores.
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.
1145
1216
 
1146
1217
 
1147
1218
  """
1148
1219
  ...
1149
1220
 
1150
1221
  @typing.overload
1151
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1222
+ 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]]:
1152
1223
  """
1153
- Specifies the PyPI packages for all steps of the flow.
1224
+ Specifies the times when the flow should be run when running on a
1225
+ production scheduler.
1154
1226
 
1155
- Use `@pypi_base` to set common packages required by all
1156
- steps and use `@pypi` to specify step-specific overrides.
1157
1227
  Parameters
1158
1228
  ----------
1159
- packages : Dict[str, str], default: {}
1160
- Packages to use for this flow. The key is the name of the package
1161
- and the value is the version to use.
1162
- python : str, optional, default: None
1163
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1164
- that the version used will correspond to the version of the Python interpreter used to start the run.
1229
+ hourly : bool, default False
1230
+ Run the workflow hourly.
1231
+ daily : bool, default True
1232
+ Run the workflow daily.
1233
+ weekly : bool, default False
1234
+ Run the workflow weekly.
1235
+ cron : str, optional, default None
1236
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1237
+ specified by this expression.
1238
+ timezone : str, optional, default None
1239
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1240
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1165
1241
  """
1166
1242
  ...
1167
1243
 
1168
1244
  @typing.overload
1169
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1245
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1170
1246
  ...
1171
1247
 
1172
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1248
+ 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):
1173
1249
  """
1174
- Specifies the PyPI packages for all steps of the flow.
1250
+ Specifies the times when the flow should be run when running on a
1251
+ production scheduler.
1175
1252
 
1176
- Use `@pypi_base` to set common packages required by all
1177
- steps and use `@pypi` to specify step-specific overrides.
1178
1253
  Parameters
1179
1254
  ----------
1180
- packages : Dict[str, str], default: {}
1181
- Packages to use for this flow. The key is the name of the package
1182
- and the value is the version to use.
1183
- python : str, optional, default: None
1184
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1185
- that the version used will correspond to the version of the Python interpreter used to start the run.
1255
+ hourly : bool, default False
1256
+ Run the workflow hourly.
1257
+ daily : bool, default True
1258
+ Run the workflow daily.
1259
+ weekly : bool, default False
1260
+ Run the workflow weekly.
1261
+ cron : str, optional, default None
1262
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1263
+ specified by this expression.
1264
+ timezone : str, optional, default None
1265
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1266
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1186
1267
  """
1187
1268
  ...
1188
1269
 
1189
- def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1270
+ @typing.overload
1271
+ 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]]:
1190
1272
  """
1191
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1273
+ Specifies the event(s) that this flow depends on.
1192
1274
 
1193
- User code call
1194
- -----------
1195
- @nim(
1196
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1197
- backend='managed'
1198
- )
1275
+ ```
1276
+ @trigger(event='foo')
1277
+ ```
1278
+ or
1279
+ ```
1280
+ @trigger(events=['foo', 'bar'])
1281
+ ```
1199
1282
 
1200
- Valid backend options
1201
- ---------------------
1202
- - 'managed': Outerbounds selects a compute provider based on the model.
1203
- - 🚧 'dataplane': Run in your account.
1283
+ Additionally, you can specify the parameter mappings
1284
+ to map event payload to Metaflow parameters for the flow.
1285
+ ```
1286
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1287
+ ```
1288
+ or
1289
+ ```
1290
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1291
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1292
+ ```
1204
1293
 
1205
- Valid model options
1206
- ----------------
1207
- - 'meta/llama3-8b-instruct': 8B parameter model
1208
- - 'meta/llama3-70b-instruct': 70B parameter model
1209
- - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1294
+ 'parameters' can also be a list of strings and tuples like so:
1295
+ ```
1296
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1297
+ ```
1298
+ This is equivalent to:
1299
+ ```
1300
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1301
+ ```
1210
1302
 
1211
1303
  Parameters
1212
1304
  ----------
1213
- models: list[NIM]
1214
- List of NIM containers running models in sidecars.
1215
- backend: str
1216
- Compute provider to run the NIM container.
1305
+ event : Union[str, Dict[str, Any]], optional, default None
1306
+ Event dependency for this flow.
1307
+ events : List[Union[str, Dict[str, Any]]], default []
1308
+ Events dependency for this flow.
1309
+ options : Dict[str, Any], default {}
1310
+ Backend-specific configuration for tuning eventing behavior.
1311
+
1312
+
1313
+ """
1314
+ ...
1315
+
1316
+ @typing.overload
1317
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1318
+ ...
1319
+
1320
+ 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] = {}):
1321
+ """
1322
+ Specifies the event(s) that this flow depends on.
1323
+
1324
+ ```
1325
+ @trigger(event='foo')
1326
+ ```
1327
+ or
1328
+ ```
1329
+ @trigger(events=['foo', 'bar'])
1330
+ ```
1331
+
1332
+ Additionally, you can specify the parameter mappings
1333
+ to map event payload to Metaflow parameters for the flow.
1334
+ ```
1335
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1336
+ ```
1337
+ or
1338
+ ```
1339
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1340
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1341
+ ```
1342
+
1343
+ 'parameters' can also be a list of strings and tuples like so:
1344
+ ```
1345
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1346
+ ```
1347
+ This is equivalent to:
1348
+ ```
1349
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1350
+ ```
1351
+
1352
+ Parameters
1353
+ ----------
1354
+ event : Union[str, Dict[str, Any]], optional, default None
1355
+ Event dependency for this flow.
1356
+ events : List[Union[str, Dict[str, Any]]], default []
1357
+ Events dependency for this flow.
1358
+ options : Dict[str, Any], default {}
1359
+ Backend-specific configuration for tuning eventing behavior.
1360
+
1361
+
1217
1362
  """
1218
1363
  ...
1219
1364
 
@@ -1266,201 +1411,175 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1266
1411
  """
1267
1412
  ...
1268
1413
 
1269
- @typing.overload
1270
- 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]]:
1271
- """
1272
- Specifies the flow(s) that this flow depends on.
1273
-
1274
- ```
1275
- @trigger_on_finish(flow='FooFlow')
1276
- ```
1277
- or
1278
- ```
1279
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1280
- ```
1281
- This decorator respects the @project decorator and triggers the flow
1282
- when upstream runs within the same namespace complete successfully
1283
-
1284
- Additionally, you can specify project aware upstream flow dependencies
1285
- by specifying the fully qualified project_flow_name.
1286
- ```
1287
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1288
- ```
1289
- or
1290
- ```
1291
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1292
- ```
1293
-
1294
- You can also specify just the project or project branch (other values will be
1295
- inferred from the current project or project branch):
1296
- ```
1297
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1298
- ```
1299
-
1300
- Note that `branch` is typically one of:
1301
- - `prod`
1302
- - `user.bob`
1303
- - `test.my_experiment`
1304
- - `prod.staging`
1305
-
1306
- Parameters
1307
- ----------
1308
- flow : Union[str, Dict[str, str]], optional, default None
1309
- Upstream flow dependency for this flow.
1310
- flows : List[Union[str, Dict[str, str]]], default []
1311
- Upstream flow dependencies for this flow.
1312
- options : Dict[str, Any], default {}
1313
- Backend-specific configuration for tuning eventing behavior.
1314
-
1315
-
1316
- """
1317
- ...
1318
-
1319
- @typing.overload
1320
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1321
- ...
1322
-
1323
- 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] = {}):
1414
+ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1324
1415
  """
1325
- Specifies the flow(s) that this flow depends on.
1416
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1326
1417
 
1327
- ```
1328
- @trigger_on_finish(flow='FooFlow')
1329
- ```
1330
- or
1331
- ```
1332
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1333
- ```
1334
- This decorator respects the @project decorator and triggers the flow
1335
- when upstream runs within the same namespace complete successfully
1418
+ User code call
1419
+ -----------
1420
+ @nim(
1421
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1422
+ backend='managed'
1423
+ )
1336
1424
 
1337
- Additionally, you can specify project aware upstream flow dependencies
1338
- by specifying the fully qualified project_flow_name.
1339
- ```
1340
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1341
- ```
1342
- or
1343
- ```
1344
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1345
- ```
1425
+ Valid backend options
1426
+ ---------------------
1427
+ - 'managed': Outerbounds selects a compute provider based on the model.
1428
+ - 🚧 'dataplane': Run in your account.
1346
1429
 
1347
- You can also specify just the project or project branch (other values will be
1348
- inferred from the current project or project branch):
1349
- ```
1350
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1351
- ```
1430
+ Valid model options
1431
+ ----------------
1432
+ - 'meta/llama3-8b-instruct': 8B parameter model
1433
+ - 'meta/llama3-70b-instruct': 70B parameter model
1434
+ - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1352
1435
 
1353
- Note that `branch` is typically one of:
1354
- - `prod`
1355
- - `user.bob`
1356
- - `test.my_experiment`
1357
- - `prod.staging`
1436
+ Parameters
1437
+ ----------
1438
+ models: list[NIM]
1439
+ List of NIM containers running models in sidecars.
1440
+ backend: str
1441
+ Compute provider to run the NIM container.
1442
+ """
1443
+ ...
1444
+
1445
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1446
+ """
1447
+ Specifies what flows belong to the same project.
1448
+
1449
+ A project-specific namespace is created for all flows that
1450
+ use the same `@project(name)`.
1358
1451
 
1359
1452
  Parameters
1360
1453
  ----------
1361
- flow : Union[str, Dict[str, str]], optional, default None
1362
- Upstream flow dependency for this flow.
1363
- flows : List[Union[str, Dict[str, str]]], default []
1364
- Upstream flow dependencies for this flow.
1365
- options : Dict[str, Any], default {}
1366
- Backend-specific configuration for tuning eventing behavior.
1454
+ name : str
1455
+ Project name. Make sure that the name is unique amongst all
1456
+ projects that use the same production scheduler. The name may
1457
+ contain only lowercase alphanumeric characters and underscores.
1367
1458
 
1368
1459
 
1369
1460
  """
1370
1461
  ...
1371
1462
 
1372
1463
  @typing.overload
1373
- 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]]:
1464
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1374
1465
  """
1375
- Specifies the event(s) that this flow depends on.
1376
-
1377
- ```
1378
- @trigger(event='foo')
1379
- ```
1380
- or
1381
- ```
1382
- @trigger(events=['foo', 'bar'])
1383
- ```
1384
-
1385
- Additionally, you can specify the parameter mappings
1386
- to map event payload to Metaflow parameters for the flow.
1387
- ```
1388
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1389
- ```
1390
- or
1391
- ```
1392
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1393
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1394
- ```
1395
-
1396
- 'parameters' can also be a list of strings and tuples like so:
1397
- ```
1398
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1399
- ```
1400
- This is equivalent to:
1401
- ```
1402
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1403
- ```
1466
+ Specifies the PyPI packages for all steps of the flow.
1404
1467
 
1468
+ Use `@pypi_base` to set common packages required by all
1469
+ steps and use `@pypi` to specify step-specific overrides.
1405
1470
  Parameters
1406
1471
  ----------
1407
- event : Union[str, Dict[str, Any]], optional, default None
1408
- Event dependency for this flow.
1409
- events : List[Union[str, Dict[str, Any]]], default []
1410
- Events dependency for this flow.
1411
- options : Dict[str, Any], default {}
1412
- Backend-specific configuration for tuning eventing behavior.
1413
-
1414
-
1472
+ packages : Dict[str, str], default: {}
1473
+ Packages to use for this flow. The key is the name of the package
1474
+ and the value is the version to use.
1475
+ python : str, optional, default: None
1476
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1477
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1415
1478
  """
1416
1479
  ...
1417
1480
 
1418
1481
  @typing.overload
1419
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1482
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1420
1483
  ...
1421
1484
 
1422
- 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] = {}):
1485
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1423
1486
  """
1424
- Specifies the event(s) that this flow depends on.
1425
-
1426
- ```
1427
- @trigger(event='foo')
1428
- ```
1429
- or
1430
- ```
1431
- @trigger(events=['foo', 'bar'])
1432
- ```
1433
-
1434
- Additionally, you can specify the parameter mappings
1435
- to map event payload to Metaflow parameters for the flow.
1436
- ```
1437
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1438
- ```
1439
- or
1440
- ```
1441
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1442
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1443
- ```
1444
-
1445
- 'parameters' can also be a list of strings and tuples like so:
1446
- ```
1447
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1448
- ```
1449
- This is equivalent to:
1450
- ```
1451
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1452
- ```
1487
+ Specifies the PyPI packages for all steps of the flow.
1453
1488
 
1489
+ Use `@pypi_base` to set common packages required by all
1490
+ steps and use `@pypi` to specify step-specific overrides.
1454
1491
  Parameters
1455
1492
  ----------
1456
- event : Union[str, Dict[str, Any]], optional, default None
1457
- Event dependency for this flow.
1458
- events : List[Union[str, Dict[str, Any]]], default []
1459
- Events dependency for this flow.
1460
- options : Dict[str, Any], default {}
1461
- Backend-specific configuration for tuning eventing behavior.
1493
+ packages : Dict[str, str], default: {}
1494
+ Packages to use for this flow. The key is the name of the package
1495
+ and the value is the version to use.
1496
+ python : str, optional, default: None
1497
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1498
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1499
+ """
1500
+ ...
1501
+
1502
+ def 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]]:
1503
+ """
1504
+ 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)
1505
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1506
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1507
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1508
+ starts only after all sensors finish.
1462
1509
 
1510
+ Parameters
1511
+ ----------
1512
+ timeout : int
1513
+ Time, in seconds before the task times out and fails. (Default: 3600)
1514
+ poke_interval : int
1515
+ Time in seconds that the job should wait in between each try. (Default: 60)
1516
+ mode : str
1517
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1518
+ exponential_backoff : bool
1519
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1520
+ pool : str
1521
+ the slot pool this task should run in,
1522
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1523
+ soft_fail : bool
1524
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1525
+ name : str
1526
+ Name of the sensor on Airflow
1527
+ description : str
1528
+ Description of sensor in the Airflow UI
1529
+ bucket_key : Union[str, List[str]]
1530
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1531
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1532
+ bucket_name : str
1533
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1534
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1535
+ wildcard_match : bool
1536
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1537
+ aws_conn_id : str
1538
+ a reference to the s3 connection on Airflow. (Default: None)
1539
+ verify : bool
1540
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1541
+ """
1542
+ ...
1543
+
1544
+ 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]]:
1545
+ """
1546
+ 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.
1547
+ 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.
1463
1548
 
1549
+ Parameters
1550
+ ----------
1551
+ timeout : int
1552
+ Time, in seconds before the task times out and fails. (Default: 3600)
1553
+ poke_interval : int
1554
+ Time in seconds that the job should wait in between each try. (Default: 60)
1555
+ mode : str
1556
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1557
+ exponential_backoff : bool
1558
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1559
+ pool : str
1560
+ the slot pool this task should run in,
1561
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1562
+ soft_fail : bool
1563
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1564
+ name : str
1565
+ Name of the sensor on Airflow
1566
+ description : str
1567
+ Description of sensor in the Airflow UI
1568
+ external_dag_id : str
1569
+ The dag_id that contains the task you want to wait for.
1570
+ external_task_ids : List[str]
1571
+ The list of task_ids that you want to wait for.
1572
+ If None (default value) the sensor waits for the DAG. (Default: None)
1573
+ allowed_states : List[str]
1574
+ Iterable of allowed states, (Default: ['success'])
1575
+ failed_states : List[str]
1576
+ Iterable of failed or dis-allowed states. (Default: None)
1577
+ execution_delta : datetime.timedelta
1578
+ time difference with the previous execution to look at,
1579
+ the default is the same logical date as the current task or DAG. (Default: None)
1580
+ check_existence: bool
1581
+ Set to True to check if the external task exists or check if
1582
+ the DAG to wait for exists. (Default: True)
1464
1583
  """
1465
1584
  ...
1466
1585
 
@@ -2642,6 +2761,81 @@ class NBDeployer(object, metaclass=type):
2642
2761
  ...
2643
2762
  ...
2644
2763
 
2764
+ pkg_name: str
2765
+
2766
+ class Checkpoint(object, metaclass=type):
2767
+ def __init__(self, temp_dir_root = None, init_dir = False):
2768
+ ...
2769
+ @property
2770
+ def directory(self):
2771
+ ...
2772
+ def save(self, path = None, metadata = None, latest = True, name = "mfchckpt"):
2773
+ """
2774
+ saves the checkpoint to the datastore (resemble's a create op)
2775
+
2776
+ Parameters
2777
+ ----------
2778
+
2779
+ - `path` (str or os.PathLike):
2780
+ - path to directory
2781
+ - path to file
2782
+ - `name`:
2783
+ - name of the checkpoint
2784
+ - `metadata`:
2785
+ - metadata of the checkpoint
2786
+ """
2787
+ ...
2788
+ def __enter__(self):
2789
+ ...
2790
+ def __exit__(self, exc_type, exc_val, exc_tb):
2791
+ ...
2792
+ def list(self, name: typing.Optional[str] = None, task: typing.Union["metaflow.Task", str, None] = None, attempt: typing.Union[int, str, None] = None, as_dict: bool = True, within_task: bool = True) -> typing.Iterable[typing.Union[typing.Dict, metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures.CheckpointArtifact]]:
2793
+ """
2794
+ lists the checkpoints in the datastore based on the Task.
2795
+ It will always be task scoped.
2796
+
2797
+ Usage:
2798
+ ------
2799
+
2800
+ ```python
2801
+
2802
+ Checkpoint().list(name="best") # lists checkpoints in the current task with the name "best"
2803
+ Checkpoint().list(name="best", task="anotherflow/somerunid/somestep/sometask") # lists checkpoints in the another task with the name "best"
2804
+ Checkpoint().list(task="anotherflow/somerunid/somestep/sometask", name="best") # Identical as the above one but
2805
+ Checkpoint().list() # lists all the checkpoints in the current task
2806
+
2807
+ ```
2808
+
2809
+ Parameters
2810
+ ----------
2811
+
2812
+ - `name`:
2813
+ - name of the checkpoint to filter for
2814
+ - `task`:
2815
+ - Task object outside the one that is currently set in the `Checkpoint` object; Can be a pathspec string.
2816
+ - `attempt`:
2817
+ - attempt number of the task (optional filter. If none, then lists all checkpoints from all attempts)
2818
+ """
2819
+ ...
2820
+ def load(self, reference: typing.Union[str, typing.Dict, metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures.CheckpointArtifact], path: typing.Optional[str] = None):
2821
+ """
2822
+ loads a checkpoint reference from the datastore. (resembles a read op)
2823
+
2824
+ Parameters
2825
+ ----------
2826
+
2827
+ `reference` :
2828
+ - can be a string, dict or a CheckpointArtifact object:
2829
+ - string: a string reference to the checkpoint (checkpoint key)
2830
+ - dict: a dictionary reference to the checkpoint
2831
+ - CheckpointArtifact: a CheckpointArtifact object reference to the checkpoint
2832
+ """
2833
+ ...
2834
+ ...
2835
+
2836
+ def load_model(reference: typing.Union[str, metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures.MetaflowDataArtifactReference, dict], path: str):
2837
+ ...
2838
+
2645
2839
  def get_aws_client(module, with_error = False, role_arn = None, session_vars = None, client_params = None):
2646
2840
  ...
2647
2841