ob-metaflow-stubs 5.10__py2.py3-none-any.whl → 6.0.3.102__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metaflow-stubs/__init__.pyi +742 -546
- metaflow-stubs/cards.pyi +4 -4
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +3 -3
- metaflow-stubs/client/core.pyi +7 -7
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/clone_util.pyi +2 -2
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata/metadata.pyi +2 -2
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +129 -5
- metaflow-stubs/mflog/mflog.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +2 -2
- metaflow-stubs/plugins/__init__.pyi +2 -2
- 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 +5 -5
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +7 -7
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +5 -5
- 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 +2 -2
- 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 +3 -3
- 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 +2 -2
- 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 +2 -2
- 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 +3 -3
- 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 +3 -3
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- 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 +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 +2 -2
- 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 +4 -4
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- {ob_metaflow_stubs-5.10.dist-info → ob_metaflow_stubs-6.0.3.102.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.102.dist-info/RECORD +140 -0
- {ob_metaflow_stubs-5.10.dist-info → ob_metaflow_stubs-6.0.3.102.dist-info}/WHEEL +1 -1
- ob_metaflow_stubs-5.10.dist-info/RECORD +0 -140
- {ob_metaflow_stubs-5.10.dist-info → ob_metaflow_stubs-6.0.3.102.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.22.1+ob(v1)
|
4
|
-
# Generated on 2024-09-
|
3
|
+
# MF version: 2.12.22.1+obcheckpoint(0.0.10);ob(v1) #
|
4
|
+
# Generated on 2024-09-20T19:48:37.143465 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import metaflow.events
|
12
11
|
import metaflow.datastore.inputs
|
13
|
-
import
|
14
|
-
import metaflow.metaflow_current
|
15
|
-
import metaflow.flowspec
|
12
|
+
import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
|
16
13
|
import datetime
|
14
|
+
import metaflow.parameters
|
15
|
+
import typing
|
16
|
+
import metaflow.runner.metaflow_runner
|
17
17
|
import metaflow.client.core
|
18
|
+
import metaflow.flowspec
|
19
|
+
import metaflow.metaflow_current
|
20
|
+
import metaflow.events
|
18
21
|
import metaflow._vendor.click.types
|
19
|
-
import typing
|
20
|
-
import metaflow.parameters
|
21
22
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
22
23
|
StepFlag = typing.NewType("StepFlag", bool)
|
23
24
|
|
@@ -434,309 +435,372 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
434
435
|
...
|
435
436
|
|
436
437
|
@typing.overload
|
437
|
-
def
|
438
|
+
def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
438
439
|
"""
|
439
|
-
|
440
|
+
Specifies the PyPI packages for the step.
|
440
441
|
|
441
|
-
|
442
|
+
Information in this decorator will augment any
|
443
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
444
|
+
you can use `@pypi_base` to set packages required by all
|
445
|
+
steps and use `@pypi` to specify step-specific overrides.
|
442
446
|
|
443
447
|
Parameters
|
444
448
|
----------
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
timeout : int, default 45
|
452
|
-
Interrupt reporting if it takes more than this many seconds.
|
453
|
-
|
454
|
-
|
449
|
+
packages : Dict[str, str], default: {}
|
450
|
+
Packages to use for this step. The key is the name of the package
|
451
|
+
and the value is the version to use.
|
452
|
+
python : str, optional, default: None
|
453
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
454
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
455
455
|
"""
|
456
456
|
...
|
457
457
|
|
458
458
|
@typing.overload
|
459
|
-
def
|
459
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
460
460
|
...
|
461
461
|
|
462
462
|
@typing.overload
|
463
|
-
def
|
463
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
464
464
|
...
|
465
465
|
|
466
|
-
def
|
466
|
+
def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
467
467
|
"""
|
468
|
-
|
468
|
+
Specifies the PyPI packages for the step.
|
469
469
|
|
470
|
-
|
470
|
+
Information in this decorator will augment any
|
471
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
472
|
+
you can use `@pypi_base` to set packages required by all
|
473
|
+
steps and use `@pypi` to specify step-specific overrides.
|
471
474
|
|
472
475
|
Parameters
|
473
476
|
----------
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
timeout : int, default 45
|
481
|
-
Interrupt reporting if it takes more than this many seconds.
|
482
|
-
|
483
|
-
|
477
|
+
packages : Dict[str, str], default: {}
|
478
|
+
Packages to use for this step. The key is the name of the package
|
479
|
+
and the value is the version to use.
|
480
|
+
python : str, optional, default: None
|
481
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
482
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
484
483
|
"""
|
485
484
|
...
|
486
485
|
|
487
486
|
@typing.overload
|
488
|
-
def
|
487
|
+
def checkpoint(*, load_policy: str = "fresh", temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
489
488
|
"""
|
490
|
-
|
489
|
+
Enables checkpointing for a step.
|
491
490
|
|
492
|
-
The decorator will create an optional artifact, specified by `var`, which
|
493
|
-
contains the exception raised. You can use it to detect the presence
|
494
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
495
|
-
are missing.
|
496
491
|
|
497
492
|
Parameters
|
498
493
|
----------
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
494
|
+
load_policy : str, default: "fresh"
|
495
|
+
The policy for loading the checkpoint. The following policies are supported:
|
496
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
497
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
498
|
+
will be loaded at the start of the task.
|
499
|
+
- "none": Do not load any checkpoint
|
500
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
501
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
502
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
503
|
+
created within the task will be loaded when the task is retries execution on failure.
|
504
|
+
|
505
|
+
temp_dir_root : str, default: None
|
506
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
507
|
+
|
508
|
+
|
509
|
+
|
505
510
|
"""
|
506
511
|
...
|
507
512
|
|
508
513
|
@typing.overload
|
509
|
-
def
|
514
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
510
515
|
...
|
511
516
|
|
512
517
|
@typing.overload
|
513
|
-
def
|
518
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
514
519
|
...
|
515
520
|
|
516
|
-
def
|
521
|
+
def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = "fresh", temp_dir_root: str = None):
|
517
522
|
"""
|
518
|
-
|
523
|
+
Enables checkpointing for a step.
|
519
524
|
|
520
|
-
The decorator will create an optional artifact, specified by `var`, which
|
521
|
-
contains the exception raised. You can use it to detect the presence
|
522
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
523
|
-
are missing.
|
524
525
|
|
525
526
|
Parameters
|
526
527
|
----------
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
528
|
+
load_policy : str, default: "fresh"
|
529
|
+
The policy for loading the checkpoint. The following policies are supported:
|
530
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
531
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
532
|
+
will be loaded at the start of the task.
|
533
|
+
- "none": Do not load any checkpoint
|
534
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
535
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
536
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
537
|
+
created within the task will be loaded when the task is retries execution on failure.
|
538
|
+
|
539
|
+
temp_dir_root : str, default: None
|
540
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
541
|
+
|
542
|
+
|
543
|
+
|
533
544
|
"""
|
534
545
|
...
|
535
546
|
|
536
547
|
@typing.overload
|
537
|
-
def
|
548
|
+
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
538
549
|
"""
|
539
|
-
Specifies the
|
550
|
+
Specifies the Conda environment for the step.
|
540
551
|
|
541
552
|
Information in this decorator will augment any
|
542
|
-
attributes set in the `@
|
543
|
-
you can use `@
|
544
|
-
steps and use `@
|
553
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
554
|
+
you can use `@conda_base` to set packages required by all
|
555
|
+
steps and use `@conda` to specify step-specific overrides.
|
545
556
|
|
546
557
|
Parameters
|
547
558
|
----------
|
548
|
-
packages : Dict[str, str], default
|
559
|
+
packages : Dict[str, str], default {}
|
549
560
|
Packages to use for this step. The key is the name of the package
|
550
561
|
and the value is the version to use.
|
551
|
-
|
562
|
+
libraries : Dict[str, str], default {}
|
563
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
564
|
+
python : str, optional, default None
|
552
565
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
553
566
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
567
|
+
disabled : bool, default False
|
568
|
+
If set to True, disables @conda.
|
554
569
|
"""
|
555
570
|
...
|
556
571
|
|
557
572
|
@typing.overload
|
558
|
-
def
|
573
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
559
574
|
...
|
560
575
|
|
561
576
|
@typing.overload
|
562
|
-
def
|
577
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
563
578
|
...
|
564
579
|
|
565
|
-
def
|
580
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
566
581
|
"""
|
567
|
-
Specifies the
|
582
|
+
Specifies the Conda environment for the step.
|
568
583
|
|
569
584
|
Information in this decorator will augment any
|
570
|
-
attributes set in the `@
|
571
|
-
you can use `@
|
572
|
-
steps and use `@
|
585
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
586
|
+
you can use `@conda_base` to set packages required by all
|
587
|
+
steps and use `@conda` to specify step-specific overrides.
|
573
588
|
|
574
589
|
Parameters
|
575
590
|
----------
|
576
|
-
packages : Dict[str, str], default
|
591
|
+
packages : Dict[str, str], default {}
|
577
592
|
Packages to use for this step. The key is the name of the package
|
578
593
|
and the value is the version to use.
|
579
|
-
|
594
|
+
libraries : Dict[str, str], default {}
|
595
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
596
|
+
python : str, optional, default None
|
580
597
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
581
598
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
599
|
+
disabled : bool, default False
|
600
|
+
If set to True, disables @conda.
|
582
601
|
"""
|
583
602
|
...
|
584
603
|
|
585
|
-
|
586
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
587
|
-
"""
|
588
|
-
Internal decorator to support Fast bakery
|
589
|
-
"""
|
590
|
-
...
|
591
|
-
|
592
|
-
@typing.overload
|
593
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
594
|
-
...
|
595
|
-
|
596
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
604
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
597
605
|
"""
|
598
|
-
|
606
|
+
Specifies that this step should execute on Kubernetes.
|
607
|
+
|
608
|
+
Parameters
|
609
|
+
----------
|
610
|
+
cpu : int, default 1
|
611
|
+
Number of CPUs required for this step. If `@resources` is
|
612
|
+
also present, the maximum value from all decorators is used.
|
613
|
+
memory : int, default 4096
|
614
|
+
Memory size (in MB) required for this step. If
|
615
|
+
`@resources` is also present, the maximum value from all decorators is
|
616
|
+
used.
|
617
|
+
disk : int, default 10240
|
618
|
+
Disk size (in MB) required for this step. If
|
619
|
+
`@resources` is also present, the maximum value from all decorators is
|
620
|
+
used.
|
621
|
+
image : str, optional, default None
|
622
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
623
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
624
|
+
not, a default Docker image mapping to the current version of Python is used.
|
625
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
626
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
627
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
628
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
629
|
+
secrets : List[str], optional, default None
|
630
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
631
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
632
|
+
in Metaflow configuration.
|
633
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
634
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
635
|
+
Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
|
636
|
+
or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
|
637
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
638
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
639
|
+
gpu : int, optional, default None
|
640
|
+
Number of GPUs required for this step. A value of zero implies that
|
641
|
+
the scheduled node should not have GPUs.
|
642
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
643
|
+
The vendor of the GPUs to be used for this step.
|
644
|
+
tolerations : List[str], default []
|
645
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
646
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
647
|
+
use_tmpfs : bool, default False
|
648
|
+
This enables an explicit tmpfs mount for this step.
|
649
|
+
tmpfs_tempdir : bool, default True
|
650
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
651
|
+
tmpfs_size : int, optional, default: None
|
652
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
653
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
654
|
+
memory allocated for this step.
|
655
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
656
|
+
Path to tmpfs mount for this step.
|
657
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
658
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
659
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
660
|
+
shared_memory: int, optional
|
661
|
+
Shared memory size (in MiB) required for this step
|
662
|
+
port: int, optional
|
663
|
+
Port number to specify in the Kubernetes job object
|
664
|
+
compute_pool : str, optional, default None
|
665
|
+
Compute pool to be used for for this step.
|
666
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
599
667
|
"""
|
600
668
|
...
|
601
669
|
|
602
670
|
@typing.overload
|
603
|
-
def
|
671
|
+
def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
604
672
|
"""
|
605
|
-
Specifies
|
606
|
-
|
607
|
-
Use `@resources` to specify the resource requirements
|
608
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
609
|
-
|
610
|
-
You can choose the compute layer on the command line by executing e.g.
|
611
|
-
```
|
612
|
-
python myflow.py run --with batch
|
613
|
-
```
|
614
|
-
or
|
615
|
-
```
|
616
|
-
python myflow.py run --with kubernetes
|
617
|
-
```
|
618
|
-
which executes the flow on the desired system using the
|
619
|
-
requirements specified in `@resources`.
|
673
|
+
Specifies environment variables to be set prior to the execution of a step.
|
620
674
|
|
621
675
|
Parameters
|
622
676
|
----------
|
623
|
-
|
624
|
-
|
625
|
-
gpu : int, default 0
|
626
|
-
Number of GPUs required for this step.
|
627
|
-
disk : int, optional, default None
|
628
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
629
|
-
memory : int, default 4096
|
630
|
-
Memory size (in MB) required for this step.
|
631
|
-
shared_memory : int, optional, default None
|
632
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
633
|
-
This parameter maps to the `--shm-size` option in Docker.
|
677
|
+
vars : Dict[str, str], default {}
|
678
|
+
Dictionary of environment variables to set.
|
634
679
|
"""
|
635
680
|
...
|
636
681
|
|
637
682
|
@typing.overload
|
638
|
-
def
|
683
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
639
684
|
...
|
640
685
|
|
641
686
|
@typing.overload
|
642
|
-
def
|
687
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
643
688
|
...
|
644
689
|
|
645
|
-
def
|
690
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
646
691
|
"""
|
647
|
-
Specifies
|
648
|
-
|
649
|
-
Use `@resources` to specify the resource requirements
|
650
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
651
|
-
|
652
|
-
You can choose the compute layer on the command line by executing e.g.
|
653
|
-
```
|
654
|
-
python myflow.py run --with batch
|
655
|
-
```
|
656
|
-
or
|
657
|
-
```
|
658
|
-
python myflow.py run --with kubernetes
|
659
|
-
```
|
660
|
-
which executes the flow on the desired system using the
|
661
|
-
requirements specified in `@resources`.
|
692
|
+
Specifies environment variables to be set prior to the execution of a step.
|
662
693
|
|
663
694
|
Parameters
|
664
695
|
----------
|
665
|
-
|
666
|
-
|
667
|
-
gpu : int, default 0
|
668
|
-
Number of GPUs required for this step.
|
669
|
-
disk : int, optional, default None
|
670
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
671
|
-
memory : int, default 4096
|
672
|
-
Memory size (in MB) required for this step.
|
673
|
-
shared_memory : int, optional, default None
|
674
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
675
|
-
This parameter maps to the `--shm-size` option in Docker.
|
696
|
+
vars : Dict[str, str], default {}
|
697
|
+
Dictionary of environment variables to set.
|
676
698
|
"""
|
677
699
|
...
|
678
700
|
|
679
701
|
@typing.overload
|
680
|
-
def
|
702
|
+
def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
681
703
|
"""
|
682
|
-
Specifies
|
683
|
-
|
704
|
+
Specifies a timeout for your step.
|
705
|
+
|
706
|
+
This decorator is useful if this step may hang indefinitely.
|
707
|
+
|
708
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
709
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
710
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
711
|
+
|
712
|
+
Note that all the values specified in parameters are added together so if you specify
|
713
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
684
714
|
|
685
715
|
Parameters
|
686
716
|
----------
|
687
|
-
|
688
|
-
|
717
|
+
seconds : int, default 0
|
718
|
+
Number of seconds to wait prior to timing out.
|
719
|
+
minutes : int, default 0
|
720
|
+
Number of minutes to wait prior to timing out.
|
721
|
+
hours : int, default 0
|
722
|
+
Number of hours to wait prior to timing out.
|
689
723
|
"""
|
690
724
|
...
|
691
725
|
|
692
726
|
@typing.overload
|
693
|
-
def
|
727
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
694
728
|
...
|
695
729
|
|
696
730
|
@typing.overload
|
697
|
-
def
|
731
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
698
732
|
...
|
699
733
|
|
700
|
-
def
|
734
|
+
def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
701
735
|
"""
|
702
|
-
Specifies
|
703
|
-
|
736
|
+
Specifies a timeout for your step.
|
737
|
+
|
738
|
+
This decorator is useful if this step may hang indefinitely.
|
739
|
+
|
740
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
741
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
742
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
743
|
+
|
744
|
+
Note that all the values specified in parameters are added together so if you specify
|
745
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
704
746
|
|
705
747
|
Parameters
|
706
748
|
----------
|
707
|
-
|
708
|
-
|
749
|
+
seconds : int, default 0
|
750
|
+
Number of seconds to wait prior to timing out.
|
751
|
+
minutes : int, default 0
|
752
|
+
Number of minutes to wait prior to timing out.
|
753
|
+
hours : int, default 0
|
754
|
+
Number of hours to wait prior to timing out.
|
709
755
|
"""
|
710
756
|
...
|
711
757
|
|
712
758
|
@typing.overload
|
713
|
-
def
|
759
|
+
def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
714
760
|
"""
|
715
|
-
Specifies
|
761
|
+
Specifies that the step will success under all circumstances.
|
762
|
+
|
763
|
+
The decorator will create an optional artifact, specified by `var`, which
|
764
|
+
contains the exception raised. You can use it to detect the presence
|
765
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
766
|
+
are missing.
|
716
767
|
|
717
768
|
Parameters
|
718
769
|
----------
|
719
|
-
|
720
|
-
|
770
|
+
var : str, optional, default None
|
771
|
+
Name of the artifact in which to store the caught exception.
|
772
|
+
If not specified, the exception is not stored.
|
773
|
+
print_exception : bool, default True
|
774
|
+
Determines whether or not the exception is printed to
|
775
|
+
stdout when caught.
|
721
776
|
"""
|
722
777
|
...
|
723
778
|
|
724
779
|
@typing.overload
|
725
|
-
def
|
780
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
726
781
|
...
|
727
782
|
|
728
783
|
@typing.overload
|
729
|
-
def
|
784
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
730
785
|
...
|
731
786
|
|
732
|
-
def
|
787
|
+
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
733
788
|
"""
|
734
|
-
Specifies
|
789
|
+
Specifies that the step will success under all circumstances.
|
790
|
+
|
791
|
+
The decorator will create an optional artifact, specified by `var`, which
|
792
|
+
contains the exception raised. You can use it to detect the presence
|
793
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
794
|
+
are missing.
|
735
795
|
|
736
796
|
Parameters
|
737
797
|
----------
|
738
|
-
|
739
|
-
|
798
|
+
var : str, optional, default None
|
799
|
+
Name of the artifact in which to store the caught exception.
|
800
|
+
If not specified, the exception is not stored.
|
801
|
+
print_exception : bool, default True
|
802
|
+
Determines whether or not the exception is printed to
|
803
|
+
stdout when caught.
|
740
804
|
"""
|
741
805
|
...
|
742
806
|
|
@@ -794,240 +858,363 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
794
858
|
...
|
795
859
|
|
796
860
|
@typing.overload
|
797
|
-
def
|
861
|
+
def card(*, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
798
862
|
"""
|
799
|
-
|
800
|
-
|
863
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
864
|
+
|
865
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
866
|
+
|
867
|
+
Parameters
|
868
|
+
----------
|
869
|
+
type : str, default 'default'
|
870
|
+
Card type.
|
871
|
+
id : str, optional, default None
|
872
|
+
If multiple cards are present, use this id to identify this card.
|
873
|
+
options : Dict[str, Any], default {}
|
874
|
+
Options passed to the card. The contents depend on the card type.
|
875
|
+
timeout : int, default 45
|
876
|
+
Interrupt reporting if it takes more than this many seconds.
|
877
|
+
|
878
|
+
|
801
879
|
"""
|
802
880
|
...
|
803
881
|
|
804
882
|
@typing.overload
|
805
|
-
def
|
883
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
806
884
|
...
|
807
885
|
|
808
|
-
|
886
|
+
@typing.overload
|
887
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
888
|
+
...
|
889
|
+
|
890
|
+
def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
|
809
891
|
"""
|
810
|
-
|
811
|
-
|
892
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
893
|
+
|
894
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
895
|
+
|
896
|
+
Parameters
|
897
|
+
----------
|
898
|
+
type : str, default 'default'
|
899
|
+
Card type.
|
900
|
+
id : str, optional, default None
|
901
|
+
If multiple cards are present, use this id to identify this card.
|
902
|
+
options : Dict[str, Any], default {}
|
903
|
+
Options passed to the card. The contents depend on the card type.
|
904
|
+
timeout : int, default 45
|
905
|
+
Interrupt reporting if it takes more than this many seconds.
|
906
|
+
|
907
|
+
|
812
908
|
"""
|
813
909
|
...
|
814
910
|
|
815
911
|
@typing.overload
|
816
|
-
def
|
912
|
+
def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
817
913
|
"""
|
818
|
-
|
914
|
+
Enables loading / saving of models within a step.
|
819
915
|
|
820
|
-
Information in this decorator will augment any
|
821
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
822
|
-
you can use `@conda_base` to set packages required by all
|
823
|
-
steps and use `@conda` to specify step-specific overrides.
|
824
916
|
|
825
917
|
Parameters
|
826
918
|
----------
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
If
|
919
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
920
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
921
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
922
|
+
- `current.checkpoint`
|
923
|
+
- `current.model`
|
924
|
+
- `current.huggingface_hub`
|
925
|
+
|
926
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
927
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
928
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
929
|
+
|
930
|
+
temp_dir_root : str, default: None
|
931
|
+
The root directory under which `current.model.loaded` will store loaded models
|
932
|
+
|
933
|
+
|
934
|
+
|
837
935
|
"""
|
838
936
|
...
|
839
937
|
|
840
938
|
@typing.overload
|
841
|
-
def
|
939
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
842
940
|
...
|
843
941
|
|
844
942
|
@typing.overload
|
845
|
-
def
|
943
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
846
944
|
...
|
847
945
|
|
848
|
-
def
|
946
|
+
def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
|
849
947
|
"""
|
850
|
-
|
948
|
+
Enables loading / saving of models within a step.
|
851
949
|
|
852
|
-
Information in this decorator will augment any
|
853
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
854
|
-
you can use `@conda_base` to set packages required by all
|
855
|
-
steps and use `@conda` to specify step-specific overrides.
|
856
950
|
|
857
951
|
Parameters
|
858
952
|
----------
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
If
|
953
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
954
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
955
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
956
|
+
- `current.checkpoint`
|
957
|
+
- `current.model`
|
958
|
+
- `current.huggingface_hub`
|
959
|
+
|
960
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
961
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
962
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
963
|
+
|
964
|
+
temp_dir_root : str, default: None
|
965
|
+
The root directory under which `current.model.loaded` will store loaded models
|
966
|
+
|
967
|
+
|
968
|
+
|
869
969
|
"""
|
870
970
|
...
|
871
971
|
|
872
972
|
@typing.overload
|
873
|
-
def
|
973
|
+
def resources(*, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
874
974
|
"""
|
875
|
-
Specifies
|
876
|
-
|
877
|
-
This decorator is useful if this step may hang indefinitely.
|
975
|
+
Specifies the resources needed when executing this step.
|
878
976
|
|
879
|
-
|
880
|
-
|
881
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
977
|
+
Use `@resources` to specify the resource requirements
|
978
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
882
979
|
|
883
|
-
|
884
|
-
|
980
|
+
You can choose the compute layer on the command line by executing e.g.
|
981
|
+
```
|
982
|
+
python myflow.py run --with batch
|
983
|
+
```
|
984
|
+
or
|
985
|
+
```
|
986
|
+
python myflow.py run --with kubernetes
|
987
|
+
```
|
988
|
+
which executes the flow on the desired system using the
|
989
|
+
requirements specified in `@resources`.
|
885
990
|
|
886
991
|
Parameters
|
887
992
|
----------
|
888
|
-
|
889
|
-
Number of
|
890
|
-
|
891
|
-
Number of
|
892
|
-
|
893
|
-
|
993
|
+
cpu : int, default 1
|
994
|
+
Number of CPUs required for this step.
|
995
|
+
gpu : int, default 0
|
996
|
+
Number of GPUs required for this step.
|
997
|
+
disk : int, optional, default None
|
998
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
999
|
+
memory : int, default 4096
|
1000
|
+
Memory size (in MB) required for this step.
|
1001
|
+
shared_memory : int, optional, default None
|
1002
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1003
|
+
This parameter maps to the `--shm-size` option in Docker.
|
894
1004
|
"""
|
895
1005
|
...
|
896
1006
|
|
897
1007
|
@typing.overload
|
898
|
-
def
|
1008
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
899
1009
|
...
|
900
1010
|
|
901
1011
|
@typing.overload
|
902
|
-
def
|
1012
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
903
1013
|
...
|
904
1014
|
|
905
|
-
def
|
1015
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
906
1016
|
"""
|
907
|
-
Specifies
|
908
|
-
|
909
|
-
This decorator is useful if this step may hang indefinitely.
|
1017
|
+
Specifies the resources needed when executing this step.
|
910
1018
|
|
911
|
-
|
912
|
-
|
913
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1019
|
+
Use `@resources` to specify the resource requirements
|
1020
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
914
1021
|
|
915
|
-
|
916
|
-
|
1022
|
+
You can choose the compute layer on the command line by executing e.g.
|
1023
|
+
```
|
1024
|
+
python myflow.py run --with batch
|
1025
|
+
```
|
1026
|
+
or
|
1027
|
+
```
|
1028
|
+
python myflow.py run --with kubernetes
|
1029
|
+
```
|
1030
|
+
which executes the flow on the desired system using the
|
1031
|
+
requirements specified in `@resources`.
|
917
1032
|
|
918
1033
|
Parameters
|
919
1034
|
----------
|
920
|
-
|
921
|
-
Number of
|
922
|
-
|
923
|
-
Number of
|
924
|
-
|
925
|
-
|
1035
|
+
cpu : int, default 1
|
1036
|
+
Number of CPUs required for this step.
|
1037
|
+
gpu : int, default 0
|
1038
|
+
Number of GPUs required for this step.
|
1039
|
+
disk : int, optional, default None
|
1040
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1041
|
+
memory : int, default 4096
|
1042
|
+
Memory size (in MB) required for this step.
|
1043
|
+
shared_memory : int, optional, default None
|
1044
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1045
|
+
This parameter maps to the `--shm-size` option in Docker.
|
926
1046
|
"""
|
927
1047
|
...
|
928
1048
|
|
929
|
-
|
1049
|
+
@typing.overload
|
1050
|
+
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
930
1051
|
"""
|
931
|
-
Specifies
|
1052
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1053
|
+
the execution of a step.
|
932
1054
|
|
933
1055
|
Parameters
|
934
1056
|
----------
|
935
|
-
|
936
|
-
|
937
|
-
also present, the maximum value from all decorators is used.
|
938
|
-
memory : int, default 4096
|
939
|
-
Memory size (in MB) required for this step. If
|
940
|
-
`@resources` is also present, the maximum value from all decorators is
|
941
|
-
used.
|
942
|
-
disk : int, default 10240
|
943
|
-
Disk size (in MB) required for this step. If
|
944
|
-
`@resources` is also present, the maximum value from all decorators is
|
945
|
-
used.
|
946
|
-
image : str, optional, default None
|
947
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
948
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
949
|
-
not, a default Docker image mapping to the current version of Python is used.
|
950
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
951
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
952
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
953
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
954
|
-
secrets : List[str], optional, default None
|
955
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
956
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
957
|
-
in Metaflow configuration.
|
958
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
959
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
960
|
-
Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
|
961
|
-
or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
|
962
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
963
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
964
|
-
gpu : int, optional, default None
|
965
|
-
Number of GPUs required for this step. A value of zero implies that
|
966
|
-
the scheduled node should not have GPUs.
|
967
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
968
|
-
The vendor of the GPUs to be used for this step.
|
969
|
-
tolerations : List[str], default []
|
970
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
971
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
972
|
-
use_tmpfs : bool, default False
|
973
|
-
This enables an explicit tmpfs mount for this step.
|
974
|
-
tmpfs_tempdir : bool, default True
|
975
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
976
|
-
tmpfs_size : int, optional, default: None
|
977
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
978
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
979
|
-
memory allocated for this step.
|
980
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
981
|
-
Path to tmpfs mount for this step.
|
982
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
983
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
984
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
985
|
-
shared_memory: int, optional
|
986
|
-
Shared memory size (in MiB) required for this step
|
987
|
-
port: int, optional
|
988
|
-
Port number to specify in the Kubernetes job object
|
989
|
-
compute_pool : str, optional, default None
|
990
|
-
Compute pool to be used for for this step.
|
991
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
1057
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1058
|
+
List of secret specs, defining how the secrets are to be retrieved
|
992
1059
|
"""
|
993
1060
|
...
|
994
1061
|
|
995
1062
|
@typing.overload
|
996
|
-
def
|
1063
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1064
|
+
...
|
1065
|
+
|
1066
|
+
@typing.overload
|
1067
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1068
|
+
...
|
1069
|
+
|
1070
|
+
def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
|
997
1071
|
"""
|
998
|
-
Specifies
|
1072
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1073
|
+
the execution of a step.
|
999
1074
|
|
1000
|
-
Use `@pypi_base` to set common packages required by all
|
1001
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1002
1075
|
Parameters
|
1003
1076
|
----------
|
1004
|
-
|
1005
|
-
|
1006
|
-
and the value is the version to use.
|
1007
|
-
python : str, optional, default: None
|
1008
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1009
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1077
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1078
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1010
1079
|
"""
|
1011
1080
|
...
|
1012
1081
|
|
1013
1082
|
@typing.overload
|
1014
|
-
def
|
1083
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1084
|
+
"""
|
1085
|
+
Internal decorator to support Fast bakery
|
1086
|
+
"""
|
1015
1087
|
...
|
1016
1088
|
|
1017
|
-
|
1089
|
+
@typing.overload
|
1090
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1091
|
+
...
|
1092
|
+
|
1093
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1018
1094
|
"""
|
1019
|
-
|
1095
|
+
Internal decorator to support Fast bakery
|
1096
|
+
"""
|
1097
|
+
...
|
1098
|
+
|
1099
|
+
@typing.overload
|
1100
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1101
|
+
"""
|
1102
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1103
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1104
|
+
"""
|
1105
|
+
...
|
1106
|
+
|
1107
|
+
@typing.overload
|
1108
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1109
|
+
...
|
1110
|
+
|
1111
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1112
|
+
"""
|
1113
|
+
Decorator prototype for all step decorators. This function gets specialized
|
1114
|
+
and imported for all decorators types by _import_plugin_decorators().
|
1115
|
+
"""
|
1116
|
+
...
|
1117
|
+
|
1118
|
+
@typing.overload
|
1119
|
+
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1120
|
+
"""
|
1121
|
+
Specifies the flow(s) that this flow depends on.
|
1122
|
+
|
1123
|
+
```
|
1124
|
+
@trigger_on_finish(flow='FooFlow')
|
1125
|
+
```
|
1126
|
+
or
|
1127
|
+
```
|
1128
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1129
|
+
```
|
1130
|
+
This decorator respects the @project decorator and triggers the flow
|
1131
|
+
when upstream runs within the same namespace complete successfully
|
1132
|
+
|
1133
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1134
|
+
by specifying the fully qualified project_flow_name.
|
1135
|
+
```
|
1136
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1137
|
+
```
|
1138
|
+
or
|
1139
|
+
```
|
1140
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1141
|
+
```
|
1142
|
+
|
1143
|
+
You can also specify just the project or project branch (other values will be
|
1144
|
+
inferred from the current project or project branch):
|
1145
|
+
```
|
1146
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1147
|
+
```
|
1148
|
+
|
1149
|
+
Note that `branch` is typically one of:
|
1150
|
+
- `prod`
|
1151
|
+
- `user.bob`
|
1152
|
+
- `test.my_experiment`
|
1153
|
+
- `prod.staging`
|
1020
1154
|
|
1021
|
-
Use `@pypi_base` to set common packages required by all
|
1022
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1023
1155
|
Parameters
|
1024
1156
|
----------
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1157
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1158
|
+
Upstream flow dependency for this flow.
|
1159
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1160
|
+
Upstream flow dependencies for this flow.
|
1161
|
+
options : Dict[str, Any], default {}
|
1162
|
+
Backend-specific configuration for tuning eventing behavior.
|
1163
|
+
|
1164
|
+
|
1165
|
+
"""
|
1166
|
+
...
|
1167
|
+
|
1168
|
+
@typing.overload
|
1169
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1170
|
+
...
|
1171
|
+
|
1172
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1173
|
+
"""
|
1174
|
+
Specifies the flow(s) that this flow depends on.
|
1175
|
+
|
1176
|
+
```
|
1177
|
+
@trigger_on_finish(flow='FooFlow')
|
1178
|
+
```
|
1179
|
+
or
|
1180
|
+
```
|
1181
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1182
|
+
```
|
1183
|
+
This decorator respects the @project decorator and triggers the flow
|
1184
|
+
when upstream runs within the same namespace complete successfully
|
1185
|
+
|
1186
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1187
|
+
by specifying the fully qualified project_flow_name.
|
1188
|
+
```
|
1189
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1190
|
+
```
|
1191
|
+
or
|
1192
|
+
```
|
1193
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1194
|
+
```
|
1195
|
+
|
1196
|
+
You can also specify just the project or project branch (other values will be
|
1197
|
+
inferred from the current project or project branch):
|
1198
|
+
```
|
1199
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1200
|
+
```
|
1201
|
+
|
1202
|
+
Note that `branch` is typically one of:
|
1203
|
+
- `prod`
|
1204
|
+
- `user.bob`
|
1205
|
+
- `test.my_experiment`
|
1206
|
+
- `prod.staging`
|
1207
|
+
|
1208
|
+
Parameters
|
1209
|
+
----------
|
1210
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1211
|
+
Upstream flow dependency for this flow.
|
1212
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1213
|
+
Upstream flow dependencies for this flow.
|
1214
|
+
options : Dict[str, Any], default {}
|
1215
|
+
Backend-specific configuration for tuning eventing behavior.
|
1216
|
+
|
1217
|
+
|
1031
1218
|
"""
|
1032
1219
|
...
|
1033
1220
|
|
@@ -1080,128 +1267,6 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1080
1267
|
"""
|
1081
1268
|
...
|
1082
1269
|
|
1083
|
-
@typing.overload
|
1084
|
-
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]]:
|
1085
|
-
"""
|
1086
|
-
Specifies the Conda environment for all steps of the flow.
|
1087
|
-
|
1088
|
-
Use `@conda_base` to set common libraries required by all
|
1089
|
-
steps and use `@conda` to specify step-specific additions.
|
1090
|
-
|
1091
|
-
Parameters
|
1092
|
-
----------
|
1093
|
-
packages : Dict[str, str], default {}
|
1094
|
-
Packages to use for this flow. The key is the name of the package
|
1095
|
-
and the value is the version to use.
|
1096
|
-
libraries : Dict[str, str], default {}
|
1097
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1098
|
-
python : str, optional, default None
|
1099
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1100
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1101
|
-
disabled : bool, default False
|
1102
|
-
If set to True, disables Conda.
|
1103
|
-
"""
|
1104
|
-
...
|
1105
|
-
|
1106
|
-
@typing.overload
|
1107
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1108
|
-
...
|
1109
|
-
|
1110
|
-
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1111
|
-
"""
|
1112
|
-
Specifies the Conda environment for all steps of the flow.
|
1113
|
-
|
1114
|
-
Use `@conda_base` to set common libraries required by all
|
1115
|
-
steps and use `@conda` to specify step-specific additions.
|
1116
|
-
|
1117
|
-
Parameters
|
1118
|
-
----------
|
1119
|
-
packages : Dict[str, str], default {}
|
1120
|
-
Packages to use for this flow. The key is the name of the package
|
1121
|
-
and the value is the version to use.
|
1122
|
-
libraries : Dict[str, str], default {}
|
1123
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1124
|
-
python : str, optional, default None
|
1125
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1126
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1127
|
-
disabled : bool, default False
|
1128
|
-
If set to True, disables Conda.
|
1129
|
-
"""
|
1130
|
-
...
|
1131
|
-
|
1132
|
-
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]]:
|
1133
|
-
"""
|
1134
|
-
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.
|
1135
|
-
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.
|
1136
|
-
|
1137
|
-
Parameters
|
1138
|
-
----------
|
1139
|
-
timeout : int
|
1140
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1141
|
-
poke_interval : int
|
1142
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1143
|
-
mode : str
|
1144
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1145
|
-
exponential_backoff : bool
|
1146
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1147
|
-
pool : str
|
1148
|
-
the slot pool this task should run in,
|
1149
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1150
|
-
soft_fail : bool
|
1151
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1152
|
-
name : str
|
1153
|
-
Name of the sensor on Airflow
|
1154
|
-
description : str
|
1155
|
-
Description of sensor in the Airflow UI
|
1156
|
-
external_dag_id : str
|
1157
|
-
The dag_id that contains the task you want to wait for.
|
1158
|
-
external_task_ids : List[str]
|
1159
|
-
The list of task_ids that you want to wait for.
|
1160
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1161
|
-
allowed_states : List[str]
|
1162
|
-
Iterable of allowed states, (Default: ['success'])
|
1163
|
-
failed_states : List[str]
|
1164
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1165
|
-
execution_delta : datetime.timedelta
|
1166
|
-
time difference with the previous execution to look at,
|
1167
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1168
|
-
check_existence: bool
|
1169
|
-
Set to True to check if the external task exists or check if
|
1170
|
-
the DAG to wait for exists. (Default: True)
|
1171
|
-
"""
|
1172
|
-
...
|
1173
|
-
|
1174
|
-
def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1175
|
-
"""
|
1176
|
-
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1177
|
-
|
1178
|
-
User code call
|
1179
|
-
-----------
|
1180
|
-
@nim(
|
1181
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1182
|
-
backend='managed'
|
1183
|
-
)
|
1184
|
-
|
1185
|
-
Valid backend options
|
1186
|
-
---------------------
|
1187
|
-
- 'managed': Outerbounds selects a compute provider based on the model.
|
1188
|
-
- 🚧 'dataplane': Run in your account.
|
1189
|
-
|
1190
|
-
Valid model options
|
1191
|
-
----------------
|
1192
|
-
- 'meta/llama3-8b-instruct': 8B parameter model
|
1193
|
-
- 'meta/llama3-70b-instruct': 70B parameter model
|
1194
|
-
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1195
|
-
|
1196
|
-
Parameters
|
1197
|
-
----------
|
1198
|
-
models: list[NIM]
|
1199
|
-
List of NIM containers running models in sidecars.
|
1200
|
-
backend: str
|
1201
|
-
Compute provider to run the NIM container.
|
1202
|
-
"""
|
1203
|
-
...
|
1204
|
-
|
1205
1270
|
@typing.overload
|
1206
1271
|
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1207
1272
|
"""
|
@@ -1286,14 +1351,94 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1286
1351
|
|
1287
1352
|
Parameters
|
1288
1353
|
----------
|
1289
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1290
|
-
Event dependency for this flow.
|
1291
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1292
|
-
Events dependency for this flow.
|
1293
|
-
options : Dict[str, Any], default {}
|
1294
|
-
Backend-specific configuration for tuning eventing behavior.
|
1354
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1355
|
+
Event dependency for this flow.
|
1356
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1357
|
+
Events dependency for this flow.
|
1358
|
+
options : Dict[str, Any], default {}
|
1359
|
+
Backend-specific configuration for tuning eventing behavior.
|
1360
|
+
|
1361
|
+
|
1362
|
+
"""
|
1363
|
+
...
|
1364
|
+
|
1365
|
+
@typing.overload
|
1366
|
+
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]]:
|
1367
|
+
"""
|
1368
|
+
Specifies the Conda environment for all steps of the flow.
|
1369
|
+
|
1370
|
+
Use `@conda_base` to set common libraries required by all
|
1371
|
+
steps and use `@conda` to specify step-specific additions.
|
1372
|
+
|
1373
|
+
Parameters
|
1374
|
+
----------
|
1375
|
+
packages : Dict[str, str], default {}
|
1376
|
+
Packages to use for this flow. The key is the name of the package
|
1377
|
+
and the value is the version to use.
|
1378
|
+
libraries : Dict[str, str], default {}
|
1379
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1380
|
+
python : str, optional, default None
|
1381
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1382
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1383
|
+
disabled : bool, default False
|
1384
|
+
If set to True, disables Conda.
|
1385
|
+
"""
|
1386
|
+
...
|
1387
|
+
|
1388
|
+
@typing.overload
|
1389
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1390
|
+
...
|
1391
|
+
|
1392
|
+
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1393
|
+
"""
|
1394
|
+
Specifies the Conda environment for all steps of the flow.
|
1395
|
+
|
1396
|
+
Use `@conda_base` to set common libraries required by all
|
1397
|
+
steps and use `@conda` to specify step-specific additions.
|
1398
|
+
|
1399
|
+
Parameters
|
1400
|
+
----------
|
1401
|
+
packages : Dict[str, str], default {}
|
1402
|
+
Packages to use for this flow. The key is the name of the package
|
1403
|
+
and the value is the version to use.
|
1404
|
+
libraries : Dict[str, str], default {}
|
1405
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1406
|
+
python : str, optional, default None
|
1407
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1408
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1409
|
+
disabled : bool, default False
|
1410
|
+
If set to True, disables Conda.
|
1411
|
+
"""
|
1412
|
+
...
|
1413
|
+
|
1414
|
+
def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1415
|
+
"""
|
1416
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1417
|
+
|
1418
|
+
User code call
|
1419
|
+
-----------
|
1420
|
+
@nim(
|
1421
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1422
|
+
backend='managed'
|
1423
|
+
)
|
1424
|
+
|
1425
|
+
Valid backend options
|
1426
|
+
---------------------
|
1427
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
1428
|
+
- 🚧 'dataplane': Run in your account.
|
1295
1429
|
|
1430
|
+
Valid model options
|
1431
|
+
----------------
|
1432
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
1433
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
1434
|
+
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1296
1435
|
|
1436
|
+
Parameters
|
1437
|
+
----------
|
1438
|
+
models: list[NIM]
|
1439
|
+
List of NIM containers running models in sidecars.
|
1440
|
+
backend: str
|
1441
|
+
Compute provider to run the NIM container.
|
1297
1442
|
"""
|
1298
1443
|
...
|
1299
1444
|
|
@@ -1315,6 +1460,45 @@ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typ
|
|
1315
1460
|
"""
|
1316
1461
|
...
|
1317
1462
|
|
1463
|
+
@typing.overload
|
1464
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1465
|
+
"""
|
1466
|
+
Specifies the PyPI packages for all steps of the flow.
|
1467
|
+
|
1468
|
+
Use `@pypi_base` to set common packages required by all
|
1469
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1470
|
+
Parameters
|
1471
|
+
----------
|
1472
|
+
packages : Dict[str, str], default: {}
|
1473
|
+
Packages to use for this flow. The key is the name of the package
|
1474
|
+
and the value is the version to use.
|
1475
|
+
python : str, optional, default: None
|
1476
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1477
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1478
|
+
"""
|
1479
|
+
...
|
1480
|
+
|
1481
|
+
@typing.overload
|
1482
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1483
|
+
...
|
1484
|
+
|
1485
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1486
|
+
"""
|
1487
|
+
Specifies the PyPI packages for all steps of the flow.
|
1488
|
+
|
1489
|
+
Use `@pypi_base` to set common packages required by all
|
1490
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1491
|
+
Parameters
|
1492
|
+
----------
|
1493
|
+
packages : Dict[str, str], default: {}
|
1494
|
+
Packages to use for this flow. The key is the name of the package
|
1495
|
+
and the value is the version to use.
|
1496
|
+
python : str, optional, default: None
|
1497
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1498
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1499
|
+
"""
|
1500
|
+
...
|
1501
|
+
|
1318
1502
|
def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1319
1503
|
"""
|
1320
1504
|
The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
|
@@ -1357,106 +1541,45 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1357
1541
|
"""
|
1358
1542
|
...
|
1359
1543
|
|
1360
|
-
|
1361
|
-
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1362
|
-
"""
|
1363
|
-
Specifies the flow(s) that this flow depends on.
|
1364
|
-
|
1365
|
-
```
|
1366
|
-
@trigger_on_finish(flow='FooFlow')
|
1367
|
-
```
|
1368
|
-
or
|
1369
|
-
```
|
1370
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1371
|
-
```
|
1372
|
-
This decorator respects the @project decorator and triggers the flow
|
1373
|
-
when upstream runs within the same namespace complete successfully
|
1374
|
-
|
1375
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1376
|
-
by specifying the fully qualified project_flow_name.
|
1377
|
-
```
|
1378
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1379
|
-
```
|
1380
|
-
or
|
1381
|
-
```
|
1382
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1383
|
-
```
|
1384
|
-
|
1385
|
-
You can also specify just the project or project branch (other values will be
|
1386
|
-
inferred from the current project or project branch):
|
1387
|
-
```
|
1388
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1389
|
-
```
|
1390
|
-
|
1391
|
-
Note that `branch` is typically one of:
|
1392
|
-
- `prod`
|
1393
|
-
- `user.bob`
|
1394
|
-
- `test.my_experiment`
|
1395
|
-
- `prod.staging`
|
1396
|
-
|
1397
|
-
Parameters
|
1398
|
-
----------
|
1399
|
-
flow : Union[str, Dict[str, str]], optional, default None
|
1400
|
-
Upstream flow dependency for this flow.
|
1401
|
-
flows : List[Union[str, Dict[str, str]]], default []
|
1402
|
-
Upstream flow dependencies for this flow.
|
1403
|
-
options : Dict[str, Any], default {}
|
1404
|
-
Backend-specific configuration for tuning eventing behavior.
|
1405
|
-
|
1406
|
-
|
1407
|
-
"""
|
1408
|
-
...
|
1409
|
-
|
1410
|
-
@typing.overload
|
1411
|
-
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1412
|
-
...
|
1413
|
-
|
1414
|
-
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1544
|
+
def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1415
1545
|
"""
|
1416
|
-
|
1417
|
-
|
1418
|
-
```
|
1419
|
-
@trigger_on_finish(flow='FooFlow')
|
1420
|
-
```
|
1421
|
-
or
|
1422
|
-
```
|
1423
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1424
|
-
```
|
1425
|
-
This decorator respects the @project decorator and triggers the flow
|
1426
|
-
when upstream runs within the same namespace complete successfully
|
1427
|
-
|
1428
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1429
|
-
by specifying the fully qualified project_flow_name.
|
1430
|
-
```
|
1431
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1432
|
-
```
|
1433
|
-
or
|
1434
|
-
```
|
1435
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1436
|
-
```
|
1437
|
-
|
1438
|
-
You can also specify just the project or project branch (other values will be
|
1439
|
-
inferred from the current project or project branch):
|
1440
|
-
```
|
1441
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1442
|
-
```
|
1443
|
-
|
1444
|
-
Note that `branch` is typically one of:
|
1445
|
-
- `prod`
|
1446
|
-
- `user.bob`
|
1447
|
-
- `test.my_experiment`
|
1448
|
-
- `prod.staging`
|
1546
|
+
The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
|
1547
|
+
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1449
1548
|
|
1450
1549
|
Parameters
|
1451
1550
|
----------
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1551
|
+
timeout : int
|
1552
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1553
|
+
poke_interval : int
|
1554
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1555
|
+
mode : str
|
1556
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1557
|
+
exponential_backoff : bool
|
1558
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1559
|
+
pool : str
|
1560
|
+
the slot pool this task should run in,
|
1561
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1562
|
+
soft_fail : bool
|
1563
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1564
|
+
name : str
|
1565
|
+
Name of the sensor on Airflow
|
1566
|
+
description : str
|
1567
|
+
Description of sensor in the Airflow UI
|
1568
|
+
external_dag_id : str
|
1569
|
+
The dag_id that contains the task you want to wait for.
|
1570
|
+
external_task_ids : List[str]
|
1571
|
+
The list of task_ids that you want to wait for.
|
1572
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1573
|
+
allowed_states : List[str]
|
1574
|
+
Iterable of allowed states, (Default: ['success'])
|
1575
|
+
failed_states : List[str]
|
1576
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1577
|
+
execution_delta : datetime.timedelta
|
1578
|
+
time difference with the previous execution to look at,
|
1579
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1580
|
+
check_existence: bool
|
1581
|
+
Set to True to check if the external task exists or check if
|
1582
|
+
the DAG to wait for exists. (Default: True)
|
1460
1583
|
"""
|
1461
1584
|
...
|
1462
1585
|
|
@@ -2640,6 +2763,79 @@ class NBDeployer(object, metaclass=type):
|
|
2640
2763
|
|
2641
2764
|
pkg_name: str
|
2642
2765
|
|
2766
|
+
class Checkpoint(object, metaclass=type):
|
2767
|
+
def __init__(self, temp_dir_root = None, init_dir = False):
|
2768
|
+
...
|
2769
|
+
@property
|
2770
|
+
def directory(self):
|
2771
|
+
...
|
2772
|
+
def save(self, path = None, metadata = None, latest = True, name = "mfchckpt"):
|
2773
|
+
"""
|
2774
|
+
saves the checkpoint to the datastore (resemble's a create op)
|
2775
|
+
|
2776
|
+
Parameters
|
2777
|
+
----------
|
2778
|
+
|
2779
|
+
- `path` (str or os.PathLike):
|
2780
|
+
- path to directory
|
2781
|
+
- path to file
|
2782
|
+
- `name`:
|
2783
|
+
- name of the checkpoint
|
2784
|
+
- `metadata`:
|
2785
|
+
- metadata of the checkpoint
|
2786
|
+
"""
|
2787
|
+
...
|
2788
|
+
def __enter__(self):
|
2789
|
+
...
|
2790
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
2791
|
+
...
|
2792
|
+
def list(self, name: typing.Optional[str] = None, task: typing.Union["metaflow.Task", str, None] = None, attempt: typing.Union[int, str, None] = None, as_dict: bool = True, within_task: bool = True) -> typing.Iterable[typing.Union[typing.Dict, metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures.CheckpointArtifact]]:
|
2793
|
+
"""
|
2794
|
+
lists the checkpoints in the datastore based on the Task.
|
2795
|
+
It will always be task scoped.
|
2796
|
+
|
2797
|
+
Usage:
|
2798
|
+
------
|
2799
|
+
|
2800
|
+
```python
|
2801
|
+
|
2802
|
+
Checkpoint().list(name="best") # lists checkpoints in the current task with the name "best"
|
2803
|
+
Checkpoint().list(name="best", task="anotherflow/somerunid/somestep/sometask") # lists checkpoints in the another task with the name "best"
|
2804
|
+
Checkpoint().list(task="anotherflow/somerunid/somestep/sometask", name="best") # Identical as the above one but
|
2805
|
+
Checkpoint().list() # lists all the checkpoints in the current task
|
2806
|
+
|
2807
|
+
```
|
2808
|
+
|
2809
|
+
Parameters
|
2810
|
+
----------
|
2811
|
+
|
2812
|
+
- `name`:
|
2813
|
+
- name of the checkpoint to filter for
|
2814
|
+
- `task`:
|
2815
|
+
- Task object outside the one that is currently set in the `Checkpoint` object; Can be a pathspec string.
|
2816
|
+
- `attempt`:
|
2817
|
+
- attempt number of the task (optional filter. If none, then lists all checkpoints from all attempts)
|
2818
|
+
"""
|
2819
|
+
...
|
2820
|
+
def load(self, reference: typing.Union[str, typing.Dict, metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures.CheckpointArtifact], path: typing.Optional[str] = None):
|
2821
|
+
"""
|
2822
|
+
loads a checkpoint reference from the datastore. (resembles a read op)
|
2823
|
+
|
2824
|
+
Parameters
|
2825
|
+
----------
|
2826
|
+
|
2827
|
+
`reference` :
|
2828
|
+
- can be a string, dict or a CheckpointArtifact object:
|
2829
|
+
- string: a string reference to the checkpoint (checkpoint key)
|
2830
|
+
- dict: a dictionary reference to the checkpoint
|
2831
|
+
- CheckpointArtifact: a CheckpointArtifact object reference to the checkpoint
|
2832
|
+
"""
|
2833
|
+
...
|
2834
|
+
...
|
2835
|
+
|
2836
|
+
def load_model(reference: typing.Union[str, metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures.MetaflowDataArtifactReference, dict], path: str):
|
2837
|
+
...
|
2838
|
+
|
2643
2839
|
def get_aws_client(module, with_error = False, role_arn = None, session_vars = None, client_params = None):
|
2644
2840
|
...
|
2645
2841
|
|