ob-metaflow-stubs 6.0.3.104__py2.py3-none-any.whl → 6.0.3.106__py2.py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- metaflow-stubs/__init__.pyi +853 -515
- metaflow-stubs/cards.pyi +211 -5
- metaflow-stubs/cli.pyi +22 -2
- metaflow-stubs/client/__init__.pyi +128 -3
- metaflow-stubs/client/core.pyi +226 -6
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/clone_util.pyi +5 -2
- metaflow-stubs/events.pyi +20 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +70 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +156 -3
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata/metadata.pyi +8 -2
- metaflow-stubs/metadata/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +22 -19
- metaflow-stubs/mflog/mflog.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +68 -2
- metaflow-stubs/plugins/__init__.pyi +14 -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 +80 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +5 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +44 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +44 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +16 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +17 -4
- metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +98 -7
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +32 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +50 -5
- 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 +102 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +15 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +21 -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 +49 -4
- 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 +21 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_cli.pyi +63 -5
- metaflow-stubs/plugins/cards/card_client.pyi +34 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +5 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +8 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +52 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +28 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +41 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +28 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +183 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +5 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +35 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +55 -2
- metaflow-stubs/plugins/cards/exception.pyi +8 -2
- metaflow-stubs/plugins/catch_decorator.pyi +19 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +63 -3
- metaflow-stubs/plugins/datatools/local.pyi +16 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +72 -3
- metaflow-stubs/plugins/datatools/s3/s3.pyi +83 -6
- 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 +10 -2
- metaflow-stubs/plugins/events_decorator.pyi +106 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +24 -3
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +15 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +11 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +65 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +99 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +5 -2
- metaflow-stubs/plugins/logs_cli.pyi +3 -3
- metaflow-stubs/plugins/package_cli.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +29 -2
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +59 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +45 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +33 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +33 -2
- metaflow-stubs/plugins/retry_decorator.pyi +21 -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 +11 -2
- metaflow-stubs/plugins/storage_executor.pyi +6 -2
- metaflow-stubs/plugins/tag_cli.pyi +37 -6
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +10 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +23 -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 +70 -131
- metaflow-stubs/runner/metaflow_runner.pyi +118 -10
- metaflow-stubs/runner/nbdeploy.pyi +66 -2
- metaflow-stubs/runner/nbrun.pyi +79 -2
- metaflow-stubs/runner/subprocess_manager.pyi +16 -4
- metaflow-stubs/runner/utils.pyi +32 -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-6.0.3.104.dist-info → ob_metaflow_stubs-6.0.3.106.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.106.dist-info/RECORD +140 -0
- ob_metaflow_stubs-6.0.3.104.dist-info/RECORD +0 -140
- {ob_metaflow_stubs-6.0.3.104.dist-info → ob_metaflow_stubs-6.0.3.106.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.104.dist-info → ob_metaflow_stubs-6.0.3.106.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
|
4
|
+
# Generated on 2024-10-04T19:10:58.915989 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -9,8 +9,8 @@ from __future__ import annotations
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
11
|
import metaflow.exception
|
12
|
-
import metaflow.plugins.cards.card_client
|
13
12
|
import metaflow
|
13
|
+
import metaflow.plugins.cards.card_client
|
14
14
|
|
15
15
|
TYPE_CHECKING: bool
|
16
16
|
|
@@ -86,6 +86,14 @@ class IncorrectPathspecException(metaflow.exception.MetaflowException, metaclass
|
|
86
86
|
...
|
87
87
|
|
88
88
|
class Card(object, metaclass=type):
|
89
|
+
"""
|
90
|
+
`Card` represents an individual Metaflow Card, a single HTML file, produced by
|
91
|
+
the card `@card` decorator. `Card`s are contained by `CardContainer`, returned by
|
92
|
+
`get_cards`.
|
93
|
+
|
94
|
+
Note that the contents of the card, an HTML file, is retrieved lazily when you call
|
95
|
+
`Card.get` for the first time or when the card is rendered in a notebook.
|
96
|
+
"""
|
89
97
|
def __init__(self, card_ds, type, path, hash, id = None, html = None, created_on = None, from_resumed = False, origin_pathspec = None):
|
90
98
|
...
|
91
99
|
def get_data(self) -> typing.Optional[dict]:
|
@@ -137,6 +145,29 @@ class Card(object, metaclass=type):
|
|
137
145
|
...
|
138
146
|
|
139
147
|
class CardContainer(object, metaclass=type):
|
148
|
+
"""
|
149
|
+
`CardContainer` is an immutable list-like object, returned by `get_cards`,
|
150
|
+
which contains individual `Card`s.
|
151
|
+
|
152
|
+
Notably, `CardContainer` contains a special
|
153
|
+
`_repr_html_` function which renders cards automatically in an output
|
154
|
+
cell of a notebook.
|
155
|
+
|
156
|
+
The following operations are supported:
|
157
|
+
```
|
158
|
+
cards = get_cards(MyTask)
|
159
|
+
|
160
|
+
# retrieve by index
|
161
|
+
first_card = cards[0]
|
162
|
+
|
163
|
+
# check length
|
164
|
+
if len(cards) > 1:
|
165
|
+
print('many cards present!')
|
166
|
+
|
167
|
+
# iteration
|
168
|
+
list_of_cards = list(cards)
|
169
|
+
```
|
170
|
+
"""
|
140
171
|
def __init__(self, card_paths, card_ds, origin_pathspec = None):
|
141
172
|
...
|
142
173
|
def __len__(self):
|
@@ -1,7 +1,7 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
|
4
|
+
# Generated on 2024-10-04T19:10:58.957931 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -15,6 +15,9 @@ current: metaflow.metaflow_current.Current
|
|
15
15
|
ASYNC_TIMEOUT: int
|
16
16
|
|
17
17
|
class CardProcessManager(object, metaclass=type):
|
18
|
+
"""
|
19
|
+
This class is responsible for managing the card creation processes.
|
20
|
+
"""
|
18
21
|
...
|
19
22
|
|
20
23
|
class CardCreator(object, metaclass=type):
|
@@ -1,7 +1,7 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
|
4
|
+
# Generated on 2024-10-04T19:10:58.940249 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -25,6 +25,9 @@ CARD_GSROOT: None
|
|
25
25
|
SKIP_CARD_DUALWRITE: bool
|
26
26
|
|
27
27
|
class CardNotPresentException(metaflow.exception.MetaflowException, metaclass=type):
|
28
|
+
"""
|
29
|
+
This exception is raised with a card is not present in the datastore.
|
30
|
+
"""
|
28
31
|
def __init__(self, pathspec, card_type = None, card_hash = None, card_id = None):
|
29
32
|
...
|
30
33
|
...
|
@@ -34,6 +37,9 @@ TEMP_DIR_NAME: str
|
|
34
37
|
NUM_SHORT_HASH_CHARS: int
|
35
38
|
|
36
39
|
class CardInfo(tuple, metaclass=type):
|
40
|
+
"""
|
41
|
+
CardInfo(type, hash, id, filename)
|
42
|
+
"""
|
37
43
|
@staticmethod
|
38
44
|
def __new__(_cls, type, hash, id, filename):
|
39
45
|
"""
|
@@ -1,7 +1,7 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
|
4
|
+
# Generated on 2024-10-04T19:10:58.958679 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -14,6 +14,25 @@ if typing.TYPE_CHECKING:
|
|
14
14
|
current: metaflow.metaflow_current.Current
|
15
15
|
|
16
16
|
class CardComponentCollector(object, metaclass=type):
|
17
|
+
"""
|
18
|
+
This class helps collect `MetaflowCardComponent`s during runtime execution
|
19
|
+
|
20
|
+
### Usage with `current`
|
21
|
+
`current.card` is of type `CardComponentCollector`
|
22
|
+
|
23
|
+
### Main Usage TLDR
|
24
|
+
- [x] `current.card.append` customizes the default editable card.
|
25
|
+
- [x] Only one card can be default editable in a step.
|
26
|
+
- [x] The card class must have `ALLOW_USER_COMPONENTS=True` to be considered default editable.
|
27
|
+
- [x] Classes with `ALLOW_USER_COMPONENTS=False` are never default editable.
|
28
|
+
- [x] The user can specify an `id` argument to a card, in which case the card is editable through `current.card[id].append`.
|
29
|
+
- [x] A card with an id can be also default editable, if there are no other cards that are eligible to be default editable.
|
30
|
+
- [x] If multiple default-editable cards exist but only one card doesn't have an id, the card without an id is considered to be default editable.
|
31
|
+
- [x] If we can't resolve a single default editable card through the above rules, `current.card`.append calls show a warning but the call doesn't fail.
|
32
|
+
- [x] A card that is not default editable can be still edited through:
|
33
|
+
- [x] its `current.card['myid']`
|
34
|
+
- [x] by looking it up by its type, e.g. `current.card.get(type='pytorch')`.
|
35
|
+
"""
|
17
36
|
def __init__(self, logger = None, card_creator = None):
|
18
37
|
...
|
19
38
|
@staticmethod
|
@@ -121,6 +140,37 @@ def warning_message(message, logger = None, ts = False):
|
|
121
140
|
...
|
122
141
|
|
123
142
|
class CardDecorator(metaflow.decorators.StepDecorator, metaclass=type):
|
143
|
+
"""
|
144
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
145
|
+
|
146
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
147
|
+
|
148
|
+
Parameters
|
149
|
+
----------
|
150
|
+
type : str, default 'default'
|
151
|
+
Card type.
|
152
|
+
id : str, optional, default None
|
153
|
+
If multiple cards are present, use this id to identify this card.
|
154
|
+
options : Dict[str, Any], default {}
|
155
|
+
Options passed to the card. The contents depend on the card type.
|
156
|
+
timeout : int, default 45
|
157
|
+
Interrupt reporting if it takes more than this many seconds.
|
158
|
+
|
159
|
+
MF Add To Current
|
160
|
+
-----------------
|
161
|
+
card -> metaflow.plugins.cards.component_serializer.CardComponentCollector
|
162
|
+
The `@card` decorator makes the cards available through the `current.card`
|
163
|
+
object. If multiple `@card` decorators are present, you can add an `ID` to
|
164
|
+
distinguish between them using `@card(id=ID)` as the decorator. You will then
|
165
|
+
be able to access that specific card using `current.card[ID].
|
166
|
+
|
167
|
+
Methods available are `append` and `extend`
|
168
|
+
|
169
|
+
@@ Returns
|
170
|
+
-------
|
171
|
+
CardComponentCollector
|
172
|
+
The or one of the cards attached to this step.
|
173
|
+
"""
|
124
174
|
def __init__(self, *args, **kwargs):
|
125
175
|
...
|
126
176
|
def step_init(self, flow, graph, step_name, decorators, environment, flow_datastore, logger):
|
@@ -1,7 +1,7 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
|
4
|
+
# Generated on 2024-10-04T19:10:58.956284 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -11,6 +11,32 @@ if typing.TYPE_CHECKING:
|
|
11
11
|
import metaflow
|
12
12
|
|
13
13
|
class MetaflowCard(object, metaclass=type):
|
14
|
+
"""
|
15
|
+
Metaflow cards derive from this base class.
|
16
|
+
|
17
|
+
Subclasses of this class are called *card types*. The desired card
|
18
|
+
type `T` is defined in the `@card` decorator as `@card(type=T)`.
|
19
|
+
|
20
|
+
After a task with `@card(type=T, options=S)` finishes executing, Metaflow instantiates
|
21
|
+
a subclass `C` of `MetaflowCard` that has its `type` attribute set to `T`, i.e. `C.type=T`.
|
22
|
+
The constructor is given the options dictionary `S` that contains arbitrary
|
23
|
+
JSON-encodable data that is passed to the instance, parametrizing the card. The subclass
|
24
|
+
may override the constructor to capture and process the options.
|
25
|
+
|
26
|
+
The subclass needs to implement a `render(task)` method that produces the card
|
27
|
+
contents in HTML, given the finished task that is represented by a `Task` object.
|
28
|
+
|
29
|
+
Attributes
|
30
|
+
----------
|
31
|
+
type : str
|
32
|
+
Card type string. Note that this should be a globally unique name, similar to a
|
33
|
+
Python package name, to avoid name clashes between different custom cards.
|
34
|
+
|
35
|
+
Parameters
|
36
|
+
----------
|
37
|
+
options : Dict
|
38
|
+
JSON-encodable dictionary containing user-definable options for the class.
|
39
|
+
"""
|
14
40
|
def __init__(self, options = {}, components = [], graph = None):
|
15
41
|
...
|
16
42
|
def render(self, task: "metaflow.Task") -> str:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
|
4
|
+
# Generated on 2024-10-04T19:10:58.920507 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -13,6 +13,32 @@ if typing.TYPE_CHECKING:
|
|
13
13
|
import metaflow
|
14
14
|
|
15
15
|
class MetaflowCard(object, metaclass=type):
|
16
|
+
"""
|
17
|
+
Metaflow cards derive from this base class.
|
18
|
+
|
19
|
+
Subclasses of this class are called *card types*. The desired card
|
20
|
+
type `T` is defined in the `@card` decorator as `@card(type=T)`.
|
21
|
+
|
22
|
+
After a task with `@card(type=T, options=S)` finishes executing, Metaflow instantiates
|
23
|
+
a subclass `C` of `MetaflowCard` that has its `type` attribute set to `T`, i.e. `C.type=T`.
|
24
|
+
The constructor is given the options dictionary `S` that contains arbitrary
|
25
|
+
JSON-encodable data that is passed to the instance, parametrizing the card. The subclass
|
26
|
+
may override the constructor to capture and process the options.
|
27
|
+
|
28
|
+
The subclass needs to implement a `render(task)` method that produces the card
|
29
|
+
contents in HTML, given the finished task that is represented by a `Task` object.
|
30
|
+
|
31
|
+
Attributes
|
32
|
+
----------
|
33
|
+
type : str
|
34
|
+
Card type string. Note that this should be a globally unique name, similar to a
|
35
|
+
Python package name, to avoid name clashes between different custom cards.
|
36
|
+
|
37
|
+
Parameters
|
38
|
+
----------
|
39
|
+
options : Dict
|
40
|
+
JSON-encodable dictionary containing user-definable options for the class.
|
41
|
+
"""
|
16
42
|
def __init__(self, options = {}, components = [], graph = None):
|
17
43
|
...
|
18
44
|
def render(self, task: "metaflow.Task") -> str:
|
@@ -88,6 +114,14 @@ def read_file(path):
|
|
88
114
|
...
|
89
115
|
|
90
116
|
class DefaultComponent(metaflow.plugins.cards.card_modules.card.MetaflowCardComponent, metaclass=type):
|
117
|
+
"""
|
118
|
+
The `DefaultCard` and the `BlankCard` use a JS framework that build the HTML dynamically from JSON.
|
119
|
+
The `DefaultComponent` is the base component that helps build the JSON when `render` is called.
|
120
|
+
|
121
|
+
The underlying JS framework consists of various types of objects.
|
122
|
+
These can be found in: "metaflow/plugins/cards/ui/types.ts".
|
123
|
+
The `type` attribute in a `DefaultComponent` corresponds to the type of component in the Javascript framework.
|
124
|
+
"""
|
91
125
|
def __init__(self, title = None, subtitle = None):
|
92
126
|
...
|
93
127
|
def render(self):
|
@@ -197,6 +231,11 @@ class MarkdownComponent(DefaultComponent, metaclass=type):
|
|
197
231
|
...
|
198
232
|
|
199
233
|
class TaskInfoComponent(metaflow.plugins.cards.card_modules.card.MetaflowCardComponent, metaclass=type):
|
234
|
+
"""
|
235
|
+
Properties
|
236
|
+
page_content : a list of MetaflowCardComponents going as task info
|
237
|
+
final_component: the dictionary returned by the `render` function of this class.
|
238
|
+
"""
|
200
239
|
def __init__(self, task, page_title = "Task Info", only_repr = True, graph = None, components = [], runtime = False):
|
201
240
|
...
|
202
241
|
def render(self):
|
@@ -1,7 +1,7 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
|
4
|
+
# Generated on 2024-10-04T19:10:58.916436 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -13,6 +13,32 @@ if typing.TYPE_CHECKING:
|
|
13
13
|
TYPE_CHECKING: bool
|
14
14
|
|
15
15
|
class MetaflowCard(object, metaclass=type):
|
16
|
+
"""
|
17
|
+
Metaflow cards derive from this base class.
|
18
|
+
|
19
|
+
Subclasses of this class are called *card types*. The desired card
|
20
|
+
type `T` is defined in the `@card` decorator as `@card(type=T)`.
|
21
|
+
|
22
|
+
After a task with `@card(type=T, options=S)` finishes executing, Metaflow instantiates
|
23
|
+
a subclass `C` of `MetaflowCard` that has its `type` attribute set to `T`, i.e. `C.type=T`.
|
24
|
+
The constructor is given the options dictionary `S` that contains arbitrary
|
25
|
+
JSON-encodable data that is passed to the instance, parametrizing the card. The subclass
|
26
|
+
may override the constructor to capture and process the options.
|
27
|
+
|
28
|
+
The subclass needs to implement a `render(task)` method that produces the card
|
29
|
+
contents in HTML, given the finished task that is represented by a `Task` object.
|
30
|
+
|
31
|
+
Attributes
|
32
|
+
----------
|
33
|
+
type : str
|
34
|
+
Card type string. Note that this should be a globally unique name, similar to a
|
35
|
+
Python package name, to avoid name clashes between different custom cards.
|
36
|
+
|
37
|
+
Parameters
|
38
|
+
----------
|
39
|
+
options : Dict
|
40
|
+
JSON-encodable dictionary containing user-definable options for the class.
|
41
|
+
"""
|
16
42
|
def __init__(self, options = {}, components = [], graph = None):
|
17
43
|
...
|
18
44
|
def render(self, task: "metaflow.Task") -> str:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
|
4
|
+
# Generated on 2024-10-04T19:10:58.918396 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -10,8 +10,8 @@ import typing
|
|
10
10
|
if typing.TYPE_CHECKING:
|
11
11
|
import metaflow.plugins.cards.card_modules.components
|
12
12
|
import typing
|
13
|
-
import metaflow.plugins.cards.card_modules.card
|
14
13
|
import metaflow.plugins.cards.card_modules.basic
|
14
|
+
import metaflow.plugins.cards.card_modules.card
|
15
15
|
|
16
16
|
class LogComponent(metaflow.plugins.cards.card_modules.basic.DefaultComponent, metaclass=type):
|
17
17
|
def __init__(self, data = None):
|
@@ -126,6 +126,26 @@ class StubComponent(UserComponent, metaclass=type):
|
|
126
126
|
...
|
127
127
|
|
128
128
|
class Artifact(UserComponent, metaclass=type):
|
129
|
+
"""
|
130
|
+
A pretty-printed version of any Python object.
|
131
|
+
|
132
|
+
Large objects are truncated using Python's built-in [`reprlib`](https://docs.python.org/3/library/reprlib.html).
|
133
|
+
|
134
|
+
Example:
|
135
|
+
```
|
136
|
+
from datetime import datetime
|
137
|
+
current.card.append(Artifact({'now': datetime.utcnow()}))
|
138
|
+
```
|
139
|
+
|
140
|
+
Parameters
|
141
|
+
----------
|
142
|
+
artifact : object
|
143
|
+
Any Python object.
|
144
|
+
name : str, optional
|
145
|
+
Optional label for the object.
|
146
|
+
compressed : bool, default: True
|
147
|
+
Use a truncated representation.
|
148
|
+
"""
|
129
149
|
def update(self, artifact):
|
130
150
|
...
|
131
151
|
def __init__(self, artifact: typing.Any, name: typing.Optional[str] = None, compressed: bool = True):
|
@@ -135,6 +155,45 @@ class Artifact(UserComponent, metaclass=type):
|
|
135
155
|
...
|
136
156
|
|
137
157
|
class Table(UserComponent, metaclass=type):
|
158
|
+
"""
|
159
|
+
A table.
|
160
|
+
|
161
|
+
The contents of the table can be text or numerical data, a Pandas dataframe,
|
162
|
+
or other card components: `Artifact`, `Image`, `Markdown` objects.
|
163
|
+
|
164
|
+
Example: Text and artifacts
|
165
|
+
```
|
166
|
+
from metaflow.cards import Table, Artifact
|
167
|
+
current.card.append(
|
168
|
+
Table([
|
169
|
+
['first row', Artifact({'a': 2})],
|
170
|
+
['second row', Artifact(3)]
|
171
|
+
])
|
172
|
+
)
|
173
|
+
```
|
174
|
+
|
175
|
+
Example: Table from a Pandas dataframe
|
176
|
+
```
|
177
|
+
from metaflow.cards import Table
|
178
|
+
import pandas as pd
|
179
|
+
import numpy as np
|
180
|
+
current.card.append(
|
181
|
+
Table.from_dataframe(
|
182
|
+
pd.DataFrame(
|
183
|
+
np.random.randint(0, 100, size=(15, 4)),
|
184
|
+
columns=list("ABCD")
|
185
|
+
)
|
186
|
+
)
|
187
|
+
)
|
188
|
+
```
|
189
|
+
|
190
|
+
Parameters
|
191
|
+
----------
|
192
|
+
data : List[List[str or MetaflowCardComponent]], optional
|
193
|
+
List (rows) of lists (columns). Each item can be a string or a `MetaflowCardComponent`.
|
194
|
+
headers : List[str], optional
|
195
|
+
Optional header row for the table.
|
196
|
+
"""
|
138
197
|
def update(self, *args, **kwargs):
|
139
198
|
...
|
140
199
|
def __init__(self, data: typing.Optional[typing.List[typing.List[typing.Union[str, metaflow.plugins.cards.card_modules.card.MetaflowCardComponent]]]] = None, headers: typing.Optional[typing.List[str]] = None, disable_updates: bool = False):
|
@@ -157,6 +216,55 @@ class Table(UserComponent, metaclass=type):
|
|
157
216
|
...
|
158
217
|
|
159
218
|
class Image(UserComponent, metaclass=type):
|
219
|
+
"""
|
220
|
+
An image.
|
221
|
+
|
222
|
+
`Images can be created directly from PNG/JPG/GIF `bytes`, `PIL.Image`s,
|
223
|
+
or Matplotlib figures. Note that the image data is embedded in the card,
|
224
|
+
so no external files are required to show the image.
|
225
|
+
|
226
|
+
Example: Create an `Image` from bytes:
|
227
|
+
```
|
228
|
+
current.card.append(
|
229
|
+
Image(
|
230
|
+
requests.get("https://www.gif-vif.com/hacker-cat.gif").content,
|
231
|
+
"Image From Bytes"
|
232
|
+
)
|
233
|
+
)
|
234
|
+
```
|
235
|
+
|
236
|
+
Example: Create an `Image` from a Matplotlib figure
|
237
|
+
```
|
238
|
+
import pandas as pd
|
239
|
+
import numpy as np
|
240
|
+
current.card.append(
|
241
|
+
Image.from_matplotlib(
|
242
|
+
pandas.DataFrame(
|
243
|
+
np.random.randint(0, 100, size=(15, 4)),
|
244
|
+
columns=list("ABCD"),
|
245
|
+
).plot()
|
246
|
+
)
|
247
|
+
)
|
248
|
+
```
|
249
|
+
|
250
|
+
Example: Create an `Image` from a [PIL](https://pillow.readthedocs.io/) Image
|
251
|
+
```
|
252
|
+
from PIL import Image as PILImage
|
253
|
+
current.card.append(
|
254
|
+
Image.from_pil_image(
|
255
|
+
PILImage.fromarray(np.random.randn(1024, 768), "RGB"),
|
256
|
+
"From PIL Image"
|
257
|
+
)
|
258
|
+
)
|
259
|
+
```
|
260
|
+
|
261
|
+
Parameters
|
262
|
+
----------
|
263
|
+
src : bytes
|
264
|
+
The image data in `bytes`.
|
265
|
+
label : str
|
266
|
+
Optional label for the image.
|
267
|
+
"""
|
160
268
|
@staticmethod
|
161
269
|
def render_fail_headline(msg):
|
162
270
|
...
|
@@ -205,6 +313,30 @@ class Image(UserComponent, metaclass=type):
|
|
205
313
|
...
|
206
314
|
|
207
315
|
class Error(UserComponent, metaclass=type):
|
316
|
+
"""
|
317
|
+
This class helps visualize Error's on the `MetaflowCard`. It can help catch and print stack traces to errors that happen in `@step` code.
|
318
|
+
|
319
|
+
### Parameters
|
320
|
+
- `exception` (Exception) : The `Exception` to visualize. This value will be `repr`'d before passed down to `MetaflowCard`
|
321
|
+
- `title` (str) : The title that will appear over the visualized `Exception`.
|
322
|
+
|
323
|
+
### Usage
|
324
|
+
```python
|
325
|
+
@card
|
326
|
+
@step
|
327
|
+
def my_step(self):
|
328
|
+
from metaflow.cards import Error
|
329
|
+
from metaflow import current
|
330
|
+
try:
|
331
|
+
...
|
332
|
+
...
|
333
|
+
except Exception as e:
|
334
|
+
current.card.append(
|
335
|
+
Error(e,"Something misbehaved")
|
336
|
+
)
|
337
|
+
...
|
338
|
+
```
|
339
|
+
"""
|
208
340
|
def __init__(self, exception, title = None):
|
209
341
|
...
|
210
342
|
def render(self, *args, **kwargs):
|
@@ -212,6 +344,21 @@ class Error(UserComponent, metaclass=type):
|
|
212
344
|
...
|
213
345
|
|
214
346
|
class Markdown(UserComponent, metaclass=type):
|
347
|
+
"""
|
348
|
+
A block of text formatted in Markdown.
|
349
|
+
|
350
|
+
Example:
|
351
|
+
```
|
352
|
+
current.card.append(
|
353
|
+
Markdown("# This is a header appended from `@step` code")
|
354
|
+
)
|
355
|
+
```
|
356
|
+
|
357
|
+
Parameters
|
358
|
+
----------
|
359
|
+
text : str
|
360
|
+
Text formatted in Markdown.
|
361
|
+
"""
|
215
362
|
def update(self, text = None):
|
216
363
|
...
|
217
364
|
def __init__(self, text = None):
|
@@ -221,6 +368,39 @@ class Markdown(UserComponent, metaclass=type):
|
|
221
368
|
...
|
222
369
|
|
223
370
|
class ProgressBar(UserComponent, metaclass=type):
|
371
|
+
"""
|
372
|
+
A Progress bar for tracking progress of any task.
|
373
|
+
|
374
|
+
Example:
|
375
|
+
```
|
376
|
+
progress_bar = ProgressBar(
|
377
|
+
max=100,
|
378
|
+
label="Progress Bar",
|
379
|
+
value=0,
|
380
|
+
unit="%",
|
381
|
+
metadata="0.1 items/s"
|
382
|
+
)
|
383
|
+
current.card.append(
|
384
|
+
progress_bar
|
385
|
+
)
|
386
|
+
for i in range(100):
|
387
|
+
progress_bar.update(i, metadata="%s items/s" % i)
|
388
|
+
|
389
|
+
```
|
390
|
+
|
391
|
+
Parameters
|
392
|
+
----------
|
393
|
+
max : int
|
394
|
+
The maximum value of the progress bar.
|
395
|
+
label : str, optional
|
396
|
+
Optional label for the progress bar.
|
397
|
+
value : int, optional
|
398
|
+
Optional initial value of the progress bar.
|
399
|
+
unit : str, optional
|
400
|
+
Optional unit for the progress bar.
|
401
|
+
metadata : str, optional
|
402
|
+
Optional additional information to show on the progress bar.
|
403
|
+
"""
|
224
404
|
def __init__(self, max: int = 100, label: str = None, value: int = 0, unit: str = None, metadata: str = None):
|
225
405
|
...
|
226
406
|
def update(self, new_value: int, metadata: str = None):
|
@@ -1,13 +1,16 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
|
4
|
+
# Generated on 2024-10-04T19:10:58.941188 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
|
10
10
|
class TypeResolvedObject(tuple, metaclass=type):
|
11
|
+
"""
|
12
|
+
TypeResolvedObject(data, is_image, is_table)
|
13
|
+
"""
|
11
14
|
@staticmethod
|
12
15
|
def __new__(_cls, data, is_image, is_table):
|
13
16
|
"""
|
@@ -1,7 +1,7 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
|
4
|
+
# Generated on 2024-10-04T19:10:58.941365 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -1,7 +1,7 @@
|
|
1
1
|
##################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.12.
|
4
|
-
# Generated on 2024-
|
3
|
+
# MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
|
4
|
+
# Generated on 2024-10-04T19:10:58.934807 #
|
5
5
|
##################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -12,6 +12,32 @@ if typing.TYPE_CHECKING:
|
|
12
12
|
import metaflow
|
13
13
|
|
14
14
|
class MetaflowCard(object, metaclass=type):
|
15
|
+
"""
|
16
|
+
Metaflow cards derive from this base class.
|
17
|
+
|
18
|
+
Subclasses of this class are called *card types*. The desired card
|
19
|
+
type `T` is defined in the `@card` decorator as `@card(type=T)`.
|
20
|
+
|
21
|
+
After a task with `@card(type=T, options=S)` finishes executing, Metaflow instantiates
|
22
|
+
a subclass `C` of `MetaflowCard` that has its `type` attribute set to `T`, i.e. `C.type=T`.
|
23
|
+
The constructor is given the options dictionary `S` that contains arbitrary
|
24
|
+
JSON-encodable data that is passed to the instance, parametrizing the card. The subclass
|
25
|
+
may override the constructor to capture and process the options.
|
26
|
+
|
27
|
+
The subclass needs to implement a `render(task)` method that produces the card
|
28
|
+
contents in HTML, given the finished task that is represented by a `Task` object.
|
29
|
+
|
30
|
+
Attributes
|
31
|
+
----------
|
32
|
+
type : str
|
33
|
+
Card type string. Note that this should be a globally unique name, similar to a
|
34
|
+
Python package name, to avoid name clashes between different custom cards.
|
35
|
+
|
36
|
+
Parameters
|
37
|
+
----------
|
38
|
+
options : Dict
|
39
|
+
JSON-encodable dictionary containing user-definable options for the class.
|
40
|
+
"""
|
15
41
|
def __init__(self, options = {}, components = [], graph = None):
|
16
42
|
...
|
17
43
|
def render(self, task: "metaflow.Task") -> str:
|
@@ -132,6 +158,9 @@ class TestJSONComponent(metaflow.plugins.cards.card_modules.card.MetaflowCardCom
|
|
132
158
|
...
|
133
159
|
|
134
160
|
class TestRefreshCard(metaflow.plugins.cards.card_modules.card.MetaflowCard, metaclass=type):
|
161
|
+
"""
|
162
|
+
This card takes no components and helps test the `current.card.refresh(data)` interface.
|
163
|
+
"""
|
135
164
|
def render(self, task) -> str:
|
136
165
|
...
|
137
166
|
def render_runtime(self, task, data):
|
@@ -141,6 +170,10 @@ class TestRefreshCard(metaflow.plugins.cards.card_modules.card.MetaflowCard, met
|
|
141
170
|
...
|
142
171
|
|
143
172
|
class TestRefreshComponentCard(metaflow.plugins.cards.card_modules.card.MetaflowCard, metaclass=type):
|
173
|
+
"""
|
174
|
+
This card takes components and helps test the `current.card.components["A"].update()`
|
175
|
+
interface
|
176
|
+
"""
|
144
177
|
def __init__(self, options = {}, components = [], graph = None):
|
145
178
|
...
|
146
179
|
def render(self, task) -> str:
|