ob-metaflow-stubs 5.10__py2.py3-none-any.whl → 6.0.3.102rc0__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 +633 -437
- metaflow-stubs/cards.pyi +5 -5
- metaflow-stubs/cli.pyi +3 -3
- metaflow-stubs/client/__init__.pyi +3 -3
- metaflow-stubs/client/core.pyi +6 -6
- metaflow-stubs/client/filecache.pyi +2 -2
- 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 +4 -4
- 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 +142 -18
- 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 +3 -3
- 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 +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 +4 -4
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
- 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 +4 -4
- 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 +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
- 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 +2 -2
- 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 +4 -4
- 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 +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 +3 -3
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
- 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 +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +4 -4
- 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 +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 +3 -3
- 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 +3 -3
- 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 +2 -2
- 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.102rc0.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.102rc0.dist-info/RECORD +140 -0
- {ob_metaflow_stubs-5.10.dist-info → ob_metaflow_stubs-6.0.3.102rc0.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.102rc0.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,7 +1,7 @@
|
|
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-20T18:35:21.800373 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -9,15 +9,16 @@ from __future__ import annotations
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
11
|
import metaflow.events
|
12
|
+
import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
|
12
13
|
import metaflow.datastore.inputs
|
13
|
-
import metaflow.runner.metaflow_runner
|
14
14
|
import metaflow.metaflow_current
|
15
|
-
import metaflow.flowspec
|
16
|
-
import datetime
|
17
|
-
import metaflow.client.core
|
18
15
|
import metaflow._vendor.click.types
|
16
|
+
import metaflow.runner.metaflow_runner
|
19
17
|
import typing
|
18
|
+
import metaflow.flowspec
|
19
|
+
import metaflow.client.core
|
20
20
|
import metaflow.parameters
|
21
|
+
import datetime
|
21
22
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
22
23
|
StepFlag = typing.NewType("StepFlag", bool)
|
23
24
|
|
@@ -433,57 +434,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
433
434
|
"""
|
434
435
|
...
|
435
436
|
|
436
|
-
@typing.overload
|
437
|
-
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]]]:
|
438
|
-
"""
|
439
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
440
|
-
|
441
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
442
|
-
|
443
|
-
Parameters
|
444
|
-
----------
|
445
|
-
type : str, default 'default'
|
446
|
-
Card type.
|
447
|
-
id : str, optional, default None
|
448
|
-
If multiple cards are present, use this id to identify this card.
|
449
|
-
options : Dict[str, Any], default {}
|
450
|
-
Options passed to the card. The contents depend on the card type.
|
451
|
-
timeout : int, default 45
|
452
|
-
Interrupt reporting if it takes more than this many seconds.
|
453
|
-
|
454
|
-
|
455
|
-
"""
|
456
|
-
...
|
457
|
-
|
458
|
-
@typing.overload
|
459
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
460
|
-
...
|
461
|
-
|
462
|
-
@typing.overload
|
463
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
464
|
-
...
|
465
|
-
|
466
|
-
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):
|
467
|
-
"""
|
468
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
469
|
-
|
470
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
471
|
-
|
472
|
-
Parameters
|
473
|
-
----------
|
474
|
-
type : str, default 'default'
|
475
|
-
Card type.
|
476
|
-
id : str, optional, default None
|
477
|
-
If multiple cards are present, use this id to identify this card.
|
478
|
-
options : Dict[str, Any], default {}
|
479
|
-
Options passed to the card. The contents depend on the card type.
|
480
|
-
timeout : int, default 45
|
481
|
-
Interrupt reporting if it takes more than this many seconds.
|
482
|
-
|
483
|
-
|
484
|
-
"""
|
485
|
-
...
|
486
|
-
|
487
437
|
@typing.overload
|
488
438
|
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]]]:
|
489
439
|
"""
|
@@ -534,145 +484,112 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
534
484
|
...
|
535
485
|
|
536
486
|
@typing.overload
|
537
|
-
def
|
487
|
+
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]]]:
|
538
488
|
"""
|
539
|
-
Specifies the
|
489
|
+
Specifies the number of times the task corresponding
|
490
|
+
to a step needs to be retried.
|
540
491
|
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
492
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
493
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
494
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
495
|
+
|
496
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
497
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
498
|
+
ensuring that the flow execution can continue.
|
545
499
|
|
546
500
|
Parameters
|
547
501
|
----------
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
553
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
502
|
+
times : int, default 3
|
503
|
+
Number of times to retry this task.
|
504
|
+
minutes_between_retries : int, default 2
|
505
|
+
Number of minutes between retries.
|
554
506
|
"""
|
555
507
|
...
|
556
508
|
|
557
509
|
@typing.overload
|
558
|
-
def
|
510
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
559
511
|
...
|
560
512
|
|
561
513
|
@typing.overload
|
562
|
-
def
|
514
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
563
515
|
...
|
564
516
|
|
565
|
-
def
|
517
|
+
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):
|
566
518
|
"""
|
567
|
-
Specifies the
|
519
|
+
Specifies the number of times the task corresponding
|
520
|
+
to a step needs to be retried.
|
568
521
|
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
522
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
523
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
524
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
525
|
+
|
526
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
527
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
528
|
+
ensuring that the flow execution can continue.
|
573
529
|
|
574
530
|
Parameters
|
575
531
|
----------
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
581
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
582
|
-
"""
|
583
|
-
...
|
584
|
-
|
585
|
-
@typing.overload
|
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):
|
597
|
-
"""
|
598
|
-
Internal decorator to support Fast bakery
|
532
|
+
times : int, default 3
|
533
|
+
Number of times to retry this task.
|
534
|
+
minutes_between_retries : int, default 2
|
535
|
+
Number of minutes between retries.
|
599
536
|
"""
|
600
537
|
...
|
601
538
|
|
602
539
|
@typing.overload
|
603
|
-
def
|
540
|
+
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]]]:
|
604
541
|
"""
|
605
|
-
Specifies the
|
606
|
-
|
607
|
-
Use `@resources` to specify the resource requirements
|
608
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
542
|
+
Specifies the Conda environment for the step.
|
609
543
|
|
610
|
-
|
611
|
-
|
612
|
-
|
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`.
|
544
|
+
Information in this decorator will augment any
|
545
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
546
|
+
you can use `@conda_base` to set packages required by all
|
547
|
+
steps and use `@conda` to specify step-specific overrides.
|
620
548
|
|
621
549
|
Parameters
|
622
550
|
----------
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
This parameter maps to the `--shm-size` option in Docker.
|
551
|
+
packages : Dict[str, str], default {}
|
552
|
+
Packages to use for this step. The key is the name of the package
|
553
|
+
and the value is the version to use.
|
554
|
+
libraries : Dict[str, str], default {}
|
555
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
556
|
+
python : str, optional, default None
|
557
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
558
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
559
|
+
disabled : bool, default False
|
560
|
+
If set to True, disables @conda.
|
634
561
|
"""
|
635
562
|
...
|
636
563
|
|
637
564
|
@typing.overload
|
638
|
-
def
|
565
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
639
566
|
...
|
640
567
|
|
641
568
|
@typing.overload
|
642
|
-
def
|
569
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
643
570
|
...
|
644
571
|
|
645
|
-
def
|
572
|
+
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):
|
646
573
|
"""
|
647
|
-
Specifies the
|
648
|
-
|
649
|
-
Use `@resources` to specify the resource requirements
|
650
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
574
|
+
Specifies the Conda environment for the step.
|
651
575
|
|
652
|
-
|
653
|
-
|
654
|
-
|
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`.
|
576
|
+
Information in this decorator will augment any
|
577
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
578
|
+
you can use `@conda_base` to set packages required by all
|
579
|
+
steps and use `@conda` to specify step-specific overrides.
|
662
580
|
|
663
581
|
Parameters
|
664
582
|
----------
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
This parameter maps to the `--shm-size` option in Docker.
|
583
|
+
packages : Dict[str, str], default {}
|
584
|
+
Packages to use for this step. The key is the name of the package
|
585
|
+
and the value is the version to use.
|
586
|
+
libraries : Dict[str, str], default {}
|
587
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
588
|
+
python : str, optional, default None
|
589
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
590
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
591
|
+
disabled : bool, default False
|
592
|
+
If set to True, disables @conda.
|
676
593
|
"""
|
677
594
|
...
|
678
595
|
|
@@ -710,219 +627,186 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
710
627
|
...
|
711
628
|
|
712
629
|
@typing.overload
|
713
|
-
def
|
630
|
+
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]]]:
|
714
631
|
"""
|
715
|
-
Specifies
|
632
|
+
Specifies a timeout for your step.
|
633
|
+
|
634
|
+
This decorator is useful if this step may hang indefinitely.
|
635
|
+
|
636
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
637
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
638
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
639
|
+
|
640
|
+
Note that all the values specified in parameters are added together so if you specify
|
641
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
716
642
|
|
717
643
|
Parameters
|
718
644
|
----------
|
719
|
-
|
720
|
-
|
645
|
+
seconds : int, default 0
|
646
|
+
Number of seconds to wait prior to timing out.
|
647
|
+
minutes : int, default 0
|
648
|
+
Number of minutes to wait prior to timing out.
|
649
|
+
hours : int, default 0
|
650
|
+
Number of hours to wait prior to timing out.
|
721
651
|
"""
|
722
652
|
...
|
723
653
|
|
724
654
|
@typing.overload
|
725
|
-
def
|
655
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
726
656
|
...
|
727
657
|
|
728
658
|
@typing.overload
|
729
|
-
def
|
659
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
730
660
|
...
|
731
661
|
|
732
|
-
def
|
662
|
+
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):
|
733
663
|
"""
|
734
|
-
Specifies
|
664
|
+
Specifies a timeout for your step.
|
735
665
|
|
736
|
-
|
737
|
-
----------
|
738
|
-
vars : Dict[str, str], default {}
|
739
|
-
Dictionary of environment variables to set.
|
740
|
-
"""
|
741
|
-
...
|
742
|
-
|
743
|
-
@typing.overload
|
744
|
-
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]]]:
|
745
|
-
"""
|
746
|
-
Specifies the number of times the task corresponding
|
747
|
-
to a step needs to be retried.
|
666
|
+
This decorator is useful if this step may hang indefinitely.
|
748
667
|
|
749
|
-
This
|
750
|
-
|
751
|
-
|
668
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
669
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
670
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
752
671
|
|
753
|
-
|
754
|
-
decorator will
|
755
|
-
ensuring that the flow execution can continue.
|
672
|
+
Note that all the values specified in parameters are added together so if you specify
|
673
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
756
674
|
|
757
675
|
Parameters
|
758
676
|
----------
|
759
|
-
|
760
|
-
Number of
|
761
|
-
|
762
|
-
Number of minutes
|
677
|
+
seconds : int, default 0
|
678
|
+
Number of seconds to wait prior to timing out.
|
679
|
+
minutes : int, default 0
|
680
|
+
Number of minutes to wait prior to timing out.
|
681
|
+
hours : int, default 0
|
682
|
+
Number of hours to wait prior to timing out.
|
763
683
|
"""
|
764
684
|
...
|
765
685
|
|
766
686
|
@typing.overload
|
767
|
-
def
|
768
|
-
...
|
769
|
-
|
770
|
-
@typing.overload
|
771
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
772
|
-
...
|
773
|
-
|
774
|
-
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):
|
687
|
+
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]]]:
|
775
688
|
"""
|
776
|
-
Specifies
|
777
|
-
to a step needs to be retried.
|
778
|
-
|
779
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
780
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
781
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
782
|
-
|
783
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
784
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
785
|
-
ensuring that the flow execution can continue.
|
689
|
+
Specifies environment variables to be set prior to the execution of a step.
|
786
690
|
|
787
691
|
Parameters
|
788
692
|
----------
|
789
|
-
|
790
|
-
|
791
|
-
minutes_between_retries : int, default 2
|
792
|
-
Number of minutes between retries.
|
693
|
+
vars : Dict[str, str], default {}
|
694
|
+
Dictionary of environment variables to set.
|
793
695
|
"""
|
794
696
|
...
|
795
697
|
|
796
698
|
@typing.overload
|
797
|
-
def
|
798
|
-
"""
|
799
|
-
Decorator prototype for all step decorators. This function gets specialized
|
800
|
-
and imported for all decorators types by _import_plugin_decorators().
|
801
|
-
"""
|
699
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
802
700
|
...
|
803
701
|
|
804
702
|
@typing.overload
|
805
|
-
def
|
703
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
806
704
|
...
|
807
705
|
|
808
|
-
def
|
706
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
809
707
|
"""
|
810
|
-
|
811
|
-
|
708
|
+
Specifies environment variables to be set prior to the execution of a step.
|
709
|
+
|
710
|
+
Parameters
|
711
|
+
----------
|
712
|
+
vars : Dict[str, str], default {}
|
713
|
+
Dictionary of environment variables to set.
|
812
714
|
"""
|
813
715
|
...
|
814
716
|
|
815
717
|
@typing.overload
|
816
|
-
def
|
718
|
+
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]]]:
|
817
719
|
"""
|
818
|
-
Specifies the
|
720
|
+
Specifies the resources needed when executing this step.
|
819
721
|
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
722
|
+
Use `@resources` to specify the resource requirements
|
723
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
724
|
+
|
725
|
+
You can choose the compute layer on the command line by executing e.g.
|
726
|
+
```
|
727
|
+
python myflow.py run --with batch
|
728
|
+
```
|
729
|
+
or
|
730
|
+
```
|
731
|
+
python myflow.py run --with kubernetes
|
732
|
+
```
|
733
|
+
which executes the flow on the desired system using the
|
734
|
+
requirements specified in `@resources`.
|
824
735
|
|
825
736
|
Parameters
|
826
737
|
----------
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
738
|
+
cpu : int, default 1
|
739
|
+
Number of CPUs required for this step.
|
740
|
+
gpu : int, default 0
|
741
|
+
Number of GPUs required for this step.
|
742
|
+
disk : int, optional, default None
|
743
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
744
|
+
memory : int, default 4096
|
745
|
+
Memory size (in MB) required for this step.
|
746
|
+
shared_memory : int, optional, default None
|
747
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
748
|
+
This parameter maps to the `--shm-size` option in Docker.
|
837
749
|
"""
|
838
750
|
...
|
839
751
|
|
840
752
|
@typing.overload
|
841
|
-
def
|
753
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
842
754
|
...
|
843
755
|
|
844
756
|
@typing.overload
|
845
|
-
def
|
757
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
846
758
|
...
|
847
759
|
|
848
|
-
def
|
760
|
+
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):
|
849
761
|
"""
|
850
|
-
Specifies the
|
762
|
+
Specifies the resources needed when executing this step.
|
851
763
|
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
764
|
+
Use `@resources` to specify the resource requirements
|
765
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
766
|
+
|
767
|
+
You can choose the compute layer on the command line by executing e.g.
|
768
|
+
```
|
769
|
+
python myflow.py run --with batch
|
770
|
+
```
|
771
|
+
or
|
772
|
+
```
|
773
|
+
python myflow.py run --with kubernetes
|
774
|
+
```
|
775
|
+
which executes the flow on the desired system using the
|
776
|
+
requirements specified in `@resources`.
|
856
777
|
|
857
778
|
Parameters
|
858
779
|
----------
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
780
|
+
cpu : int, default 1
|
781
|
+
Number of CPUs required for this step.
|
782
|
+
gpu : int, default 0
|
783
|
+
Number of GPUs required for this step.
|
784
|
+
disk : int, optional, default None
|
785
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
786
|
+
memory : int, default 4096
|
787
|
+
Memory size (in MB) required for this step.
|
788
|
+
shared_memory : int, optional, default None
|
789
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
790
|
+
This parameter maps to the `--shm-size` option in Docker.
|
869
791
|
"""
|
870
792
|
...
|
871
793
|
|
872
794
|
@typing.overload
|
873
|
-
def
|
795
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
874
796
|
"""
|
875
|
-
|
876
|
-
|
877
|
-
This decorator is useful if this step may hang indefinitely.
|
878
|
-
|
879
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
880
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
881
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
882
|
-
|
883
|
-
Note that all the values specified in parameters are added together so if you specify
|
884
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
885
|
-
|
886
|
-
Parameters
|
887
|
-
----------
|
888
|
-
seconds : int, default 0
|
889
|
-
Number of seconds to wait prior to timing out.
|
890
|
-
minutes : int, default 0
|
891
|
-
Number of minutes to wait prior to timing out.
|
892
|
-
hours : int, default 0
|
893
|
-
Number of hours to wait prior to timing out.
|
797
|
+
Decorator prototype for all step decorators. This function gets specialized
|
798
|
+
and imported for all decorators types by _import_plugin_decorators().
|
894
799
|
"""
|
895
800
|
...
|
896
801
|
|
897
802
|
@typing.overload
|
898
|
-
def
|
899
|
-
...
|
900
|
-
|
901
|
-
@typing.overload
|
902
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
803
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
903
804
|
...
|
904
805
|
|
905
|
-
def
|
806
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
906
807
|
"""
|
907
|
-
|
908
|
-
|
909
|
-
This decorator is useful if this step may hang indefinitely.
|
910
|
-
|
911
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
912
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
913
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
914
|
-
|
915
|
-
Note that all the values specified in parameters are added together so if you specify
|
916
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
917
|
-
|
918
|
-
Parameters
|
919
|
-
----------
|
920
|
-
seconds : int, default 0
|
921
|
-
Number of seconds to wait prior to timing out.
|
922
|
-
minutes : int, default 0
|
923
|
-
Number of minutes to wait prior to timing out.
|
924
|
-
hours : int, default 0
|
925
|
-
Number of hours to wait prior to timing out.
|
808
|
+
Decorator prototype for all step decorators. This function gets specialized
|
809
|
+
and imported for all decorators types by _import_plugin_decorators().
|
926
810
|
"""
|
927
811
|
...
|
928
812
|
|
@@ -993,16 +877,19 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
993
877
|
...
|
994
878
|
|
995
879
|
@typing.overload
|
996
|
-
def
|
880
|
+
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]]]:
|
997
881
|
"""
|
998
|
-
Specifies the PyPI packages for
|
882
|
+
Specifies the PyPI packages for the step.
|
999
883
|
|
1000
|
-
|
884
|
+
Information in this decorator will augment any
|
885
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
886
|
+
you can use `@pypi_base` to set packages required by all
|
1001
887
|
steps and use `@pypi` to specify step-specific overrides.
|
888
|
+
|
1002
889
|
Parameters
|
1003
890
|
----------
|
1004
891
|
packages : Dict[str, str], default: {}
|
1005
|
-
Packages to use for this
|
892
|
+
Packages to use for this step. The key is the name of the package
|
1006
893
|
and the value is the version to use.
|
1007
894
|
python : str, optional, default: None
|
1008
895
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
@@ -1011,19 +898,26 @@ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[s
|
|
1011
898
|
...
|
1012
899
|
|
1013
900
|
@typing.overload
|
1014
|
-
def
|
901
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1015
902
|
...
|
1016
903
|
|
1017
|
-
|
904
|
+
@typing.overload
|
905
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
906
|
+
...
|
907
|
+
|
908
|
+
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):
|
1018
909
|
"""
|
1019
|
-
Specifies the PyPI packages for
|
910
|
+
Specifies the PyPI packages for the step.
|
1020
911
|
|
1021
|
-
|
912
|
+
Information in this decorator will augment any
|
913
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
914
|
+
you can use `@pypi_base` to set packages required by all
|
1022
915
|
steps and use `@pypi` to specify step-specific overrides.
|
916
|
+
|
1023
917
|
Parameters
|
1024
918
|
----------
|
1025
919
|
packages : Dict[str, str], default: {}
|
1026
|
-
Packages to use for this
|
920
|
+
Packages to use for this step. The key is the name of the package
|
1027
921
|
and the value is the version to use.
|
1028
922
|
python : str, optional, default: None
|
1029
923
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
@@ -1032,173 +926,241 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
1032
926
|
...
|
1033
927
|
|
1034
928
|
@typing.overload
|
1035
|
-
def
|
929
|
+
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]]]:
|
1036
930
|
"""
|
1037
|
-
|
1038
|
-
|
931
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
932
|
+
|
933
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1039
934
|
|
1040
935
|
Parameters
|
1041
936
|
----------
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1053
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
937
|
+
type : str, default 'default'
|
938
|
+
Card type.
|
939
|
+
id : str, optional, default None
|
940
|
+
If multiple cards are present, use this id to identify this card.
|
941
|
+
options : Dict[str, Any], default {}
|
942
|
+
Options passed to the card. The contents depend on the card type.
|
943
|
+
timeout : int, default 45
|
944
|
+
Interrupt reporting if it takes more than this many seconds.
|
945
|
+
|
946
|
+
|
1054
947
|
"""
|
1055
948
|
...
|
1056
949
|
|
1057
950
|
@typing.overload
|
1058
|
-
def
|
951
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1059
952
|
...
|
1060
953
|
|
1061
|
-
|
954
|
+
@typing.overload
|
955
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
956
|
+
...
|
957
|
+
|
958
|
+
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):
|
1062
959
|
"""
|
1063
|
-
|
1064
|
-
|
960
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
961
|
+
|
962
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1065
963
|
|
1066
964
|
Parameters
|
1067
965
|
----------
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1079
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
966
|
+
type : str, default 'default'
|
967
|
+
Card type.
|
968
|
+
id : str, optional, default None
|
969
|
+
If multiple cards are present, use this id to identify this card.
|
970
|
+
options : Dict[str, Any], default {}
|
971
|
+
Options passed to the card. The contents depend on the card type.
|
972
|
+
timeout : int, default 45
|
973
|
+
Interrupt reporting if it takes more than this many seconds.
|
974
|
+
|
975
|
+
|
1080
976
|
"""
|
1081
977
|
...
|
1082
978
|
|
1083
979
|
@typing.overload
|
1084
|
-
def
|
980
|
+
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]]]:
|
1085
981
|
"""
|
1086
|
-
|
982
|
+
Enables checkpointing for a step.
|
1087
983
|
|
1088
|
-
Use `@conda_base` to set common libraries required by all
|
1089
|
-
steps and use `@conda` to specify step-specific additions.
|
1090
984
|
|
1091
985
|
Parameters
|
1092
986
|
----------
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
987
|
+
load_policy : str, default: "fresh"
|
988
|
+
The policy for loading the checkpoint. The following policies are supported:
|
989
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
990
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
991
|
+
will be loaded at the start of the task.
|
992
|
+
- "none": Do not load any checkpoint
|
993
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
994
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
995
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
996
|
+
created within the task will be loaded when the task is retries execution on failure.
|
997
|
+
|
998
|
+
temp_dir_root : str, default: None
|
999
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
1000
|
+
|
1001
|
+
|
1002
|
+
|
1103
1003
|
"""
|
1104
1004
|
...
|
1105
1005
|
|
1106
1006
|
@typing.overload
|
1107
|
-
def
|
1007
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1108
1008
|
...
|
1109
1009
|
|
1110
|
-
|
1010
|
+
@typing.overload
|
1011
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1012
|
+
...
|
1013
|
+
|
1014
|
+
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):
|
1111
1015
|
"""
|
1112
|
-
|
1016
|
+
Enables checkpointing for a step.
|
1113
1017
|
|
1114
|
-
Use `@conda_base` to set common libraries required by all
|
1115
|
-
steps and use `@conda` to specify step-specific additions.
|
1116
1018
|
|
1117
1019
|
Parameters
|
1118
1020
|
----------
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1021
|
+
load_policy : str, default: "fresh"
|
1022
|
+
The policy for loading the checkpoint. The following policies are supported:
|
1023
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
1024
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
1025
|
+
will be loaded at the start of the task.
|
1026
|
+
- "none": Do not load any checkpoint
|
1027
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
1028
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
1029
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
1030
|
+
created within the task will be loaded when the task is retries execution on failure.
|
1031
|
+
|
1032
|
+
temp_dir_root : str, default: None
|
1033
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
1034
|
+
|
1035
|
+
|
1036
|
+
|
1129
1037
|
"""
|
1130
1038
|
...
|
1131
1039
|
|
1132
|
-
|
1040
|
+
@typing.overload
|
1041
|
+
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]]]:
|
1133
1042
|
"""
|
1134
|
-
|
1135
|
-
|
1043
|
+
Enables loading / saving of models within a step.
|
1044
|
+
|
1136
1045
|
|
1137
1046
|
Parameters
|
1138
1047
|
----------
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
the
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
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)
|
1048
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
1049
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
1050
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
1051
|
+
- `current.checkpoint`
|
1052
|
+
- `current.model`
|
1053
|
+
- `current.huggingface_hub`
|
1054
|
+
|
1055
|
+
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
|
1056
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
1057
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
1058
|
+
|
1059
|
+
temp_dir_root : str, default: None
|
1060
|
+
The root directory under which `current.model.loaded` will store loaded models
|
1061
|
+
|
1062
|
+
|
1063
|
+
|
1171
1064
|
"""
|
1172
1065
|
...
|
1173
1066
|
|
1174
|
-
|
1067
|
+
@typing.overload
|
1068
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1069
|
+
...
|
1070
|
+
|
1071
|
+
@typing.overload
|
1072
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1073
|
+
...
|
1074
|
+
|
1075
|
+
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):
|
1175
1076
|
"""
|
1176
|
-
|
1077
|
+
Enables loading / saving of models within a step.
|
1177
1078
|
|
1178
|
-
User code call
|
1179
|
-
-----------
|
1180
|
-
@nim(
|
1181
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1182
|
-
backend='managed'
|
1183
|
-
)
|
1184
1079
|
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1080
|
+
Parameters
|
1081
|
+
----------
|
1082
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
1083
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
1084
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
1085
|
+
- `current.checkpoint`
|
1086
|
+
- `current.model`
|
1087
|
+
- `current.huggingface_hub`
|
1189
1088
|
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1089
|
+
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
|
1090
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
1091
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
1092
|
+
|
1093
|
+
temp_dir_root : str, default: None
|
1094
|
+
The root directory under which `current.model.loaded` will store loaded models
|
1095
|
+
|
1096
|
+
|
1097
|
+
|
1098
|
+
"""
|
1099
|
+
...
|
1100
|
+
|
1101
|
+
@typing.overload
|
1102
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1103
|
+
"""
|
1104
|
+
Internal decorator to support Fast bakery
|
1105
|
+
"""
|
1106
|
+
...
|
1107
|
+
|
1108
|
+
@typing.overload
|
1109
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1110
|
+
...
|
1111
|
+
|
1112
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1113
|
+
"""
|
1114
|
+
Internal decorator to support Fast bakery
|
1115
|
+
"""
|
1116
|
+
...
|
1117
|
+
|
1118
|
+
@typing.overload
|
1119
|
+
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1120
|
+
"""
|
1121
|
+
Specifies the times when the flow should be run when running on a
|
1122
|
+
production scheduler.
|
1123
|
+
|
1124
|
+
Parameters
|
1125
|
+
----------
|
1126
|
+
hourly : bool, default False
|
1127
|
+
Run the workflow hourly.
|
1128
|
+
daily : bool, default True
|
1129
|
+
Run the workflow daily.
|
1130
|
+
weekly : bool, default False
|
1131
|
+
Run the workflow weekly.
|
1132
|
+
cron : str, optional, default None
|
1133
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1134
|
+
specified by this expression.
|
1135
|
+
timezone : str, optional, default None
|
1136
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1137
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1138
|
+
"""
|
1139
|
+
...
|
1140
|
+
|
1141
|
+
@typing.overload
|
1142
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1143
|
+
...
|
1144
|
+
|
1145
|
+
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1146
|
+
"""
|
1147
|
+
Specifies the times when the flow should be run when running on a
|
1148
|
+
production scheduler.
|
1195
1149
|
|
1196
1150
|
Parameters
|
1197
1151
|
----------
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1152
|
+
hourly : bool, default False
|
1153
|
+
Run the workflow hourly.
|
1154
|
+
daily : bool, default True
|
1155
|
+
Run the workflow daily.
|
1156
|
+
weekly : bool, default False
|
1157
|
+
Run the workflow weekly.
|
1158
|
+
cron : str, optional, default None
|
1159
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1160
|
+
specified by this expression.
|
1161
|
+
timezone : str, optional, default None
|
1162
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1163
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1202
1164
|
"""
|
1203
1165
|
...
|
1204
1166
|
|
@@ -1297,24 +1259,6 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1297
1259
|
"""
|
1298
1260
|
...
|
1299
1261
|
|
1300
|
-
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1301
|
-
"""
|
1302
|
-
Specifies what flows belong to the same project.
|
1303
|
-
|
1304
|
-
A project-specific namespace is created for all flows that
|
1305
|
-
use the same `@project(name)`.
|
1306
|
-
|
1307
|
-
Parameters
|
1308
|
-
----------
|
1309
|
-
name : str
|
1310
|
-
Project name. Make sure that the name is unique amongst all
|
1311
|
-
projects that use the same production scheduler. The name may
|
1312
|
-
contain only lowercase alphanumeric characters and underscores.
|
1313
|
-
|
1314
|
-
|
1315
|
-
"""
|
1316
|
-
...
|
1317
|
-
|
1318
1262
|
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
1263
|
"""
|
1320
1264
|
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,6 +1301,94 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1357
1301
|
"""
|
1358
1302
|
...
|
1359
1303
|
|
1304
|
+
@typing.overload
|
1305
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1306
|
+
"""
|
1307
|
+
Specifies the PyPI packages for all steps of the flow.
|
1308
|
+
|
1309
|
+
Use `@pypi_base` to set common packages required by all
|
1310
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1311
|
+
Parameters
|
1312
|
+
----------
|
1313
|
+
packages : Dict[str, str], default: {}
|
1314
|
+
Packages to use for this flow. The key is the name of the package
|
1315
|
+
and the value is the version to use.
|
1316
|
+
python : str, optional, default: None
|
1317
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1318
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1319
|
+
"""
|
1320
|
+
...
|
1321
|
+
|
1322
|
+
@typing.overload
|
1323
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1324
|
+
...
|
1325
|
+
|
1326
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1327
|
+
"""
|
1328
|
+
Specifies the PyPI packages for all steps of the flow.
|
1329
|
+
|
1330
|
+
Use `@pypi_base` to set common packages required by all
|
1331
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1332
|
+
Parameters
|
1333
|
+
----------
|
1334
|
+
packages : Dict[str, str], default: {}
|
1335
|
+
Packages to use for this flow. The key is the name of the package
|
1336
|
+
and the value is the version to use.
|
1337
|
+
python : str, optional, default: None
|
1338
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1339
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1340
|
+
"""
|
1341
|
+
...
|
1342
|
+
|
1343
|
+
@typing.overload
|
1344
|
+
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]]:
|
1345
|
+
"""
|
1346
|
+
Specifies the Conda environment for all steps of the flow.
|
1347
|
+
|
1348
|
+
Use `@conda_base` to set common libraries required by all
|
1349
|
+
steps and use `@conda` to specify step-specific additions.
|
1350
|
+
|
1351
|
+
Parameters
|
1352
|
+
----------
|
1353
|
+
packages : Dict[str, str], default {}
|
1354
|
+
Packages to use for this flow. The key is the name of the package
|
1355
|
+
and the value is the version to use.
|
1356
|
+
libraries : Dict[str, str], default {}
|
1357
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1358
|
+
python : str, optional, default None
|
1359
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1360
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1361
|
+
disabled : bool, default False
|
1362
|
+
If set to True, disables Conda.
|
1363
|
+
"""
|
1364
|
+
...
|
1365
|
+
|
1366
|
+
@typing.overload
|
1367
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1368
|
+
...
|
1369
|
+
|
1370
|
+
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):
|
1371
|
+
"""
|
1372
|
+
Specifies the Conda environment for all steps of the flow.
|
1373
|
+
|
1374
|
+
Use `@conda_base` to set common libraries required by all
|
1375
|
+
steps and use `@conda` to specify step-specific additions.
|
1376
|
+
|
1377
|
+
Parameters
|
1378
|
+
----------
|
1379
|
+
packages : Dict[str, str], default {}
|
1380
|
+
Packages to use for this flow. The key is the name of the package
|
1381
|
+
and the value is the version to use.
|
1382
|
+
libraries : Dict[str, str], default {}
|
1383
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1384
|
+
python : str, optional, default None
|
1385
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1386
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1387
|
+
disabled : bool, default False
|
1388
|
+
If set to True, disables Conda.
|
1389
|
+
"""
|
1390
|
+
...
|
1391
|
+
|
1360
1392
|
@typing.overload
|
1361
1393
|
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
1394
|
"""
|
@@ -1460,6 +1492,97 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1460
1492
|
"""
|
1461
1493
|
...
|
1462
1494
|
|
1495
|
+
def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1496
|
+
"""
|
1497
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
1498
|
+
|
1499
|
+
User code call
|
1500
|
+
-----------
|
1501
|
+
@nim(
|
1502
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
1503
|
+
backend='managed'
|
1504
|
+
)
|
1505
|
+
|
1506
|
+
Valid backend options
|
1507
|
+
---------------------
|
1508
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
1509
|
+
- 🚧 'dataplane': Run in your account.
|
1510
|
+
|
1511
|
+
Valid model options
|
1512
|
+
----------------
|
1513
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
1514
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
1515
|
+
- Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
1516
|
+
|
1517
|
+
Parameters
|
1518
|
+
----------
|
1519
|
+
models: list[NIM]
|
1520
|
+
List of NIM containers running models in sidecars.
|
1521
|
+
backend: str
|
1522
|
+
Compute provider to run the NIM container.
|
1523
|
+
"""
|
1524
|
+
...
|
1525
|
+
|
1526
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1527
|
+
"""
|
1528
|
+
Specifies what flows belong to the same project.
|
1529
|
+
|
1530
|
+
A project-specific namespace is created for all flows that
|
1531
|
+
use the same `@project(name)`.
|
1532
|
+
|
1533
|
+
Parameters
|
1534
|
+
----------
|
1535
|
+
name : str
|
1536
|
+
Project name. Make sure that the name is unique amongst all
|
1537
|
+
projects that use the same production scheduler. The name may
|
1538
|
+
contain only lowercase alphanumeric characters and underscores.
|
1539
|
+
|
1540
|
+
|
1541
|
+
"""
|
1542
|
+
...
|
1543
|
+
|
1544
|
+
def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1545
|
+
"""
|
1546
|
+
The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
|
1547
|
+
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1548
|
+
|
1549
|
+
Parameters
|
1550
|
+
----------
|
1551
|
+
timeout : int
|
1552
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1553
|
+
poke_interval : int
|
1554
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1555
|
+
mode : str
|
1556
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1557
|
+
exponential_backoff : bool
|
1558
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1559
|
+
pool : str
|
1560
|
+
the slot pool this task should run in,
|
1561
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1562
|
+
soft_fail : bool
|
1563
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1564
|
+
name : str
|
1565
|
+
Name of the sensor on Airflow
|
1566
|
+
description : str
|
1567
|
+
Description of sensor in the Airflow UI
|
1568
|
+
external_dag_id : str
|
1569
|
+
The dag_id that contains the task you want to wait for.
|
1570
|
+
external_task_ids : List[str]
|
1571
|
+
The list of task_ids that you want to wait for.
|
1572
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1573
|
+
allowed_states : List[str]
|
1574
|
+
Iterable of allowed states, (Default: ['success'])
|
1575
|
+
failed_states : List[str]
|
1576
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1577
|
+
execution_delta : datetime.timedelta
|
1578
|
+
time difference with the previous execution to look at,
|
1579
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1580
|
+
check_existence: bool
|
1581
|
+
Set to True to check if the external task exists or check if
|
1582
|
+
the DAG to wait for exists. (Default: True)
|
1583
|
+
"""
|
1584
|
+
...
|
1585
|
+
|
1463
1586
|
def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
|
1464
1587
|
"""
|
1465
1588
|
Switch namespace to the one provided.
|
@@ -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
|
|