ob-metaflow-stubs 5.7__py2.py3-none-any.whl → 5.8__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 (138) hide show
  1. metaflow-stubs/__init__.pyi +528 -818
  2. metaflow-stubs/cards.pyi +5 -5
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/client/__init__.pyi +4 -4
  5. metaflow-stubs/client/core.pyi +8 -8
  6. metaflow-stubs/client/filecache.pyi +3 -3
  7. metaflow-stubs/clone_util.pyi +2 -2
  8. metaflow-stubs/events.pyi +2 -2
  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 +5 -5
  13. metaflow-stubs/metadata/metadata.pyi +3 -3
  14. metaflow-stubs/metadata/util.pyi +2 -2
  15. metaflow-stubs/metaflow_config.pyi +4 -2
  16. metaflow-stubs/metaflow_current.pyi +19 -19
  17. metaflow-stubs/mflog/mflog.pyi +2 -2
  18. metaflow-stubs/multicore_utils.pyi +2 -2
  19. metaflow-stubs/parameters.pyi +4 -4
  20. metaflow-stubs/plugins/__init__.pyi +3 -3
  21. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  22. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  23. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  24. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +3 -3
  27. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +3 -3
  28. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  29. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  30. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  31. metaflow-stubs/plugins/argo/argo_workflows.pyi +5 -5
  32. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +7 -7
  33. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +7 -7
  34. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  35. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  36. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  37. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  38. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  39. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  40. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  41. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
  42. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  43. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  44. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  45. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  46. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
  47. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  48. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
  51. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  52. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  53. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  54. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  55. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  56. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  57. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  58. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  59. metaflow-stubs/plugins/cards/card_cli.pyi +5 -5
  60. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  61. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  62. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  63. metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
  64. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  65. metaflow-stubs/plugins/cards/card_modules/basic.pyi +4 -4
  66. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  67. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  68. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  69. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +3 -3
  71. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  72. metaflow-stubs/plugins/cards/component_serializer.pyi +3 -3
  73. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  74. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  75. metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
  76. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  77. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  78. metaflow-stubs/plugins/datatools/s3/s3.pyi +6 -6
  79. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  80. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  81. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  82. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  83. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  84. metaflow-stubs/plugins/events_decorator.pyi +3 -3
  85. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  86. metaflow-stubs/plugins/frameworks/pytorch.pyi +3 -3
  87. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  88. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  89. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  90. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  91. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  92. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  93. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  94. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  95. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
  96. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  97. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
  98. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  99. metaflow-stubs/plugins/logs_cli.pyi +4 -4
  100. metaflow-stubs/plugins/package_cli.pyi +2 -2
  101. metaflow-stubs/plugins/parallel_decorator.pyi +3 -3
  102. metaflow-stubs/plugins/perimeters.pyi +2 -2
  103. metaflow-stubs/plugins/project_decorator.pyi +3 -3
  104. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  105. metaflow-stubs/plugins/pypi/conda_decorator.pyi +6 -2
  106. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  107. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +4 -2
  108. metaflow-stubs/plugins/pypi/pypi_environment.pyi +3 -3
  109. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  110. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  111. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  112. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  113. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  114. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  115. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  116. metaflow-stubs/plugins/tag_cli.pyi +5 -5
  117. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  118. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  119. metaflow-stubs/procpoll.pyi +2 -2
  120. metaflow-stubs/profilers/__init__.pyi +2 -2
  121. metaflow-stubs/pylint_wrapper.pyi +2 -2
  122. metaflow-stubs/runner/__init__.pyi +2 -2
  123. metaflow-stubs/runner/deployer.pyi +3 -3
  124. metaflow-stubs/runner/metaflow_runner.pyi +5 -5
  125. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  126. metaflow-stubs/runner/nbrun.pyi +2 -2
  127. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  128. metaflow-stubs/runner/utils.pyi +2 -2
  129. metaflow-stubs/system/__init__.pyi +3 -3
  130. metaflow-stubs/system/system_logger.pyi +2 -2
  131. metaflow-stubs/system/system_monitor.pyi +2 -2
  132. metaflow-stubs/tagging_util.pyi +2 -2
  133. metaflow-stubs/tuple_util.pyi +2 -2
  134. {ob_metaflow_stubs-5.7.dist-info → ob_metaflow_stubs-5.8.dist-info}/METADATA +1 -1
  135. ob_metaflow_stubs-5.8.dist-info/RECORD +138 -0
  136. ob_metaflow_stubs-5.7.dist-info/RECORD +0 -138
  137. {ob_metaflow_stubs-5.7.dist-info → ob_metaflow_stubs-5.8.dist-info}/WHEEL +0 -0
  138. {ob_metaflow_stubs-5.7.dist-info → ob_metaflow_stubs-5.8.dist-info}/top_level.txt +0 -0
@@ -1,25 +1,23 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.18.2+ob(v1) #
4
- # Generated on 2024-08-29T15:44:09.902207 #
3
+ # MF version: 2.12.19.1+ob(v1) #
4
+ # Generated on 2024-09-04T22:56:44.982024 #
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.metaflow_current
12
- import metaflow.datastore.inputs
13
- import metaflow.plugins.datatools.s3.s3
14
- import metaflow.flowspec
15
- import io
16
- import typing
17
- import metaflow.runner.metaflow_runner
18
- import datetime
19
11
  import metaflow.client.core
12
+ import metaflow.parameters
20
13
  import metaflow.events
21
14
  import metaflow._vendor.click.types
22
- import metaflow.parameters
15
+ import metaflow.runner.metaflow_runner
16
+ import datetime
17
+ import metaflow.flowspec
18
+ import metaflow.datastore.inputs
19
+ import typing
20
+ import metaflow.metaflow_current
23
21
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
24
22
  StepFlag = typing.NewType("StepFlag", bool)
25
23
 
@@ -356,295 +354,7 @@ class JSONTypeClass(metaflow._vendor.click.types.ParamType, metaclass=type):
356
354
 
357
355
  JSONType: metaflow.parameters.JSONTypeClass
358
356
 
359
- class S3(object, metaclass=type):
360
- @classmethod
361
- def get_root_from_config(cls, echo, create_on_absent = True):
362
- ...
363
- def __enter__(self) -> metaflow.plugins.datatools.s3.s3.S3:
364
- ...
365
- def __exit__(self, *args):
366
- ...
367
- def close(self):
368
- """
369
- Delete all temporary files downloaded in this context.
370
- """
371
- ...
372
- def list_paths(self, keys: typing.Optional[typing.Iterable[str]] = None) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
373
- """
374
- List the next level of paths in S3.
375
-
376
- If multiple keys are specified, listings are done in parallel. The returned
377
- S3Objects have `.exists == False` if the path refers to a prefix, not an
378
- existing S3 object.
379
-
380
- For instance, if the directory hierarchy is
381
- ```
382
- a/0.txt
383
- a/b/1.txt
384
- a/c/2.txt
385
- a/d/e/3.txt
386
- f/4.txt
387
- ```
388
- The `list_paths(['a', 'f'])` call returns
389
- ```
390
- a/0.txt (exists == True)
391
- a/b/ (exists == False)
392
- a/c/ (exists == False)
393
- a/d/ (exists == False)
394
- f/4.txt (exists == True)
395
- ```
396
-
397
- Parameters
398
- ----------
399
- keys : Iterable[str], optional, default None
400
- List of paths.
401
-
402
- Returns
403
- -------
404
- List[S3Object]
405
- S3Objects under the given paths, including prefixes (directories) that
406
- do not correspond to leaf objects.
407
- """
408
- ...
409
- def list_recursive(self, keys: typing.Optional[typing.Iterable[str]] = None) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
410
- """
411
- List all objects recursively under the given prefixes.
412
-
413
- If multiple keys are specified, listings are done in parallel. All objects
414
- returned have `.exists == True` as this call always returns leaf objects.
415
-
416
- For instance, if the directory hierarchy is
417
- ```
418
- a/0.txt
419
- a/b/1.txt
420
- a/c/2.txt
421
- a/d/e/3.txt
422
- f/4.txt
423
- ```
424
- The `list_paths(['a', 'f'])` call returns
425
- ```
426
- a/0.txt (exists == True)
427
- a/b/1.txt (exists == True)
428
- a/c/2.txt (exists == True)
429
- a/d/e/3.txt (exists == True)
430
- f/4.txt (exists == True)
431
- ```
432
-
433
- Parameters
434
- ----------
435
- keys : Iterable[str], optional, default None
436
- List of paths.
437
-
438
- Returns
439
- -------
440
- List[S3Object]
441
- S3Objects under the given paths.
442
- """
443
- ...
444
- def info(self, key: typing.Optional[str] = None, return_missing: bool = False) -> metaflow.plugins.datatools.s3.s3.S3Object:
445
- """
446
- Get metadata about a single object in S3.
447
-
448
- This call makes a single `HEAD` request to S3 which can be
449
- much faster than downloading all data with `get`.
450
-
451
- Parameters
452
- ----------
453
- key : str, optional, default None
454
- Object to query. It can be an S3 url or a path suffix.
455
- return_missing : bool, default False
456
- If set to True, do not raise an exception for a missing key but
457
- return it as an `S3Object` with `.exists == False`.
458
-
459
- Returns
460
- -------
461
- S3Object
462
- An S3Object corresponding to the object requested. The object
463
- will have `.downloaded == False`.
464
- """
465
- ...
466
- def info_many(self, keys: typing.Iterable[str], return_missing: bool = False) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
467
- """
468
- Get metadata about many objects in S3 in parallel.
469
-
470
- This call makes a single `HEAD` request to S3 which can be
471
- much faster than downloading all data with `get`.
472
-
473
- Parameters
474
- ----------
475
- keys : Iterable[str]
476
- Objects to query. Each key can be an S3 url or a path suffix.
477
- return_missing : bool, default False
478
- If set to True, do not raise an exception for a missing key but
479
- return it as an `S3Object` with `.exists == False`.
480
-
481
- Returns
482
- -------
483
- List[S3Object]
484
- A list of S3Objects corresponding to the paths requested. The
485
- objects will have `.downloaded == False`.
486
- """
487
- ...
488
- def get(self, key: typing.Union[str, metaflow.plugins.datatools.s3.s3.S3GetObject, None] = None, return_missing: bool = False, return_info: bool = True) -> metaflow.plugins.datatools.s3.s3.S3Object:
489
- """
490
- Get a single object from S3.
491
-
492
- Parameters
493
- ----------
494
- key : Union[str, S3GetObject], optional, default None
495
- Object to download. It can be an S3 url, a path suffix, or
496
- an S3GetObject that defines a range of data to download. If None, or
497
- not provided, gets the S3 root.
498
- return_missing : bool, default False
499
- If set to True, do not raise an exception for a missing key but
500
- return it as an `S3Object` with `.exists == False`.
501
- return_info : bool, default True
502
- If set to True, fetch the content-type and user metadata associated
503
- with the object at no extra cost, included for symmetry with `get_many`
504
-
505
- Returns
506
- -------
507
- S3Object
508
- An S3Object corresponding to the object requested.
509
- """
510
- ...
511
- def get_many(self, keys: typing.Iterable[typing.Union[str, metaflow.plugins.datatools.s3.s3.S3GetObject]], return_missing: bool = False, return_info: bool = True) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
512
- """
513
- Get many objects from S3 in parallel.
514
-
515
- Parameters
516
- ----------
517
- keys : Iterable[Union[str, S3GetObject]]
518
- Objects to download. Each object can be an S3 url, a path suffix, or
519
- an S3GetObject that defines a range of data to download.
520
- return_missing : bool, default False
521
- If set to True, do not raise an exception for a missing key but
522
- return it as an `S3Object` with `.exists == False`.
523
- return_info : bool, default True
524
- If set to True, fetch the content-type and user metadata associated
525
- with the object at no extra cost, included for symmetry with `get_many`.
526
-
527
- Returns
528
- -------
529
- List[S3Object]
530
- S3Objects corresponding to the objects requested.
531
- """
532
- ...
533
- def get_recursive(self, keys: typing.Iterable[str], return_info: bool = False) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
534
- """
535
- Get many objects from S3 recursively in parallel.
536
-
537
- Parameters
538
- ----------
539
- keys : Iterable[str]
540
- Prefixes to download recursively. Each prefix can be an S3 url or a path suffix
541
- which define the root prefix under which all objects are downloaded.
542
- return_info : bool, default False
543
- If set to True, fetch the content-type and user metadata associated
544
- with the object.
545
-
546
- Returns
547
- -------
548
- List[S3Object]
549
- S3Objects stored under the given prefixes.
550
- """
551
- ...
552
- def get_all(self, return_info: bool = False) -> typing.List[metaflow.plugins.datatools.s3.s3.S3Object]:
553
- """
554
- Get all objects under the prefix set in the `S3` constructor.
555
-
556
- This method requires that the `S3` object is initialized either with `run` or
557
- `s3root`.
558
-
559
- Parameters
560
- ----------
561
- return_info : bool, default False
562
- If set to True, fetch the content-type and user metadata associated
563
- with the object.
564
-
565
- Returns
566
- -------
567
- Iterable[S3Object]
568
- S3Objects stored under the main prefix.
569
- """
570
- ...
571
- def put(self, key: typing.Union[str, metaflow.plugins.datatools.s3.s3.S3PutObject], obj: typing.Union[io.RawIOBase, io.BufferedIOBase, str, bytes], overwrite: bool = True, content_type: typing.Optional[str] = None, metadata: typing.Optional[typing.Dict[str, str]] = None) -> str:
572
- """
573
- Upload a single object to S3.
574
-
575
- Parameters
576
- ----------
577
- key : Union[str, S3PutObject]
578
- Object path. It can be an S3 url or a path suffix.
579
- obj : PutValue
580
- An object to store in S3. Strings are converted to UTF-8 encoding.
581
- overwrite : bool, default True
582
- Overwrite the object if it exists. If set to False, the operation
583
- succeeds without uploading anything if the key already exists.
584
- content_type : str, optional, default None
585
- Optional MIME type for the object.
586
- metadata : Dict[str, str], optional, default None
587
- A JSON-encodable dictionary of additional headers to be stored
588
- as metadata with the object.
589
-
590
- Returns
591
- -------
592
- str
593
- URL of the object stored.
594
- """
595
- ...
596
- def put_many(self, key_objs: typing.List[typing.Union[typing.Tuple[str, typing.Union[io.RawIOBase, io.BufferedIOBase, str, bytes]], metaflow.plugins.datatools.s3.s3.S3PutObject]], overwrite: bool = True) -> typing.List[typing.Tuple[str, str]]:
597
- """
598
- Upload many objects to S3.
599
-
600
- Each object to be uploaded can be specified in two ways:
601
-
602
- 1. As a `(key, obj)` tuple where `key` is a string specifying
603
- the path and `obj` is a string or a bytes object.
604
-
605
- 2. As a `S3PutObject` which contains additional metadata to be
606
- stored with the object.
607
-
608
- Parameters
609
- ----------
610
- key_objs : List[Union[Tuple[str, PutValue], S3PutObject]]
611
- List of key-object pairs to upload.
612
- overwrite : bool, default True
613
- Overwrite the object if it exists. If set to False, the operation
614
- succeeds without uploading anything if the key already exists.
615
-
616
- Returns
617
- -------
618
- List[Tuple[str, str]]
619
- List of `(key, url)` pairs corresponding to the objects uploaded.
620
- """
621
- ...
622
- def put_files(self, key_paths: typing.List[typing.Union[typing.Tuple[str, typing.Union[io.RawIOBase, io.BufferedIOBase, str, bytes]], metaflow.plugins.datatools.s3.s3.S3PutObject]], overwrite: bool = True) -> typing.List[typing.Tuple[str, str]]:
623
- """
624
- Upload many local files to S3.
625
-
626
- Each file to be uploaded can be specified in two ways:
627
-
628
- 1. As a `(key, path)` tuple where `key` is a string specifying
629
- the S3 path and `path` is the path to a local file.
630
-
631
- 2. As a `S3PutObject` which contains additional metadata to be
632
- stored with the file.
633
-
634
- Parameters
635
- ----------
636
- key_paths : List[Union[Tuple[str, PutValue], S3PutObject]]
637
- List of files to upload.
638
- overwrite : bool, default True
639
- Overwrite the object if it exists. If set to False, the operation
640
- succeeds without uploading anything if the key already exists.
641
-
642
- Returns
643
- -------
644
- List[Tuple[str, str]]
645
- List of `(key, url)` pairs corresponding to the files uploaded.
646
- """
647
- ...
357
+ def S3(*args, **kwargs):
648
358
  ...
649
359
 
650
360
  class IncludeFile(metaflow.parameters.Parameter, metaclass=type):
@@ -727,119 +437,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
727
437
  """
728
438
  ...
729
439
 
730
- 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, 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]]]:
731
- """
732
- Specifies that this step should execute on Kubernetes.
733
-
734
- Parameters
735
- ----------
736
- cpu : int, default 1
737
- Number of CPUs required for this step. If `@resources` is
738
- also present, the maximum value from all decorators is used.
739
- memory : int, default 4096
740
- Memory size (in MB) required for this step. If
741
- `@resources` is also present, the maximum value from all decorators is
742
- used.
743
- disk : int, default 10240
744
- Disk size (in MB) required for this step. If
745
- `@resources` is also present, the maximum value from all decorators is
746
- used.
747
- image : str, optional, default None
748
- Docker image to use when launching on Kubernetes. If not specified, and
749
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
750
- not, a default Docker image mapping to the current version of Python is used.
751
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
752
- If given, the imagePullPolicy to be applied to the Docker image of the step.
753
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
754
- Kubernetes service account to use when launching pod in Kubernetes.
755
- secrets : List[str], optional, default None
756
- Kubernetes secrets to use when launching pod in Kubernetes. These
757
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
758
- in Metaflow configuration.
759
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
760
- Kubernetes namespace to use when launching pod in Kubernetes.
761
- gpu : int, optional, default None
762
- Number of GPUs required for this step. A value of zero implies that
763
- the scheduled node should not have GPUs.
764
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
765
- The vendor of the GPUs to be used for this step.
766
- tolerations : List[str], default []
767
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
768
- Kubernetes tolerations to use when launching pod in Kubernetes.
769
- use_tmpfs : bool, default False
770
- This enables an explicit tmpfs mount for this step.
771
- tmpfs_tempdir : bool, default True
772
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
773
- tmpfs_size : int, optional, default: None
774
- The value for the size (in MiB) of the tmpfs mount for this step.
775
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
776
- memory allocated for this step.
777
- tmpfs_path : str, optional, default /metaflow_temp
778
- Path to tmpfs mount for this step.
779
- persistent_volume_claims : Dict[str, str], optional, default None
780
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
781
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
782
- shared_memory: int, optional
783
- Shared memory size (in MiB) required for this step
784
- port: int, optional
785
- Port number to specify in the Kubernetes job object
786
- compute_pool : str, optional, default None
787
- Compute pool to be used for for this step.
788
- If not specified, any accessible compute pool within the perimeter is used.
789
- """
790
- ...
791
-
792
- @typing.overload
793
- 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]]]:
794
- """
795
- Creates a human-readable report, a Metaflow Card, after this step completes.
796
-
797
- Note that you may add multiple `@card` decorators in a step with different parameters.
798
-
799
- Parameters
800
- ----------
801
- type : str, default 'default'
802
- Card type.
803
- id : str, optional, default None
804
- If multiple cards are present, use this id to identify this card.
805
- options : Dict[str, Any], default {}
806
- Options passed to the card. The contents depend on the card type.
807
- timeout : int, default 45
808
- Interrupt reporting if it takes more than this many seconds.
809
-
810
-
811
- """
812
- ...
813
-
814
- @typing.overload
815
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
816
- ...
817
-
818
- @typing.overload
819
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
820
- ...
821
-
822
- 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):
823
- """
824
- Creates a human-readable report, a Metaflow Card, after this step completes.
825
-
826
- Note that you may add multiple `@card` decorators in a step with different parameters.
827
-
828
- Parameters
829
- ----------
830
- type : str, default 'default'
831
- Card type.
832
- id : str, optional, default None
833
- If multiple cards are present, use this id to identify this card.
834
- options : Dict[str, Any], default {}
835
- Options passed to the card. The contents depend on the card type.
836
- timeout : int, default 45
837
- Interrupt reporting if it takes more than this many seconds.
838
-
839
-
840
- """
841
- ...
842
-
843
440
  @typing.overload
844
441
  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]]]:
845
442
  """
@@ -898,7 +495,24 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
898
495
  ...
899
496
 
900
497
  @typing.overload
901
- def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
498
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
499
+ """
500
+ Internal decorator to support Fast bakery
501
+ """
502
+ ...
503
+
504
+ @typing.overload
505
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
506
+ ...
507
+
508
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
509
+ """
510
+ Internal decorator to support Fast bakery
511
+ """
512
+ ...
513
+
514
+ @typing.overload
515
+ def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
902
516
  """
903
517
  Specifies the Conda environment for the step.
904
518
 
@@ -955,112 +569,82 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
955
569
  ...
956
570
 
957
571
  @typing.overload
958
- def resources(*, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
572
+ 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]]]:
959
573
  """
960
- Specifies the resources needed when executing this step.
961
-
962
- Use `@resources` to specify the resource requirements
963
- independently of the specific compute layer (`@batch`, `@kubernetes`).
964
-
965
- You can choose the compute layer on the command line by executing e.g.
966
- ```
967
- python myflow.py run --with batch
968
- ```
969
- or
970
- ```
971
- python myflow.py run --with kubernetes
972
- ```
973
- which executes the flow on the desired system using the
974
- requirements specified in `@resources`.
574
+ Specifies environment variables to be set prior to the execution of a step.
975
575
 
976
576
  Parameters
977
577
  ----------
978
- cpu : int, default 1
979
- Number of CPUs required for this step.
980
- gpu : int, default 0
981
- Number of GPUs required for this step.
982
- disk : int, optional, default None
983
- Disk size (in MB) required for this step. Only applies on Kubernetes.
984
- memory : int, default 4096
985
- Memory size (in MB) required for this step.
986
- shared_memory : int, optional, default None
987
- The value for the size (in MiB) of the /dev/shm volume for this step.
988
- This parameter maps to the `--shm-size` option in Docker.
578
+ vars : Dict[str, str], default {}
579
+ Dictionary of environment variables to set.
989
580
  """
990
581
  ...
991
582
 
992
583
  @typing.overload
993
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
584
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
994
585
  ...
995
586
 
996
587
  @typing.overload
997
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
588
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
998
589
  ...
999
590
 
1000
- 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):
591
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1001
592
  """
1002
- Specifies the resources needed when executing this step.
1003
-
1004
- Use `@resources` to specify the resource requirements
1005
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1006
-
1007
- You can choose the compute layer on the command line by executing e.g.
1008
- ```
1009
- python myflow.py run --with batch
1010
- ```
1011
- or
1012
- ```
1013
- python myflow.py run --with kubernetes
1014
- ```
1015
- which executes the flow on the desired system using the
1016
- requirements specified in `@resources`.
593
+ Specifies environment variables to be set prior to the execution of a step.
1017
594
 
1018
595
  Parameters
1019
596
  ----------
1020
- cpu : int, default 1
1021
- Number of CPUs required for this step.
1022
- gpu : int, default 0
1023
- Number of GPUs required for this step.
1024
- disk : int, optional, default None
1025
- Disk size (in MB) required for this step. Only applies on Kubernetes.
1026
- memory : int, default 4096
1027
- Memory size (in MB) required for this step.
1028
- shared_memory : int, optional, default None
1029
- The value for the size (in MiB) of the /dev/shm volume for this step.
1030
- This parameter maps to the `--shm-size` option in Docker.
597
+ vars : Dict[str, str], default {}
598
+ Dictionary of environment variables to set.
1031
599
  """
1032
600
  ...
1033
601
 
1034
602
  @typing.overload
1035
- 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]]]:
603
+ 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]]]:
1036
604
  """
1037
- Specifies secrets to be retrieved and injected as environment variables prior to
1038
- the execution of a step.
605
+ Specifies that the step will success under all circumstances.
606
+
607
+ The decorator will create an optional artifact, specified by `var`, which
608
+ contains the exception raised. You can use it to detect the presence
609
+ of errors, indicating that all happy-path artifacts produced by the step
610
+ are missing.
1039
611
 
1040
612
  Parameters
1041
613
  ----------
1042
- sources : List[Union[str, Dict[str, Any]]], default: []
1043
- List of secret specs, defining how the secrets are to be retrieved
614
+ var : str, optional, default None
615
+ Name of the artifact in which to store the caught exception.
616
+ If not specified, the exception is not stored.
617
+ print_exception : bool, default True
618
+ Determines whether or not the exception is printed to
619
+ stdout when caught.
1044
620
  """
1045
621
  ...
1046
622
 
1047
623
  @typing.overload
1048
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
624
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1049
625
  ...
1050
626
 
1051
627
  @typing.overload
1052
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
628
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1053
629
  ...
1054
630
 
1055
- 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]]] = []):
631
+ 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):
1056
632
  """
1057
- Specifies secrets to be retrieved and injected as environment variables prior to
1058
- the execution of a step.
633
+ Specifies that the step will success under all circumstances.
634
+
635
+ The decorator will create an optional artifact, specified by `var`, which
636
+ contains the exception raised. You can use it to detect the presence
637
+ of errors, indicating that all happy-path artifacts produced by the step
638
+ are missing.
1059
639
 
1060
640
  Parameters
1061
641
  ----------
1062
- sources : List[Union[str, Dict[str, Any]]], default: []
1063
- List of secret specs, defining how the secrets are to be retrieved
642
+ var : str, optional, default None
643
+ Name of the artifact in which to store the caught exception.
644
+ If not specified, the exception is not stored.
645
+ print_exception : bool, default True
646
+ Determines whether or not the exception is printed to
647
+ stdout when caught.
1064
648
  """
1065
649
  ...
1066
650
 
@@ -1117,396 +701,389 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1117
701
  """
1118
702
  ...
1119
703
 
1120
- @typing.overload
1121
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1122
- """
1123
- Decorator prototype for all step decorators. This function gets specialized
1124
- and imported for all decorators types by _import_plugin_decorators().
1125
- """
1126
- ...
1127
-
1128
- @typing.overload
1129
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1130
- ...
1131
-
1132
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
704
+ 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, 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]]]:
1133
705
  """
1134
- Decorator prototype for all step decorators. This function gets specialized
1135
- and imported for all decorators types by _import_plugin_decorators().
706
+ Specifies that this step should execute on Kubernetes.
707
+
708
+ Parameters
709
+ ----------
710
+ cpu : int, default 1
711
+ Number of CPUs required for this step. If `@resources` is
712
+ also present, the maximum value from all decorators is used.
713
+ memory : int, default 4096
714
+ Memory size (in MB) required for this step. If
715
+ `@resources` is also present, the maximum value from all decorators is
716
+ used.
717
+ disk : int, default 10240
718
+ Disk size (in MB) required for this step. If
719
+ `@resources` is also present, the maximum value from all decorators is
720
+ used.
721
+ image : str, optional, default None
722
+ Docker image to use when launching on Kubernetes. If not specified, and
723
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
724
+ not, a default Docker image mapping to the current version of Python is used.
725
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
726
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
727
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
728
+ Kubernetes service account to use when launching pod in Kubernetes.
729
+ secrets : List[str], optional, default None
730
+ Kubernetes secrets to use when launching pod in Kubernetes. These
731
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
732
+ in Metaflow configuration.
733
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
734
+ Kubernetes namespace to use when launching pod in Kubernetes.
735
+ gpu : int, optional, default None
736
+ Number of GPUs required for this step. A value of zero implies that
737
+ the scheduled node should not have GPUs.
738
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
739
+ The vendor of the GPUs to be used for this step.
740
+ tolerations : List[str], default []
741
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
742
+ Kubernetes tolerations to use when launching pod in Kubernetes.
743
+ use_tmpfs : bool, default False
744
+ This enables an explicit tmpfs mount for this step.
745
+ tmpfs_tempdir : bool, default True
746
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
747
+ tmpfs_size : int, optional, default: None
748
+ The value for the size (in MiB) of the tmpfs mount for this step.
749
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
750
+ memory allocated for this step.
751
+ tmpfs_path : str, optional, default /metaflow_temp
752
+ Path to tmpfs mount for this step.
753
+ persistent_volume_claims : Dict[str, str], optional, default None
754
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
755
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
756
+ shared_memory: int, optional
757
+ Shared memory size (in MiB) required for this step
758
+ port: int, optional
759
+ Port number to specify in the Kubernetes job object
760
+ compute_pool : str, optional, default None
761
+ Compute pool to be used for for this step.
762
+ If not specified, any accessible compute pool within the perimeter is used.
1136
763
  """
1137
764
  ...
1138
765
 
1139
766
  @typing.overload
1140
- 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]]]:
767
+ 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]]]:
1141
768
  """
1142
- Specifies that the step will success under all circumstances.
769
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1143
770
 
1144
- The decorator will create an optional artifact, specified by `var`, which
1145
- contains the exception raised. You can use it to detect the presence
1146
- of errors, indicating that all happy-path artifacts produced by the step
1147
- are missing.
771
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1148
772
 
1149
773
  Parameters
1150
774
  ----------
1151
- var : str, optional, default None
1152
- Name of the artifact in which to store the caught exception.
1153
- If not specified, the exception is not stored.
1154
- print_exception : bool, default True
1155
- Determines whether or not the exception is printed to
1156
- stdout when caught.
775
+ type : str, default 'default'
776
+ Card type.
777
+ id : str, optional, default None
778
+ If multiple cards are present, use this id to identify this card.
779
+ options : Dict[str, Any], default {}
780
+ Options passed to the card. The contents depend on the card type.
781
+ timeout : int, default 45
782
+ Interrupt reporting if it takes more than this many seconds.
783
+
784
+
1157
785
  """
1158
786
  ...
1159
787
 
1160
788
  @typing.overload
1161
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
789
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1162
790
  ...
1163
791
 
1164
792
  @typing.overload
1165
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
793
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1166
794
  ...
1167
795
 
1168
- 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):
796
+ 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):
1169
797
  """
1170
- Specifies that the step will success under all circumstances.
798
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1171
799
 
1172
- The decorator will create an optional artifact, specified by `var`, which
1173
- contains the exception raised. You can use it to detect the presence
1174
- of errors, indicating that all happy-path artifacts produced by the step
1175
- are missing.
800
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1176
801
 
1177
802
  Parameters
1178
803
  ----------
1179
- var : str, optional, default None
1180
- Name of the artifact in which to store the caught exception.
1181
- If not specified, the exception is not stored.
1182
- print_exception : bool, default True
1183
- Determines whether or not the exception is printed to
1184
- stdout when caught.
804
+ type : str, default 'default'
805
+ Card type.
806
+ id : str, optional, default None
807
+ If multiple cards are present, use this id to identify this card.
808
+ options : Dict[str, Any], default {}
809
+ Options passed to the card. The contents depend on the card type.
810
+ timeout : int, default 45
811
+ Interrupt reporting if it takes more than this many seconds.
812
+
813
+
1185
814
  """
1186
815
  ...
1187
816
 
1188
817
  @typing.overload
1189
- 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]]]:
818
+ 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]]]:
1190
819
  """
1191
- Specifies the PyPI packages for the step.
1192
-
1193
- Information in this decorator will augment any
1194
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1195
- you can use `@pypi_base` to set packages required by all
1196
- steps and use `@pypi` to specify step-specific overrides.
1197
-
1198
- Parameters
1199
- ----------
1200
- packages : Dict[str, str], default: {}
1201
- Packages to use for this step. The key is the name of the package
1202
- and the value is the version to use.
1203
- python : str, optional, default: None
1204
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1205
- that the version used will correspond to the version of the Python interpreter used to start the run.
1206
- """
1207
- ...
1208
-
1209
- @typing.overload
1210
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1211
- ...
1212
-
1213
- @typing.overload
1214
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1215
- ...
1216
-
1217
- 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):
1218
- """
1219
- Specifies the PyPI packages for the step.
1220
-
1221
- Information in this decorator will augment any
1222
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1223
- you can use `@pypi_base` to set packages required by all
1224
- steps and use `@pypi` to specify step-specific overrides.
1225
-
1226
- Parameters
1227
- ----------
1228
- packages : Dict[str, str], default: {}
1229
- Packages to use for this step. The key is the name of the package
1230
- and the value is the version to use.
1231
- python : str, optional, default: None
1232
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1233
- that the version used will correspond to the version of the Python interpreter used to start the run.
1234
- """
1235
- ...
1236
-
1237
- @typing.overload
1238
- 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]]]:
1239
- """
1240
- Specifies environment variables to be set prior to the execution of a step.
820
+ Specifies secrets to be retrieved and injected as environment variables prior to
821
+ the execution of a step.
1241
822
 
1242
823
  Parameters
1243
824
  ----------
1244
- vars : Dict[str, str], default {}
1245
- Dictionary of environment variables to set.
825
+ sources : List[Union[str, Dict[str, Any]]], default: []
826
+ List of secret specs, defining how the secrets are to be retrieved
1246
827
  """
1247
828
  ...
1248
829
 
1249
830
  @typing.overload
1250
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
831
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1251
832
  ...
1252
833
 
1253
834
  @typing.overload
1254
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
835
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1255
836
  ...
1256
837
 
1257
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
838
+ 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]]] = []):
1258
839
  """
1259
- Specifies environment variables to be set prior to the execution of a step.
840
+ Specifies secrets to be retrieved and injected as environment variables prior to
841
+ the execution of a step.
1260
842
 
1261
843
  Parameters
1262
844
  ----------
1263
- vars : Dict[str, str], default {}
1264
- Dictionary of environment variables to set.
845
+ sources : List[Union[str, Dict[str, Any]]], default: []
846
+ List of secret specs, defining how the secrets are to be retrieved
1265
847
  """
1266
848
  ...
1267
849
 
1268
850
  @typing.overload
1269
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
851
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1270
852
  """
1271
- Internal decorator to support Fast bakery
853
+ Decorator prototype for all step decorators. This function gets specialized
854
+ and imported for all decorators types by _import_plugin_decorators().
1272
855
  """
1273
856
  ...
1274
857
 
1275
858
  @typing.overload
1276
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
859
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1277
860
  ...
1278
861
 
1279
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
862
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1280
863
  """
1281
- Internal decorator to support Fast bakery
864
+ Decorator prototype for all step decorators. This function gets specialized
865
+ and imported for all decorators types by _import_plugin_decorators().
1282
866
  """
1283
867
  ...
1284
868
 
1285
869
  @typing.overload
1286
- def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
870
+ 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]]]:
1287
871
  """
1288
- Specifies the Conda environment for all steps of the flow.
872
+ Specifies the PyPI packages for the step.
1289
873
 
1290
- Use `@conda_base` to set common libraries required by all
1291
- steps and use `@conda` to specify step-specific additions.
874
+ Information in this decorator will augment any
875
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
876
+ you can use `@pypi_base` to set packages required by all
877
+ steps and use `@pypi` to specify step-specific overrides.
1292
878
 
1293
879
  Parameters
1294
880
  ----------
1295
- packages : Dict[str, str], default {}
1296
- Packages to use for this flow. The key is the name of the package
881
+ packages : Dict[str, str], default: {}
882
+ Packages to use for this step. The key is the name of the package
1297
883
  and the value is the version to use.
1298
- libraries : Dict[str, str], default {}
1299
- Supported for backward compatibility. When used with packages, packages will take precedence.
1300
- python : str, optional, default None
884
+ python : str, optional, default: None
1301
885
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1302
886
  that the version used will correspond to the version of the Python interpreter used to start the run.
1303
- disabled : bool, default False
1304
- If set to True, disables Conda.
1305
887
  """
1306
888
  ...
1307
889
 
1308
890
  @typing.overload
1309
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
891
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1310
892
  ...
1311
893
 
1312
- def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
894
+ @typing.overload
895
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
896
+ ...
897
+
898
+ 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):
1313
899
  """
1314
- Specifies the Conda environment for all steps of the flow.
900
+ Specifies the PyPI packages for the step.
1315
901
 
1316
- Use `@conda_base` to set common libraries required by all
1317
- steps and use `@conda` to specify step-specific additions.
902
+ Information in this decorator will augment any
903
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
904
+ you can use `@pypi_base` to set packages required by all
905
+ steps and use `@pypi` to specify step-specific overrides.
1318
906
 
1319
907
  Parameters
1320
908
  ----------
1321
- packages : Dict[str, str], default {}
1322
- Packages to use for this flow. The key is the name of the package
909
+ packages : Dict[str, str], default: {}
910
+ Packages to use for this step. The key is the name of the package
1323
911
  and the value is the version to use.
1324
- libraries : Dict[str, str], default {}
1325
- Supported for backward compatibility. When used with packages, packages will take precedence.
1326
- python : str, optional, default None
912
+ python : str, optional, default: None
1327
913
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
1328
914
  that the version used will correspond to the version of the Python interpreter used to start the run.
1329
- disabled : bool, default False
1330
- If set to True, disables Conda.
1331
915
  """
1332
916
  ...
1333
917
 
1334
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1335
- """
1336
- Specifies what flows belong to the same project.
1337
-
1338
- A project-specific namespace is created for all flows that
1339
- use the same `@project(name)`.
1340
-
1341
- Parameters
1342
- ----------
1343
- name : str
1344
- Project name. Make sure that the name is unique amongst all
1345
- projects that use the same production scheduler. The name may
1346
- contain only lowercase alphanumeric characters and underscores.
1347
-
1348
-
1349
- """
1350
- ...
1351
-
1352
- def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
918
+ @typing.overload
919
+ 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]]]:
1353
920
  """
1354
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1355
-
1356
- User code call
1357
- -----------
1358
- @nim(
1359
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1360
- backend='managed'
1361
- )
921
+ Specifies the resources needed when executing this step.
1362
922
 
1363
- Valid backend options
1364
- ---------------------
1365
- - 'managed': Outerbounds selects a compute provider based on the model.
1366
- - 🚧 'dataplane': Run in your account.
923
+ Use `@resources` to specify the resource requirements
924
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
1367
925
 
1368
- Valid model options
1369
- ----------------
1370
- - 'meta/llama3-8b-instruct': 8B parameter model
1371
- - 'meta/llama3-70b-instruct': 70B parameter model
1372
- - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
926
+ You can choose the compute layer on the command line by executing e.g.
927
+ ```
928
+ python myflow.py run --with batch
929
+ ```
930
+ or
931
+ ```
932
+ python myflow.py run --with kubernetes
933
+ ```
934
+ which executes the flow on the desired system using the
935
+ requirements specified in `@resources`.
1373
936
 
1374
937
  Parameters
1375
938
  ----------
1376
- models: list[NIM]
1377
- List of NIM containers running models in sidecars.
1378
- backend: str
1379
- Compute provider to run the NIM container.
939
+ cpu : int, default 1
940
+ Number of CPUs required for this step.
941
+ gpu : int, default 0
942
+ Number of GPUs required for this step.
943
+ disk : int, optional, default None
944
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
945
+ memory : int, default 4096
946
+ Memory size (in MB) required for this step.
947
+ shared_memory : int, optional, default None
948
+ The value for the size (in MiB) of the /dev/shm volume for this step.
949
+ This parameter maps to the `--shm-size` option in Docker.
1380
950
  """
1381
951
  ...
1382
952
 
1383
953
  @typing.overload
1384
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1385
- """
1386
- Specifies the PyPI packages for all steps of the flow.
1387
-
1388
- Use `@pypi_base` to set common packages required by all
1389
- steps and use `@pypi` to specify step-specific overrides.
1390
- Parameters
1391
- ----------
1392
- packages : Dict[str, str], default: {}
1393
- Packages to use for this flow. The key is the name of the package
1394
- and the value is the version to use.
1395
- python : str, optional, default: None
1396
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1397
- that the version used will correspond to the version of the Python interpreter used to start the run.
1398
- """
954
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1399
955
  ...
1400
956
 
1401
957
  @typing.overload
1402
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
958
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1403
959
  ...
1404
960
 
1405
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
961
+ 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):
1406
962
  """
1407
- Specifies the PyPI packages for all steps of the flow.
963
+ Specifies the resources needed when executing this step.
964
+
965
+ Use `@resources` to specify the resource requirements
966
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
967
+
968
+ You can choose the compute layer on the command line by executing e.g.
969
+ ```
970
+ python myflow.py run --with batch
971
+ ```
972
+ or
973
+ ```
974
+ python myflow.py run --with kubernetes
975
+ ```
976
+ which executes the flow on the desired system using the
977
+ requirements specified in `@resources`.
1408
978
 
1409
- Use `@pypi_base` to set common packages required by all
1410
- steps and use `@pypi` to specify step-specific overrides.
1411
979
  Parameters
1412
980
  ----------
1413
- packages : Dict[str, str], default: {}
1414
- Packages to use for this flow. The key is the name of the package
1415
- and the value is the version to use.
1416
- python : str, optional, default: None
1417
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1418
- that the version used will correspond to the version of the Python interpreter used to start the run.
981
+ cpu : int, default 1
982
+ Number of CPUs required for this step.
983
+ gpu : int, default 0
984
+ Number of GPUs required for this step.
985
+ disk : int, optional, default None
986
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
987
+ memory : int, default 4096
988
+ Memory size (in MB) required for this step.
989
+ shared_memory : int, optional, default None
990
+ The value for the size (in MiB) of the /dev/shm volume for this step.
991
+ This parameter maps to the `--shm-size` option in Docker.
1419
992
  """
1420
993
  ...
1421
994
 
1422
995
  @typing.overload
1423
- 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]]:
996
+ 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]]:
1424
997
  """
1425
- Specifies the times when the flow should be run when running on a
1426
- production scheduler.
998
+ Specifies the event(s) that this flow depends on.
999
+
1000
+ ```
1001
+ @trigger(event='foo')
1002
+ ```
1003
+ or
1004
+ ```
1005
+ @trigger(events=['foo', 'bar'])
1006
+ ```
1007
+
1008
+ Additionally, you can specify the parameter mappings
1009
+ to map event payload to Metaflow parameters for the flow.
1010
+ ```
1011
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1012
+ ```
1013
+ or
1014
+ ```
1015
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1016
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1017
+ ```
1018
+
1019
+ 'parameters' can also be a list of strings and tuples like so:
1020
+ ```
1021
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1022
+ ```
1023
+ This is equivalent to:
1024
+ ```
1025
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1026
+ ```
1427
1027
 
1428
1028
  Parameters
1429
1029
  ----------
1430
- hourly : bool, default False
1431
- Run the workflow hourly.
1432
- daily : bool, default True
1433
- Run the workflow daily.
1434
- weekly : bool, default False
1435
- Run the workflow weekly.
1436
- cron : str, optional, default None
1437
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1438
- specified by this expression.
1439
- timezone : str, optional, default None
1440
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1441
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1030
+ event : Union[str, Dict[str, Any]], optional, default None
1031
+ Event dependency for this flow.
1032
+ events : List[Union[str, Dict[str, Any]]], default []
1033
+ Events dependency for this flow.
1034
+ options : Dict[str, Any], default {}
1035
+ Backend-specific configuration for tuning eventing behavior.
1036
+
1037
+
1442
1038
  """
1443
1039
  ...
1444
1040
 
1445
1041
  @typing.overload
1446
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1042
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1447
1043
  ...
1448
1044
 
1449
- 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):
1045
+ 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] = {}):
1450
1046
  """
1451
- Specifies the times when the flow should be run when running on a
1452
- production scheduler.
1047
+ Specifies the event(s) that this flow depends on.
1453
1048
 
1454
- Parameters
1455
- ----------
1456
- hourly : bool, default False
1457
- Run the workflow hourly.
1458
- daily : bool, default True
1459
- Run the workflow daily.
1460
- weekly : bool, default False
1461
- Run the workflow weekly.
1462
- cron : str, optional, default None
1463
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1464
- specified by this expression.
1465
- timezone : str, optional, default None
1466
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1467
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1468
- """
1469
- ...
1470
-
1471
- 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]]:
1472
- """
1473
- 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)
1474
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1475
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1476
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1477
- starts only after all sensors finish.
1049
+ ```
1050
+ @trigger(event='foo')
1051
+ ```
1052
+ or
1053
+ ```
1054
+ @trigger(events=['foo', 'bar'])
1055
+ ```
1056
+
1057
+ Additionally, you can specify the parameter mappings
1058
+ to map event payload to Metaflow parameters for the flow.
1059
+ ```
1060
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1061
+ ```
1062
+ or
1063
+ ```
1064
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1065
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1066
+ ```
1067
+
1068
+ 'parameters' can also be a list of strings and tuples like so:
1069
+ ```
1070
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1071
+ ```
1072
+ This is equivalent to:
1073
+ ```
1074
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1075
+ ```
1478
1076
 
1479
1077
  Parameters
1480
1078
  ----------
1481
- timeout : int
1482
- Time, in seconds before the task times out and fails. (Default: 3600)
1483
- poke_interval : int
1484
- Time in seconds that the job should wait in between each try. (Default: 60)
1485
- mode : str
1486
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1487
- exponential_backoff : bool
1488
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1489
- pool : str
1490
- the slot pool this task should run in,
1491
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1492
- soft_fail : bool
1493
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1494
- name : str
1495
- Name of the sensor on Airflow
1496
- description : str
1497
- Description of sensor in the Airflow UI
1498
- bucket_key : Union[str, List[str]]
1499
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1500
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1501
- bucket_name : str
1502
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1503
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1504
- wildcard_match : bool
1505
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1506
- aws_conn_id : str
1507
- a reference to the s3 connection on Airflow. (Default: None)
1508
- verify : bool
1509
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1079
+ event : Union[str, Dict[str, Any]], optional, default None
1080
+ Event dependency for this flow.
1081
+ events : List[Union[str, Dict[str, Any]]], default []
1082
+ Events dependency for this flow.
1083
+ options : Dict[str, Any], default {}
1084
+ Backend-specific configuration for tuning eventing behavior.
1085
+
1086
+
1510
1087
  """
1511
1088
  ...
1512
1089
 
@@ -1552,6 +1129,55 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1552
1129
  """
1553
1130
  ...
1554
1131
 
1132
+ @typing.overload
1133
+ 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]]:
1134
+ """
1135
+ Specifies the times when the flow should be run when running on a
1136
+ production scheduler.
1137
+
1138
+ Parameters
1139
+ ----------
1140
+ hourly : bool, default False
1141
+ Run the workflow hourly.
1142
+ daily : bool, default True
1143
+ Run the workflow daily.
1144
+ weekly : bool, default False
1145
+ Run the workflow weekly.
1146
+ cron : str, optional, default None
1147
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1148
+ specified by this expression.
1149
+ timezone : str, optional, default None
1150
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1151
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1152
+ """
1153
+ ...
1154
+
1155
+ @typing.overload
1156
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1157
+ ...
1158
+
1159
+ 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):
1160
+ """
1161
+ Specifies the times when the flow should be run when running on a
1162
+ production scheduler.
1163
+
1164
+ Parameters
1165
+ ----------
1166
+ hourly : bool, default False
1167
+ Run the workflow hourly.
1168
+ daily : bool, default True
1169
+ Run the workflow daily.
1170
+ weekly : bool, default False
1171
+ Run the workflow weekly.
1172
+ cron : str, optional, default None
1173
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1174
+ specified by this expression.
1175
+ timezone : str, optional, default None
1176
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1177
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1178
+ """
1179
+ ...
1180
+
1555
1181
  @typing.overload
1556
1182
  def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[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]]:
1557
1183
  """
@@ -1655,98 +1281,182 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1655
1281
  """
1656
1282
  ...
1657
1283
 
1658
- @typing.overload
1659
- 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]]:
1284
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1660
1285
  """
1661
- Specifies the event(s) that this flow depends on.
1286
+ Specifies what flows belong to the same project.
1662
1287
 
1663
- ```
1664
- @trigger(event='foo')
1665
- ```
1666
- or
1667
- ```
1668
- @trigger(events=['foo', 'bar'])
1669
- ```
1288
+ A project-specific namespace is created for all flows that
1289
+ use the same `@project(name)`.
1670
1290
 
1671
- Additionally, you can specify the parameter mappings
1672
- to map event payload to Metaflow parameters for the flow.
1673
- ```
1674
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1675
- ```
1676
- or
1677
- ```
1678
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1679
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1680
- ```
1291
+ Parameters
1292
+ ----------
1293
+ name : str
1294
+ Project name. Make sure that the name is unique amongst all
1295
+ projects that use the same production scheduler. The name may
1296
+ contain only lowercase alphanumeric characters and underscores.
1681
1297
 
1682
- 'parameters' can also be a list of strings and tuples like so:
1683
- ```
1684
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1685
- ```
1686
- This is equivalent to:
1687
- ```
1688
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1689
- ```
1298
+
1299
+ """
1300
+ ...
1301
+
1302
+ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1303
+ """
1304
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1305
+
1306
+ User code call
1307
+ -----------
1308
+ @nim(
1309
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1310
+ backend='managed'
1311
+ )
1312
+
1313
+ Valid backend options
1314
+ ---------------------
1315
+ - 'managed': Outerbounds selects a compute provider based on the model.
1316
+ - 🚧 'dataplane': Run in your account.
1317
+
1318
+ Valid model options
1319
+ ----------------
1320
+ - 'meta/llama3-8b-instruct': 8B parameter model
1321
+ - 'meta/llama3-70b-instruct': 70B parameter model
1322
+ - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1690
1323
 
1691
1324
  Parameters
1692
1325
  ----------
1693
- event : Union[str, Dict[str, Any]], optional, default None
1694
- Event dependency for this flow.
1695
- events : List[Union[str, Dict[str, Any]]], default []
1696
- Events dependency for this flow.
1697
- options : Dict[str, Any], default {}
1698
- Backend-specific configuration for tuning eventing behavior.
1699
-
1326
+ models: list[NIM]
1327
+ List of NIM containers running models in sidecars.
1328
+ backend: str
1329
+ Compute provider to run the NIM container.
1330
+ """
1331
+ ...
1332
+
1333
+ @typing.overload
1334
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1335
+ """
1336
+ Specifies the PyPI packages for all steps of the flow.
1700
1337
 
1338
+ Use `@pypi_base` to set common packages required by all
1339
+ steps and use `@pypi` to specify step-specific overrides.
1340
+ Parameters
1341
+ ----------
1342
+ packages : Dict[str, str], default: {}
1343
+ Packages to use for this flow. The key is the name of the package
1344
+ and the value is the version to use.
1345
+ python : str, optional, default: None
1346
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1347
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1701
1348
  """
1702
1349
  ...
1703
1350
 
1704
1351
  @typing.overload
1705
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1352
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1706
1353
  ...
1707
1354
 
1708
- 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] = {}):
1355
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1709
1356
  """
1710
- Specifies the event(s) that this flow depends on.
1711
-
1712
- ```
1713
- @trigger(event='foo')
1714
- ```
1715
- or
1716
- ```
1717
- @trigger(events=['foo', 'bar'])
1718
- ```
1357
+ Specifies the PyPI packages for all steps of the flow.
1719
1358
 
1720
- Additionally, you can specify the parameter mappings
1721
- to map event payload to Metaflow parameters for the flow.
1722
- ```
1723
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1724
- ```
1725
- or
1726
- ```
1727
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1728
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1729
- ```
1359
+ Use `@pypi_base` to set common packages required by all
1360
+ steps and use `@pypi` to specify step-specific overrides.
1361
+ Parameters
1362
+ ----------
1363
+ packages : Dict[str, str], default: {}
1364
+ Packages to use for this flow. The key is the name of the package
1365
+ and the value is the version to use.
1366
+ python : str, optional, default: None
1367
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1368
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1369
+ """
1370
+ ...
1371
+
1372
+ @typing.overload
1373
+ def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1374
+ """
1375
+ Specifies the Conda environment for all steps of the flow.
1730
1376
 
1731
- 'parameters' can also be a list of strings and tuples like so:
1732
- ```
1733
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1734
- ```
1735
- This is equivalent to:
1736
- ```
1737
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1738
- ```
1377
+ Use `@conda_base` to set common libraries required by all
1378
+ steps and use `@conda` to specify step-specific additions.
1739
1379
 
1740
1380
  Parameters
1741
1381
  ----------
1742
- event : Union[str, Dict[str, Any]], optional, default None
1743
- Event dependency for this flow.
1744
- events : List[Union[str, Dict[str, Any]]], default []
1745
- Events dependency for this flow.
1746
- options : Dict[str, Any], default {}
1747
- Backend-specific configuration for tuning eventing behavior.
1382
+ packages : Dict[str, str], default {}
1383
+ Packages to use for this flow. The key is the name of the package
1384
+ and the value is the version to use.
1385
+ libraries : Dict[str, str], default {}
1386
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1387
+ python : str, optional, default None
1388
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1389
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1390
+ disabled : bool, default False
1391
+ If set to True, disables Conda.
1392
+ """
1393
+ ...
1394
+
1395
+ @typing.overload
1396
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1397
+ ...
1398
+
1399
+ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1400
+ """
1401
+ Specifies the Conda environment for all steps of the flow.
1748
1402
 
1403
+ Use `@conda_base` to set common libraries required by all
1404
+ steps and use `@conda` to specify step-specific additions.
1405
+
1406
+ Parameters
1407
+ ----------
1408
+ packages : Dict[str, str], default {}
1409
+ Packages to use for this flow. The key is the name of the package
1410
+ and the value is the version to use.
1411
+ libraries : Dict[str, str], default {}
1412
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1413
+ python : str, optional, default None
1414
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1415
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1416
+ disabled : bool, default False
1417
+ If set to True, disables Conda.
1418
+ """
1419
+ ...
1420
+
1421
+ 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]]:
1422
+ """
1423
+ 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)
1424
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1425
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1426
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1427
+ starts only after all sensors finish.
1749
1428
 
1429
+ Parameters
1430
+ ----------
1431
+ timeout : int
1432
+ Time, in seconds before the task times out and fails. (Default: 3600)
1433
+ poke_interval : int
1434
+ Time in seconds that the job should wait in between each try. (Default: 60)
1435
+ mode : str
1436
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1437
+ exponential_backoff : bool
1438
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1439
+ pool : str
1440
+ the slot pool this task should run in,
1441
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1442
+ soft_fail : bool
1443
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1444
+ name : str
1445
+ Name of the sensor on Airflow
1446
+ description : str
1447
+ Description of sensor in the Airflow UI
1448
+ bucket_key : Union[str, List[str]]
1449
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1450
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1451
+ bucket_name : str
1452
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1453
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1454
+ wildcard_match : bool
1455
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1456
+ aws_conn_id : str
1457
+ a reference to the s3 connection on Airflow. (Default: None)
1458
+ verify : bool
1459
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1750
1460
  """
1751
1461
  ...
1752
1462