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