ob-metaflow-stubs 6.0.3.115__py2.py3-none-any.whl → 6.0.3.117__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 +539 -536
- metaflow-stubs/cards.pyi +5 -5
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +3 -3
- metaflow-stubs/client/core.pyi +6 -6
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/clone_util.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +5 -5
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata/metadata.pyi +3 -3
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +103 -67
- metaflow-stubs/mflog/mflog.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +3 -3
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- 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 +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +5 -5
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +7 -7
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_cli.pyi +4 -4
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +3 -3
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +4 -4
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
- metaflow-stubs/plugins/datatools/s3/s3.pyi +7 -7
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +3 -3
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +4 -4
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/logs_cli.pyi +3 -3
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +3 -3
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +3 -3
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/tag_cli.pyi +4 -4
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/procpoll.pyi +2 -2
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +3 -3
- metaflow-stubs/runner/metaflow_runner.pyi +5 -5
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +3 -3
- metaflow-stubs/system/system_logger.pyi +3 -3
- metaflow-stubs/system/system_monitor.pyi +3 -3
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- {ob_metaflow_stubs-6.0.3.115.dist-info → ob_metaflow_stubs-6.0.3.117.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.117.dist-info/RECORD +140 -0
- {ob_metaflow_stubs-6.0.3.115.dist-info → ob_metaflow_stubs-6.0.3.117.dist-info}/WHEEL +1 -1
- ob_metaflow_stubs-6.0.3.115.dist-info/RECORD +0 -140
- {ob_metaflow_stubs-6.0.3.115.dist-info → ob_metaflow_stubs-6.0.3.117.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
|
-
# MF version: 2.12.27.1+obcheckpoint(0.1.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.27.1+obcheckpoint(0.1.2);ob(v1) #
|
4
|
+
# Generated on 2024-11-13T19:05:29.340728 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import
|
12
|
-
import metaflow.metaflow_current
|
11
|
+
import metaflow.flowspec
|
13
12
|
import datetime
|
14
|
-
import metaflow._vendor.click.types
|
15
|
-
import metaflow.runner.metaflow_runner
|
16
|
-
import metaflow.parameters
|
17
|
-
import metaflow.events
|
18
13
|
import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
|
19
14
|
import metaflow.client.core
|
15
|
+
import metaflow.parameters
|
16
|
+
import metaflow._vendor.click.types
|
17
|
+
import metaflow.events
|
18
|
+
import metaflow.metaflow_current
|
19
|
+
import metaflow.runner.metaflow_runner
|
20
20
|
import metaflow.datastore.inputs
|
21
|
-
import
|
21
|
+
import typing
|
22
22
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
23
23
|
StepFlag = typing.NewType("StepFlag", bool)
|
24
24
|
|
@@ -513,174 +513,153 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
513
513
|
...
|
514
514
|
|
515
515
|
@typing.overload
|
516
|
-
def
|
517
|
-
"""
|
518
|
-
Internal decorator to support Fast bakery
|
519
|
-
"""
|
520
|
-
...
|
521
|
-
|
522
|
-
@typing.overload
|
523
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
524
|
-
...
|
525
|
-
|
526
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
527
|
-
"""
|
528
|
-
Internal decorator to support Fast bakery
|
529
|
-
"""
|
530
|
-
...
|
531
|
-
|
532
|
-
@typing.overload
|
533
|
-
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]]]:
|
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]]]:
|
534
517
|
"""
|
535
|
-
|
536
|
-
|
518
|
+
Enables loading / saving of models within a step.
|
519
|
+
|
537
520
|
|
538
521
|
Parameters
|
539
522
|
----------
|
540
|
-
|
541
|
-
|
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
|
+
|
542
539
|
"""
|
543
540
|
...
|
544
541
|
|
545
542
|
@typing.overload
|
546
|
-
def
|
543
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
547
544
|
...
|
548
545
|
|
549
546
|
@typing.overload
|
550
|
-
def
|
547
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
551
548
|
...
|
552
549
|
|
553
|
-
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):
|
554
551
|
"""
|
555
|
-
|
556
|
-
|
552
|
+
Enables loading / saving of models within a step.
|
553
|
+
|
557
554
|
|
558
555
|
Parameters
|
559
556
|
----------
|
560
|
-
|
561
|
-
|
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
|
+
|
562
573
|
"""
|
563
574
|
...
|
564
575
|
|
565
576
|
@typing.overload
|
566
|
-
def
|
577
|
+
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]]]:
|
567
578
|
"""
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
Parameters
|
572
|
-
----------
|
573
|
-
load_policy : str, default: "fresh"
|
574
|
-
The policy for loading the checkpoint. The following policies are supported:
|
575
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
576
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
577
|
-
will be loaded at the start of the task.
|
578
|
-
- "none": Do not load any checkpoint
|
579
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
580
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
581
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
582
|
-
created within the task will be loaded when the task is retries execution on failure.
|
579
|
+
Specifies a timeout for your step.
|
583
580
|
|
584
|
-
|
585
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
581
|
+
This decorator is useful if this step may hang indefinitely.
|
586
582
|
|
583
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
584
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
585
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
587
586
|
|
587
|
+
Note that all the values specified in parameters are added together so if you specify
|
588
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
588
589
|
|
590
|
+
Parameters
|
591
|
+
----------
|
592
|
+
seconds : int, default 0
|
593
|
+
Number of seconds to wait prior to timing out.
|
594
|
+
minutes : int, default 0
|
595
|
+
Number of minutes to wait prior to timing out.
|
596
|
+
hours : int, default 0
|
597
|
+
Number of hours to wait prior to timing out.
|
589
598
|
"""
|
590
599
|
...
|
591
600
|
|
592
601
|
@typing.overload
|
593
|
-
def
|
602
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
594
603
|
...
|
595
604
|
|
596
605
|
@typing.overload
|
597
|
-
def
|
606
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
598
607
|
...
|
599
608
|
|
600
|
-
def
|
609
|
+
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):
|
601
610
|
"""
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
Parameters
|
606
|
-
----------
|
607
|
-
load_policy : str, default: "fresh"
|
608
|
-
The policy for loading the checkpoint. The following policies are supported:
|
609
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
610
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
611
|
-
will be loaded at the start of the task.
|
612
|
-
- "none": Do not load any checkpoint
|
613
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
614
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
615
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
616
|
-
created within the task will be loaded when the task is retries execution on failure.
|
611
|
+
Specifies a timeout for your step.
|
617
612
|
|
618
|
-
|
619
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
613
|
+
This decorator is useful if this step may hang indefinitely.
|
620
614
|
|
615
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
616
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
617
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
621
618
|
|
619
|
+
Note that all the values specified in parameters are added together so if you specify
|
620
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
622
621
|
|
622
|
+
Parameters
|
623
|
+
----------
|
624
|
+
seconds : int, default 0
|
625
|
+
Number of seconds to wait prior to timing out.
|
626
|
+
minutes : int, default 0
|
627
|
+
Number of minutes to wait prior to timing out.
|
628
|
+
hours : int, default 0
|
629
|
+
Number of hours to wait prior to timing out.
|
623
630
|
"""
|
624
631
|
...
|
625
632
|
|
626
633
|
@typing.overload
|
627
|
-
def
|
634
|
+
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]]]:
|
628
635
|
"""
|
629
|
-
|
630
|
-
|
636
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
637
|
+
the execution of a step.
|
631
638
|
|
632
639
|
Parameters
|
633
640
|
----------
|
634
|
-
|
635
|
-
|
636
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
637
|
-
- `current.checkpoint`
|
638
|
-
- `current.model`
|
639
|
-
- `current.huggingface_hub`
|
640
|
-
|
641
|
-
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
|
642
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
643
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
644
|
-
|
645
|
-
temp_dir_root : str, default: None
|
646
|
-
The root directory under which `current.model.loaded` will store loaded models
|
647
|
-
|
648
|
-
|
649
|
-
|
641
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
642
|
+
List of secret specs, defining how the secrets are to be retrieved
|
650
643
|
"""
|
651
644
|
...
|
652
645
|
|
653
646
|
@typing.overload
|
654
|
-
def
|
647
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
655
648
|
...
|
656
649
|
|
657
650
|
@typing.overload
|
658
|
-
def
|
651
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
659
652
|
...
|
660
653
|
|
661
|
-
def
|
654
|
+
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]]] = []):
|
662
655
|
"""
|
663
|
-
|
664
|
-
|
656
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
657
|
+
the execution of a step.
|
665
658
|
|
666
659
|
Parameters
|
667
660
|
----------
|
668
|
-
|
669
|
-
|
670
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
671
|
-
- `current.checkpoint`
|
672
|
-
- `current.model`
|
673
|
-
- `current.huggingface_hub`
|
674
|
-
|
675
|
-
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
|
676
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
677
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
678
|
-
|
679
|
-
temp_dir_root : str, default: None
|
680
|
-
The root directory under which `current.model.loaded` will store loaded models
|
681
|
-
|
682
|
-
|
683
|
-
|
661
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
662
|
+
List of secret specs, defining how the secrets are to be retrieved
|
684
663
|
"""
|
685
664
|
...
|
686
665
|
|
@@ -736,79 +715,152 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
736
715
|
...
|
737
716
|
|
738
717
|
@typing.overload
|
739
|
-
def
|
718
|
+
def retry(*, times: int = 3, minutes_between_retries: int = 2) -> 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]]]:
|
740
719
|
"""
|
741
|
-
Specifies the
|
720
|
+
Specifies the number of times the task corresponding
|
721
|
+
to a step needs to be retried.
|
742
722
|
|
743
|
-
|
744
|
-
|
723
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
724
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
725
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
745
726
|
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
```
|
750
|
-
or
|
751
|
-
```
|
752
|
-
python myflow.py run --with kubernetes
|
753
|
-
```
|
754
|
-
which executes the flow on the desired system using the
|
755
|
-
requirements specified in `@resources`.
|
727
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
728
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
729
|
+
ensuring that the flow execution can continue.
|
756
730
|
|
757
731
|
Parameters
|
758
732
|
----------
|
759
|
-
|
760
|
-
Number of
|
761
|
-
|
762
|
-
Number of
|
763
|
-
disk : int, optional, default None
|
764
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
765
|
-
memory : int, default 4096
|
766
|
-
Memory size (in MB) required for this step.
|
767
|
-
shared_memory : int, optional, default None
|
768
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
769
|
-
This parameter maps to the `--shm-size` option in Docker.
|
733
|
+
times : int, default 3
|
734
|
+
Number of times to retry this task.
|
735
|
+
minutes_between_retries : int, default 2
|
736
|
+
Number of minutes between retries.
|
770
737
|
"""
|
771
738
|
...
|
772
739
|
|
773
740
|
@typing.overload
|
774
|
-
def
|
741
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
775
742
|
...
|
776
743
|
|
777
744
|
@typing.overload
|
778
|
-
def
|
745
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
779
746
|
...
|
780
747
|
|
781
|
-
def
|
748
|
+
def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
|
782
749
|
"""
|
783
|
-
Specifies the
|
750
|
+
Specifies the number of times the task corresponding
|
751
|
+
to a step needs to be retried.
|
784
752
|
|
785
|
-
|
786
|
-
|
753
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
754
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
755
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
787
756
|
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
```
|
792
|
-
or
|
793
|
-
```
|
794
|
-
python myflow.py run --with kubernetes
|
795
|
-
```
|
796
|
-
which executes the flow on the desired system using the
|
797
|
-
requirements specified in `@resources`.
|
757
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
758
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
759
|
+
ensuring that the flow execution can continue.
|
798
760
|
|
799
761
|
Parameters
|
800
762
|
----------
|
801
|
-
|
802
|
-
Number of
|
803
|
-
|
804
|
-
Number of
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
763
|
+
times : int, default 3
|
764
|
+
Number of times to retry this task.
|
765
|
+
minutes_between_retries : int, default 2
|
766
|
+
Number of minutes between retries.
|
767
|
+
"""
|
768
|
+
...
|
769
|
+
|
770
|
+
@typing.overload
|
771
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
772
|
+
"""
|
773
|
+
Decorator prototype for all step decorators. This function gets specialized
|
774
|
+
and imported for all decorators types by _import_plugin_decorators().
|
775
|
+
"""
|
776
|
+
...
|
777
|
+
|
778
|
+
@typing.overload
|
779
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
780
|
+
...
|
781
|
+
|
782
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
783
|
+
"""
|
784
|
+
Decorator prototype for all step decorators. This function gets specialized
|
785
|
+
and imported for all decorators types by _import_plugin_decorators().
|
786
|
+
"""
|
787
|
+
...
|
788
|
+
|
789
|
+
@typing.overload
|
790
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
791
|
+
"""
|
792
|
+
Internal decorator to support Fast bakery
|
793
|
+
"""
|
794
|
+
...
|
795
|
+
|
796
|
+
@typing.overload
|
797
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
798
|
+
...
|
799
|
+
|
800
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
801
|
+
"""
|
802
|
+
Internal decorator to support Fast bakery
|
803
|
+
"""
|
804
|
+
...
|
805
|
+
|
806
|
+
@typing.overload
|
807
|
+
def checkpoint(*, load_policy: str = "fresh", temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
808
|
+
"""
|
809
|
+
Enables checkpointing for a step.
|
810
|
+
|
811
|
+
|
812
|
+
Parameters
|
813
|
+
----------
|
814
|
+
load_policy : str, default: "fresh"
|
815
|
+
The policy for loading the checkpoint. The following policies are supported:
|
816
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
817
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
818
|
+
will be loaded at the start of the task.
|
819
|
+
- "none": Do not load any checkpoint
|
820
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
821
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
822
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
823
|
+
created within the task will be loaded when the task is retries execution on failure.
|
824
|
+
|
825
|
+
temp_dir_root : str, default: None
|
826
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
827
|
+
|
828
|
+
|
829
|
+
|
830
|
+
"""
|
831
|
+
...
|
832
|
+
|
833
|
+
@typing.overload
|
834
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
835
|
+
...
|
836
|
+
|
837
|
+
@typing.overload
|
838
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
839
|
+
...
|
840
|
+
|
841
|
+
def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = "fresh", temp_dir_root: str = None):
|
842
|
+
"""
|
843
|
+
Enables checkpointing for a step.
|
844
|
+
|
845
|
+
|
846
|
+
Parameters
|
847
|
+
----------
|
848
|
+
load_policy : str, default: "fresh"
|
849
|
+
The policy for loading the checkpoint. The following policies are supported:
|
850
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
851
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
852
|
+
will be loaded at the start of the task.
|
853
|
+
- "none": Do not load any checkpoint
|
854
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
855
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
856
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
857
|
+
created within the task will be loaded when the task is retries execution on failure.
|
858
|
+
|
859
|
+
temp_dir_root : str, default: None
|
860
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
861
|
+
|
862
|
+
|
863
|
+
|
812
864
|
"""
|
813
865
|
...
|
814
866
|
|
@@ -869,208 +921,127 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
869
921
|
"""
|
870
922
|
...
|
871
923
|
|
872
|
-
|
873
|
-
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]]]:
|
924
|
+
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], 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]]]:
|
874
925
|
"""
|
875
|
-
|
926
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
876
927
|
|
877
928
|
Parameters
|
878
929
|
----------
|
879
|
-
|
880
|
-
|
881
|
-
"""
|
882
|
-
...
|
883
|
-
|
884
|
-
@typing.overload
|
885
|
-
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
886
|
-
...
|
887
|
-
|
888
|
-
@typing.overload
|
889
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
890
|
-
...
|
891
|
-
|
892
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
893
|
-
"""
|
894
|
-
Specifies environment variables to be set prior to the execution of a step.
|
930
|
+
temp_dir_root : str, optional
|
931
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
895
932
|
|
896
|
-
|
897
|
-
|
898
|
-
vars : Dict[str, str], default {}
|
899
|
-
Dictionary of environment variables to set.
|
900
|
-
"""
|
901
|
-
...
|
902
|
-
|
903
|
-
@typing.overload
|
904
|
-
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]]]:
|
905
|
-
"""
|
906
|
-
Specifies that the step will success under all circumstances.
|
933
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
934
|
+
The list of models to load.
|
907
935
|
|
908
|
-
The decorator will create an optional artifact, specified by `var`, which
|
909
|
-
contains the exception raised. You can use it to detect the presence
|
910
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
911
|
-
are missing.
|
912
936
|
|
913
|
-
Parameters
|
914
|
-
----------
|
915
|
-
var : str, optional, default None
|
916
|
-
Name of the artifact in which to store the caught exception.
|
917
|
-
If not specified, the exception is not stored.
|
918
|
-
print_exception : bool, default True
|
919
|
-
Determines whether or not the exception is printed to
|
920
|
-
stdout when caught.
|
921
937
|
"""
|
922
938
|
...
|
923
939
|
|
924
940
|
@typing.overload
|
925
|
-
def
|
926
|
-
...
|
927
|
-
|
928
|
-
@typing.overload
|
929
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
930
|
-
...
|
931
|
-
|
932
|
-
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):
|
941
|
+
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, 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]]]:
|
933
942
|
"""
|
934
|
-
Specifies
|
935
|
-
|
936
|
-
The decorator will create an optional artifact, specified by `var`, which
|
937
|
-
contains the exception raised. You can use it to detect the presence
|
938
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
939
|
-
are missing.
|
943
|
+
Specifies the resources needed when executing this step.
|
940
944
|
|
941
|
-
|
942
|
-
|
943
|
-
var : str, optional, default None
|
944
|
-
Name of the artifact in which to store the caught exception.
|
945
|
-
If not specified, the exception is not stored.
|
946
|
-
print_exception : bool, default True
|
947
|
-
Determines whether or not the exception is printed to
|
948
|
-
stdout when caught.
|
949
|
-
"""
|
950
|
-
...
|
951
|
-
|
952
|
-
@typing.overload
|
953
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
954
|
-
"""
|
955
|
-
Decorator prototype for all step decorators. This function gets specialized
|
956
|
-
and imported for all decorators types by _import_plugin_decorators().
|
957
|
-
"""
|
958
|
-
...
|
959
|
-
|
960
|
-
@typing.overload
|
961
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
962
|
-
...
|
963
|
-
|
964
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
965
|
-
"""
|
966
|
-
Decorator prototype for all step decorators. This function gets specialized
|
967
|
-
and imported for all decorators types by _import_plugin_decorators().
|
968
|
-
"""
|
969
|
-
...
|
970
|
-
|
971
|
-
@typing.overload
|
972
|
-
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]]]:
|
973
|
-
"""
|
974
|
-
Specifies the PyPI packages for the step.
|
945
|
+
Use `@resources` to specify the resource requirements
|
946
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
975
947
|
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
948
|
+
You can choose the compute layer on the command line by executing e.g.
|
949
|
+
```
|
950
|
+
python myflow.py run --with batch
|
951
|
+
```
|
952
|
+
or
|
953
|
+
```
|
954
|
+
python myflow.py run --with kubernetes
|
955
|
+
```
|
956
|
+
which executes the flow on the desired system using the
|
957
|
+
requirements specified in `@resources`.
|
980
958
|
|
981
959
|
Parameters
|
982
960
|
----------
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
961
|
+
cpu : int, default 1
|
962
|
+
Number of CPUs required for this step.
|
963
|
+
gpu : int, optional, default None
|
964
|
+
Number of GPUs required for this step.
|
965
|
+
disk : int, optional, default None
|
966
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
967
|
+
memory : int, default 4096
|
968
|
+
Memory size (in MB) required for this step.
|
969
|
+
shared_memory : int, optional, default None
|
970
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
971
|
+
This parameter maps to the `--shm-size` option in Docker.
|
989
972
|
"""
|
990
973
|
...
|
991
974
|
|
992
975
|
@typing.overload
|
993
|
-
def
|
976
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
994
977
|
...
|
995
978
|
|
996
979
|
@typing.overload
|
997
|
-
def
|
980
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
998
981
|
...
|
999
982
|
|
1000
|
-
def
|
983
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
1001
984
|
"""
|
1002
|
-
Specifies the
|
985
|
+
Specifies the resources needed when executing this step.
|
1003
986
|
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
987
|
+
Use `@resources` to specify the resource requirements
|
988
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
989
|
+
|
990
|
+
You can choose the compute layer on the command line by executing e.g.
|
991
|
+
```
|
992
|
+
python myflow.py run --with batch
|
993
|
+
```
|
994
|
+
or
|
995
|
+
```
|
996
|
+
python myflow.py run --with kubernetes
|
997
|
+
```
|
998
|
+
which executes the flow on the desired system using the
|
999
|
+
requirements specified in `@resources`.
|
1008
1000
|
|
1009
1001
|
Parameters
|
1010
1002
|
----------
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1003
|
+
cpu : int, default 1
|
1004
|
+
Number of CPUs required for this step.
|
1005
|
+
gpu : int, optional, default None
|
1006
|
+
Number of GPUs required for this step.
|
1007
|
+
disk : int, optional, default None
|
1008
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1009
|
+
memory : int, default 4096
|
1010
|
+
Memory size (in MB) required for this step.
|
1011
|
+
shared_memory : int, optional, default None
|
1012
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1013
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1017
1014
|
"""
|
1018
1015
|
...
|
1019
1016
|
|
1020
1017
|
@typing.overload
|
1021
|
-
def
|
1018
|
+
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]]]:
|
1022
1019
|
"""
|
1023
|
-
Specifies
|
1024
|
-
|
1025
|
-
This decorator is useful if this step may hang indefinitely.
|
1026
|
-
|
1027
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1028
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1029
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1030
|
-
|
1031
|
-
Note that all the values specified in parameters are added together so if you specify
|
1032
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1020
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1033
1021
|
|
1034
1022
|
Parameters
|
1035
1023
|
----------
|
1036
|
-
|
1037
|
-
|
1038
|
-
minutes : int, default 0
|
1039
|
-
Number of minutes to wait prior to timing out.
|
1040
|
-
hours : int, default 0
|
1041
|
-
Number of hours to wait prior to timing out.
|
1024
|
+
vars : Dict[str, str], default {}
|
1025
|
+
Dictionary of environment variables to set.
|
1042
1026
|
"""
|
1043
1027
|
...
|
1044
1028
|
|
1045
1029
|
@typing.overload
|
1046
|
-
def
|
1030
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1047
1031
|
...
|
1048
1032
|
|
1049
1033
|
@typing.overload
|
1050
|
-
def
|
1034
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1051
1035
|
...
|
1052
1036
|
|
1053
|
-
def
|
1037
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1054
1038
|
"""
|
1055
|
-
Specifies
|
1056
|
-
|
1057
|
-
This decorator is useful if this step may hang indefinitely.
|
1058
|
-
|
1059
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1060
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1061
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1062
|
-
|
1063
|
-
Note that all the values specified in parameters are added together so if you specify
|
1064
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1039
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1065
1040
|
|
1066
1041
|
Parameters
|
1067
1042
|
----------
|
1068
|
-
|
1069
|
-
|
1070
|
-
minutes : int, default 0
|
1071
|
-
Number of minutes to wait prior to timing out.
|
1072
|
-
hours : int, default 0
|
1073
|
-
Number of hours to wait prior to timing out.
|
1043
|
+
vars : Dict[str, str], default {}
|
1044
|
+
Dictionary of environment variables to set.
|
1074
1045
|
"""
|
1075
1046
|
...
|
1076
1047
|
|
@@ -1143,100 +1114,101 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
1143
1114
|
"""
|
1144
1115
|
...
|
1145
1116
|
|
1146
|
-
def huggingface_hub(*, temp_dir_root: 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]]]:
|
1147
|
-
"""
|
1148
|
-
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
1149
|
-
|
1150
|
-
Parameters
|
1151
|
-
----------
|
1152
|
-
temp_dir_root : str, optional
|
1153
|
-
The root directory that will hold the temporary directory where objects will be downloaded.
|
1154
|
-
|
1155
|
-
|
1156
|
-
"""
|
1157
|
-
...
|
1158
|
-
|
1159
1117
|
@typing.overload
|
1160
|
-
def
|
1118
|
+
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]]]:
|
1161
1119
|
"""
|
1162
|
-
Specifies the
|
1163
|
-
to a step needs to be retried.
|
1164
|
-
|
1165
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1166
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1167
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1120
|
+
Specifies that the step will success under all circumstances.
|
1168
1121
|
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1122
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1123
|
+
contains the exception raised. You can use it to detect the presence
|
1124
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1125
|
+
are missing.
|
1172
1126
|
|
1173
1127
|
Parameters
|
1174
1128
|
----------
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1129
|
+
var : str, optional, default None
|
1130
|
+
Name of the artifact in which to store the caught exception.
|
1131
|
+
If not specified, the exception is not stored.
|
1132
|
+
print_exception : bool, default True
|
1133
|
+
Determines whether or not the exception is printed to
|
1134
|
+
stdout when caught.
|
1179
1135
|
"""
|
1180
1136
|
...
|
1181
1137
|
|
1182
1138
|
@typing.overload
|
1183
|
-
def
|
1139
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1184
1140
|
...
|
1185
1141
|
|
1186
1142
|
@typing.overload
|
1187
|
-
def
|
1143
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1188
1144
|
...
|
1189
1145
|
|
1190
|
-
def
|
1146
|
+
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):
|
1191
1147
|
"""
|
1192
|
-
Specifies the
|
1193
|
-
to a step needs to be retried.
|
1194
|
-
|
1195
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1196
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1197
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1148
|
+
Specifies that the step will success under all circumstances.
|
1198
1149
|
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1150
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1151
|
+
contains the exception raised. You can use it to detect the presence
|
1152
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1153
|
+
are missing.
|
1202
1154
|
|
1203
1155
|
Parameters
|
1204
1156
|
----------
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1157
|
+
var : str, optional, default None
|
1158
|
+
Name of the artifact in which to store the caught exception.
|
1159
|
+
If not specified, the exception is not stored.
|
1160
|
+
print_exception : bool, default True
|
1161
|
+
Determines whether or not the exception is printed to
|
1162
|
+
stdout when caught.
|
1209
1163
|
"""
|
1210
1164
|
...
|
1211
1165
|
|
1212
|
-
|
1166
|
+
@typing.overload
|
1167
|
+
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]]]:
|
1213
1168
|
"""
|
1214
|
-
|
1169
|
+
Specifies the PyPI packages for the step.
|
1215
1170
|
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
backend='managed'
|
1221
|
-
)
|
1171
|
+
Information in this decorator will augment any
|
1172
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1173
|
+
you can use `@pypi_base` to set packages required by all
|
1174
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1222
1175
|
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1176
|
+
Parameters
|
1177
|
+
----------
|
1178
|
+
packages : Dict[str, str], default: {}
|
1179
|
+
Packages to use for this step. The key is the name of the package
|
1180
|
+
and the value is the version to use.
|
1181
|
+
python : str, optional, default: None
|
1182
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1183
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1184
|
+
"""
|
1185
|
+
...
|
1186
|
+
|
1187
|
+
@typing.overload
|
1188
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1189
|
+
...
|
1190
|
+
|
1191
|
+
@typing.overload
|
1192
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1193
|
+
...
|
1194
|
+
|
1195
|
+
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):
|
1196
|
+
"""
|
1197
|
+
Specifies the PyPI packages for the step.
|
1227
1198
|
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1199
|
+
Information in this decorator will augment any
|
1200
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1201
|
+
you can use `@pypi_base` to set packages required by all
|
1202
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1233
1203
|
|
1234
1204
|
Parameters
|
1235
1205
|
----------
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1206
|
+
packages : Dict[str, str], default: {}
|
1207
|
+
Packages to use for this step. The key is the name of the package
|
1208
|
+
and the value is the version to use.
|
1209
|
+
python : str, optional, default: None
|
1210
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1211
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1240
1212
|
"""
|
1241
1213
|
...
|
1242
1214
|
|
@@ -1343,84 +1315,98 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1343
1315
|
"""
|
1344
1316
|
...
|
1345
1317
|
|
1346
|
-
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]]:
|
1347
|
-
"""
|
1348
|
-
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.
|
1349
|
-
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.
|
1350
|
-
|
1351
|
-
Parameters
|
1352
|
-
----------
|
1353
|
-
timeout : int
|
1354
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1355
|
-
poke_interval : int
|
1356
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1357
|
-
mode : str
|
1358
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1359
|
-
exponential_backoff : bool
|
1360
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1361
|
-
pool : str
|
1362
|
-
the slot pool this task should run in,
|
1363
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1364
|
-
soft_fail : bool
|
1365
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1366
|
-
name : str
|
1367
|
-
Name of the sensor on Airflow
|
1368
|
-
description : str
|
1369
|
-
Description of sensor in the Airflow UI
|
1370
|
-
external_dag_id : str
|
1371
|
-
The dag_id that contains the task you want to wait for.
|
1372
|
-
external_task_ids : List[str]
|
1373
|
-
The list of task_ids that you want to wait for.
|
1374
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1375
|
-
allowed_states : List[str]
|
1376
|
-
Iterable of allowed states, (Default: ['success'])
|
1377
|
-
failed_states : List[str]
|
1378
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1379
|
-
execution_delta : datetime.timedelta
|
1380
|
-
time difference with the previous execution to look at,
|
1381
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1382
|
-
check_existence: bool
|
1383
|
-
Set to True to check if the external task exists or check if
|
1384
|
-
the DAG to wait for exists. (Default: True)
|
1385
|
-
"""
|
1386
|
-
...
|
1387
|
-
|
1388
1318
|
@typing.overload
|
1389
|
-
def
|
1319
|
+
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]]:
|
1390
1320
|
"""
|
1391
|
-
Specifies the
|
1321
|
+
Specifies the event(s) that this flow depends on.
|
1322
|
+
|
1323
|
+
```
|
1324
|
+
@trigger(event='foo')
|
1325
|
+
```
|
1326
|
+
or
|
1327
|
+
```
|
1328
|
+
@trigger(events=['foo', 'bar'])
|
1329
|
+
```
|
1330
|
+
|
1331
|
+
Additionally, you can specify the parameter mappings
|
1332
|
+
to map event payload to Metaflow parameters for the flow.
|
1333
|
+
```
|
1334
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1335
|
+
```
|
1336
|
+
or
|
1337
|
+
```
|
1338
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1339
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1340
|
+
```
|
1341
|
+
|
1342
|
+
'parameters' can also be a list of strings and tuples like so:
|
1343
|
+
```
|
1344
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1345
|
+
```
|
1346
|
+
This is equivalent to:
|
1347
|
+
```
|
1348
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1349
|
+
```
|
1392
1350
|
|
1393
|
-
Use `@pypi_base` to set common packages required by all
|
1394
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1395
1351
|
Parameters
|
1396
1352
|
----------
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1353
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1354
|
+
Event dependency for this flow.
|
1355
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1356
|
+
Events dependency for this flow.
|
1357
|
+
options : Dict[str, Any], default {}
|
1358
|
+
Backend-specific configuration for tuning eventing behavior.
|
1359
|
+
|
1360
|
+
|
1403
1361
|
"""
|
1404
1362
|
...
|
1405
1363
|
|
1406
1364
|
@typing.overload
|
1407
|
-
def
|
1365
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1408
1366
|
...
|
1409
1367
|
|
1410
|
-
def
|
1368
|
+
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] = {}):
|
1411
1369
|
"""
|
1412
|
-
Specifies the
|
1370
|
+
Specifies the event(s) that this flow depends on.
|
1371
|
+
|
1372
|
+
```
|
1373
|
+
@trigger(event='foo')
|
1374
|
+
```
|
1375
|
+
or
|
1376
|
+
```
|
1377
|
+
@trigger(events=['foo', 'bar'])
|
1378
|
+
```
|
1379
|
+
|
1380
|
+
Additionally, you can specify the parameter mappings
|
1381
|
+
to map event payload to Metaflow parameters for the flow.
|
1382
|
+
```
|
1383
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1384
|
+
```
|
1385
|
+
or
|
1386
|
+
```
|
1387
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1388
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1389
|
+
```
|
1390
|
+
|
1391
|
+
'parameters' can also be a list of strings and tuples like so:
|
1392
|
+
```
|
1393
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1394
|
+
```
|
1395
|
+
This is equivalent to:
|
1396
|
+
```
|
1397
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1398
|
+
```
|
1413
1399
|
|
1414
|
-
Use `@pypi_base` to set common packages required by all
|
1415
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1416
1400
|
Parameters
|
1417
1401
|
----------
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1402
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1403
|
+
Event dependency for this flow.
|
1404
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1405
|
+
Events dependency for this flow.
|
1406
|
+
options : Dict[str, Any], default {}
|
1407
|
+
Backend-specific configuration for tuning eventing behavior.
|
1408
|
+
|
1409
|
+
|
1424
1410
|
"""
|
1425
1411
|
...
|
1426
1412
|
|
@@ -1466,6 +1452,37 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1466
1452
|
"""
|
1467
1453
|
...
|
1468
1454
|
|
1455
|
+
def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1456
|
+
"""
|
1457
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1458
|
+
|
1459
|
+
User code call
|
1460
|
+
-----------
|
1461
|
+
@nim(
|
1462
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1463
|
+
backend='managed'
|
1464
|
+
)
|
1465
|
+
|
1466
|
+
Valid backend options
|
1467
|
+
---------------------
|
1468
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
1469
|
+
- 🚧 'dataplane': Run in your account.
|
1470
|
+
|
1471
|
+
Valid model options
|
1472
|
+
----------------
|
1473
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
1474
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
1475
|
+
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1476
|
+
|
1477
|
+
Parameters
|
1478
|
+
----------
|
1479
|
+
models: list[NIM]
|
1480
|
+
List of NIM containers running models in sidecars.
|
1481
|
+
backend: str
|
1482
|
+
Compute provider to run the NIM container.
|
1483
|
+
"""
|
1484
|
+
...
|
1485
|
+
|
1469
1486
|
@typing.overload
|
1470
1487
|
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]]:
|
1471
1488
|
"""
|
@@ -1515,116 +1532,84 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1515
1532
|
"""
|
1516
1533
|
...
|
1517
1534
|
|
1518
|
-
|
1519
|
-
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]]:
|
1535
|
+
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]]:
|
1520
1536
|
"""
|
1521
|
-
|
1522
|
-
|
1523
|
-
```
|
1524
|
-
@trigger(event='foo')
|
1525
|
-
```
|
1526
|
-
or
|
1527
|
-
```
|
1528
|
-
@trigger(events=['foo', 'bar'])
|
1529
|
-
```
|
1530
|
-
|
1531
|
-
Additionally, you can specify the parameter mappings
|
1532
|
-
to map event payload to Metaflow parameters for the flow.
|
1533
|
-
```
|
1534
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1535
|
-
```
|
1536
|
-
or
|
1537
|
-
```
|
1538
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1539
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1540
|
-
```
|
1541
|
-
|
1542
|
-
'parameters' can also be a list of strings and tuples like so:
|
1543
|
-
```
|
1544
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1545
|
-
```
|
1546
|
-
This is equivalent to:
|
1547
|
-
```
|
1548
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1549
|
-
```
|
1537
|
+
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.
|
1538
|
+
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.
|
1550
1539
|
|
1551
1540
|
Parameters
|
1552
1541
|
----------
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1542
|
+
timeout : int
|
1543
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1544
|
+
poke_interval : int
|
1545
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1546
|
+
mode : str
|
1547
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1548
|
+
exponential_backoff : bool
|
1549
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1550
|
+
pool : str
|
1551
|
+
the slot pool this task should run in,
|
1552
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1553
|
+
soft_fail : bool
|
1554
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1555
|
+
name : str
|
1556
|
+
Name of the sensor on Airflow
|
1557
|
+
description : str
|
1558
|
+
Description of sensor in the Airflow UI
|
1559
|
+
external_dag_id : str
|
1560
|
+
The dag_id that contains the task you want to wait for.
|
1561
|
+
external_task_ids : List[str]
|
1562
|
+
The list of task_ids that you want to wait for.
|
1563
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1564
|
+
allowed_states : List[str]
|
1565
|
+
Iterable of allowed states, (Default: ['success'])
|
1566
|
+
failed_states : List[str]
|
1567
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1568
|
+
execution_delta : datetime.timedelta
|
1569
|
+
time difference with the previous execution to look at,
|
1570
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1571
|
+
check_existence: bool
|
1572
|
+
Set to True to check if the external task exists or check if
|
1573
|
+
the DAG to wait for exists. (Default: True)
|
1561
1574
|
"""
|
1562
1575
|
...
|
1563
1576
|
|
1564
1577
|
@typing.overload
|
1565
|
-
def
|
1566
|
-
...
|
1567
|
-
|
1568
|
-
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
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1569
1579
|
"""
|
1570
|
-
Specifies the
|
1571
|
-
|
1572
|
-
```
|
1573
|
-
@trigger(event='foo')
|
1574
|
-
```
|
1575
|
-
or
|
1576
|
-
```
|
1577
|
-
@trigger(events=['foo', 'bar'])
|
1578
|
-
```
|
1579
|
-
|
1580
|
-
Additionally, you can specify the parameter mappings
|
1581
|
-
to map event payload to Metaflow parameters for the flow.
|
1582
|
-
```
|
1583
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1584
|
-
```
|
1585
|
-
or
|
1586
|
-
```
|
1587
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1588
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1589
|
-
```
|
1590
|
-
|
1591
|
-
'parameters' can also be a list of strings and tuples like so:
|
1592
|
-
```
|
1593
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1594
|
-
```
|
1595
|
-
This is equivalent to:
|
1596
|
-
```
|
1597
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1598
|
-
```
|
1580
|
+
Specifies the PyPI packages for all steps of the flow.
|
1599
1581
|
|
1582
|
+
Use `@pypi_base` to set common packages required by all
|
1583
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1600
1584
|
Parameters
|
1601
1585
|
----------
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1586
|
+
packages : Dict[str, str], default: {}
|
1587
|
+
Packages to use for this flow. The key is the name of the package
|
1588
|
+
and the value is the version to use.
|
1589
|
+
python : str, optional, default: None
|
1590
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1591
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1610
1592
|
"""
|
1611
1593
|
...
|
1612
1594
|
|
1613
|
-
|
1595
|
+
@typing.overload
|
1596
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1597
|
+
...
|
1598
|
+
|
1599
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1614
1600
|
"""
|
1615
|
-
Specifies
|
1616
|
-
|
1617
|
-
A project-specific namespace is created for all flows that
|
1618
|
-
use the same `@project(name)`.
|
1601
|
+
Specifies the PyPI packages for all steps of the flow.
|
1619
1602
|
|
1603
|
+
Use `@pypi_base` to set common packages required by all
|
1604
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1620
1605
|
Parameters
|
1621
1606
|
----------
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1607
|
+
packages : Dict[str, str], default: {}
|
1608
|
+
Packages to use for this flow. The key is the name of the package
|
1609
|
+
and the value is the version to use.
|
1610
|
+
python : str, optional, default: None
|
1611
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1612
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1628
1613
|
"""
|
1629
1614
|
...
|
1630
1615
|
|
@@ -1677,6 +1662,24 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1677
1662
|
"""
|
1678
1663
|
...
|
1679
1664
|
|
1665
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1666
|
+
"""
|
1667
|
+
Specifies what flows belong to the same project.
|
1668
|
+
|
1669
|
+
A project-specific namespace is created for all flows that
|
1670
|
+
use the same `@project(name)`.
|
1671
|
+
|
1672
|
+
Parameters
|
1673
|
+
----------
|
1674
|
+
name : str
|
1675
|
+
Project name. Make sure that the name is unique amongst all
|
1676
|
+
projects that use the same production scheduler. The name may
|
1677
|
+
contain only lowercase alphanumeric characters and underscores.
|
1678
|
+
|
1679
|
+
|
1680
|
+
"""
|
1681
|
+
...
|
1682
|
+
|
1680
1683
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1681
1684
|
"""
|
1682
1685
|
Switch namespace to the one provided.
|