ob-metaflow-stubs 6.0.3.103rc3__py2.py3-none-any.whl → 6.0.3.105__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. metaflow-stubs/__init__.pyi +836 -498
  2. metaflow-stubs/cards.pyi +211 -5
  3. metaflow-stubs/cli.pyi +23 -3
  4. metaflow-stubs/client/__init__.pyi +129 -4
  5. metaflow-stubs/client/core.pyi +227 -7
  6. metaflow-stubs/client/filecache.pyi +2 -2
  7. metaflow-stubs/clone_util.pyi +5 -2
  8. metaflow-stubs/events.pyi +21 -3
  9. metaflow-stubs/exception.pyi +2 -2
  10. metaflow-stubs/flowspec.pyi +71 -5
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +157 -4
  13. metaflow-stubs/info_file.pyi +2 -2
  14. metaflow-stubs/metadata/metadata.pyi +8 -2
  15. metaflow-stubs/metadata/util.pyi +2 -2
  16. metaflow-stubs/metaflow_config.pyi +2 -2
  17. metaflow-stubs/metaflow_current.pyi +39 -36
  18. metaflow-stubs/mflog/mflog.pyi +2 -2
  19. metaflow-stubs/multicore_utils.pyi +2 -2
  20. metaflow-stubs/parameters.pyi +70 -4
  21. metaflow-stubs/plugins/__init__.pyi +13 -2
  22. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  23. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  24. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +80 -2
  26. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +5 -2
  27. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +45 -3
  28. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +45 -3
  29. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  30. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  31. metaflow-stubs/plugins/argo/argo_events.pyi +16 -2
  32. metaflow-stubs/plugins/argo/argo_workflows.pyi +18 -5
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +98 -7
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +33 -5
  35. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +50 -5
  36. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  37. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  38. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  39. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  40. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  41. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +103 -3
  43. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  44. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +15 -3
  45. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  46. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  47. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
  48. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +21 -2
  49. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +49 -4
  52. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  53. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  54. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  55. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +21 -3
  56. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  57. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  58. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  59. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  60. metaflow-stubs/plugins/cards/card_cli.pyi +62 -4
  61. metaflow-stubs/plugins/cards/card_client.pyi +33 -2
  62. metaflow-stubs/plugins/cards/card_creator.pyi +5 -2
  63. metaflow-stubs/plugins/cards/card_datastore.pyi +8 -2
  64. metaflow-stubs/plugins/cards/card_decorator.pyi +52 -2
  65. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +28 -2
  66. metaflow-stubs/plugins/cards/card_modules/basic.pyi +42 -3
  67. metaflow-stubs/plugins/cards/card_modules/card.pyi +28 -2
  68. metaflow-stubs/plugins/cards/card_modules/components.pyi +183 -3
  69. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +5 -2
  70. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  71. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +36 -3
  72. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  73. metaflow-stubs/plugins/cards/component_serializer.pyi +55 -2
  74. metaflow-stubs/plugins/cards/exception.pyi +8 -2
  75. metaflow-stubs/plugins/catch_decorator.pyi +20 -3
  76. metaflow-stubs/plugins/datatools/__init__.pyi +63 -3
  77. metaflow-stubs/plugins/datatools/local.pyi +16 -2
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +72 -3
  79. metaflow-stubs/plugins/datatools/s3/s3.pyi +82 -5
  80. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  81. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  82. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  83. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  84. metaflow-stubs/plugins/environment_decorator.pyi +10 -2
  85. metaflow-stubs/plugins/events_decorator.pyi +106 -2
  86. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  87. metaflow-stubs/plugins/frameworks/pytorch.pyi +23 -2
  88. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  89. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +15 -3
  90. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  91. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  92. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  93. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  94. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  95. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  96. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +12 -3
  97. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +65 -2
  98. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  99. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +100 -3
  100. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +5 -2
  101. metaflow-stubs/plugins/logs_cli.pyi +4 -4
  102. metaflow-stubs/plugins/package_cli.pyi +2 -2
  103. metaflow-stubs/plugins/parallel_decorator.pyi +29 -2
  104. metaflow-stubs/plugins/perimeters.pyi +2 -2
  105. metaflow-stubs/plugins/project_decorator.pyi +59 -2
  106. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  107. metaflow-stubs/plugins/pypi/conda_decorator.pyi +45 -2
  108. metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
  109. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +33 -2
  110. metaflow-stubs/plugins/pypi/pypi_environment.pyi +3 -3
  111. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  112. metaflow-stubs/plugins/resources_decorator.pyi +33 -2
  113. metaflow-stubs/plugins/retry_decorator.pyi +21 -2
  114. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  115. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  116. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +11 -2
  117. metaflow-stubs/plugins/storage_executor.pyi +6 -2
  118. metaflow-stubs/plugins/tag_cli.pyi +36 -5
  119. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +9 -2
  120. metaflow-stubs/plugins/timeout_decorator.pyi +23 -2
  121. metaflow-stubs/procpoll.pyi +2 -2
  122. metaflow-stubs/profilers/__init__.pyi +2 -2
  123. metaflow-stubs/pylint_wrapper.pyi +2 -2
  124. metaflow-stubs/runner/__init__.pyi +2 -2
  125. metaflow-stubs/runner/deployer.pyi +71 -132
  126. metaflow-stubs/runner/metaflow_runner.pyi +117 -9
  127. metaflow-stubs/runner/nbdeploy.pyi +66 -2
  128. metaflow-stubs/runner/nbrun.pyi +79 -2
  129. metaflow-stubs/runner/subprocess_manager.pyi +16 -4
  130. metaflow-stubs/runner/utils.pyi +32 -2
  131. metaflow-stubs/system/__init__.pyi +3 -3
  132. metaflow-stubs/system/system_logger.pyi +2 -2
  133. metaflow-stubs/system/system_monitor.pyi +3 -3
  134. metaflow-stubs/tagging_util.pyi +2 -2
  135. metaflow-stubs/tuple_util.pyi +2 -2
  136. {ob_metaflow_stubs-6.0.3.103rc3.dist-info → ob_metaflow_stubs-6.0.3.105.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.105.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.103rc3.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.103rc3.dist-info → ob_metaflow_stubs-6.0.3.105.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.103rc3.dist-info → ob_metaflow_stubs-6.0.3.105.dist-info}/top_level.txt +0 -0
metaflow-stubs/cards.pyi CHANGED
@@ -1,7 +1,7 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.22.1+obcheckpoint(0.0.11);ob(v1) #
4
- # Generated on 2024-09-20T21:42:44.546102 #
3
+ # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-04T10:13:10.638167 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -9,11 +9,11 @@ from __future__ import annotations
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
11
  import metaflow.plugins.cards.card_modules.basic
12
- import metaflow
13
- import typing
14
12
  import metaflow.plugins.cards.card_modules.components
15
- import metaflow.plugins.cards.card_modules.card
13
+ import typing
14
+ import metaflow
16
15
  import metaflow.plugins.cards.card_client
16
+ import metaflow.plugins.cards.card_modules.card
17
17
 
18
18
  def get_cards(task: typing.Union[str, "metaflow.Task"], id: typing.Optional[str] = None, type: typing.Optional[str] = None, follow_resumed: bool = True) -> metaflow.plugins.cards.card_client.CardContainer:
19
19
  """
@@ -64,6 +64,32 @@ class MetaflowCardComponent(object, metaclass=type):
64
64
  ...
65
65
 
66
66
  class MetaflowCard(object, metaclass=type):
67
+ """
68
+ Metaflow cards derive from this base class.
69
+
70
+ Subclasses of this class are called *card types*. The desired card
71
+ type `T` is defined in the `@card` decorator as `@card(type=T)`.
72
+
73
+ After a task with `@card(type=T, options=S)` finishes executing, Metaflow instantiates
74
+ a subclass `C` of `MetaflowCard` that has its `type` attribute set to `T`, i.e. `C.type=T`.
75
+ The constructor is given the options dictionary `S` that contains arbitrary
76
+ JSON-encodable data that is passed to the instance, parametrizing the card. The subclass
77
+ may override the constructor to capture and process the options.
78
+
79
+ The subclass needs to implement a `render(task)` method that produces the card
80
+ contents in HTML, given the finished task that is represented by a `Task` object.
81
+
82
+ Attributes
83
+ ----------
84
+ type : str
85
+ Card type string. Note that this should be a globally unique name, similar to a
86
+ Python package name, to avoid name clashes between different custom cards.
87
+
88
+ Parameters
89
+ ----------
90
+ options : Dict
91
+ JSON-encodable dictionary containing user-definable options for the class.
92
+ """
67
93
  def __init__(self, options = {}, components = [], graph = None):
68
94
  ...
69
95
  def render(self, task: "metaflow.Task") -> str:
@@ -93,6 +119,26 @@ class MetaflowCard(object, metaclass=type):
93
119
  ...
94
120
 
95
121
  class Artifact(metaflow.plugins.cards.card_modules.components.UserComponent, metaclass=type):
122
+ """
123
+ A pretty-printed version of any Python object.
124
+
125
+ Large objects are truncated using Python's built-in [`reprlib`](https://docs.python.org/3/library/reprlib.html).
126
+
127
+ Example:
128
+ ```
129
+ from datetime import datetime
130
+ current.card.append(Artifact({'now': datetime.utcnow()}))
131
+ ```
132
+
133
+ Parameters
134
+ ----------
135
+ artifact : object
136
+ Any Python object.
137
+ name : str, optional
138
+ Optional label for the object.
139
+ compressed : bool, default: True
140
+ Use a truncated representation.
141
+ """
96
142
  def update(self, artifact):
97
143
  ...
98
144
  def __init__(self, artifact: typing.Any, name: typing.Optional[str] = None, compressed: bool = True):
@@ -102,6 +148,45 @@ class Artifact(metaflow.plugins.cards.card_modules.components.UserComponent, met
102
148
  ...
103
149
 
104
150
  class Table(metaflow.plugins.cards.card_modules.components.UserComponent, metaclass=type):
151
+ """
152
+ A table.
153
+
154
+ The contents of the table can be text or numerical data, a Pandas dataframe,
155
+ or other card components: `Artifact`, `Image`, `Markdown` objects.
156
+
157
+ Example: Text and artifacts
158
+ ```
159
+ from metaflow.cards import Table, Artifact
160
+ current.card.append(
161
+ Table([
162
+ ['first row', Artifact({'a': 2})],
163
+ ['second row', Artifact(3)]
164
+ ])
165
+ )
166
+ ```
167
+
168
+ Example: Table from a Pandas dataframe
169
+ ```
170
+ from metaflow.cards import Table
171
+ import pandas as pd
172
+ import numpy as np
173
+ current.card.append(
174
+ Table.from_dataframe(
175
+ pd.DataFrame(
176
+ np.random.randint(0, 100, size=(15, 4)),
177
+ columns=list("ABCD")
178
+ )
179
+ )
180
+ )
181
+ ```
182
+
183
+ Parameters
184
+ ----------
185
+ data : List[List[str or MetaflowCardComponent]], optional
186
+ List (rows) of lists (columns). Each item can be a string or a `MetaflowCardComponent`.
187
+ headers : List[str], optional
188
+ Optional header row for the table.
189
+ """
105
190
  def update(self, *args, **kwargs):
106
191
  ...
107
192
  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):
@@ -124,6 +209,55 @@ class Table(metaflow.plugins.cards.card_modules.components.UserComponent, metacl
124
209
  ...
125
210
 
126
211
  class Image(metaflow.plugins.cards.card_modules.components.UserComponent, metaclass=type):
212
+ """
213
+ An image.
214
+
215
+ `Images can be created directly from PNG/JPG/GIF `bytes`, `PIL.Image`s,
216
+ or Matplotlib figures. Note that the image data is embedded in the card,
217
+ so no external files are required to show the image.
218
+
219
+ Example: Create an `Image` from bytes:
220
+ ```
221
+ current.card.append(
222
+ Image(
223
+ requests.get("https://www.gif-vif.com/hacker-cat.gif").content,
224
+ "Image From Bytes"
225
+ )
226
+ )
227
+ ```
228
+
229
+ Example: Create an `Image` from a Matplotlib figure
230
+ ```
231
+ import pandas as pd
232
+ import numpy as np
233
+ current.card.append(
234
+ Image.from_matplotlib(
235
+ pandas.DataFrame(
236
+ np.random.randint(0, 100, size=(15, 4)),
237
+ columns=list("ABCD"),
238
+ ).plot()
239
+ )
240
+ )
241
+ ```
242
+
243
+ Example: Create an `Image` from a [PIL](https://pillow.readthedocs.io/) Image
244
+ ```
245
+ from PIL import Image as PILImage
246
+ current.card.append(
247
+ Image.from_pil_image(
248
+ PILImage.fromarray(np.random.randn(1024, 768), "RGB"),
249
+ "From PIL Image"
250
+ )
251
+ )
252
+ ```
253
+
254
+ Parameters
255
+ ----------
256
+ src : bytes
257
+ The image data in `bytes`.
258
+ label : str
259
+ Optional label for the image.
260
+ """
127
261
  @staticmethod
128
262
  def render_fail_headline(msg):
129
263
  ...
@@ -172,6 +306,30 @@ class Image(metaflow.plugins.cards.card_modules.components.UserComponent, metacl
172
306
  ...
173
307
 
174
308
  class Error(metaflow.plugins.cards.card_modules.components.UserComponent, metaclass=type):
309
+ """
310
+ This class helps visualize Error's on the `MetaflowCard`. It can help catch and print stack traces to errors that happen in `@step` code.
311
+
312
+ ### Parameters
313
+ - `exception` (Exception) : The `Exception` to visualize. This value will be `repr`'d before passed down to `MetaflowCard`
314
+ - `title` (str) : The title that will appear over the visualized `Exception`.
315
+
316
+ ### Usage
317
+ ```python
318
+ @card
319
+ @step
320
+ def my_step(self):
321
+ from metaflow.cards import Error
322
+ from metaflow import current
323
+ try:
324
+ ...
325
+ ...
326
+ except Exception as e:
327
+ current.card.append(
328
+ Error(e,"Something misbehaved")
329
+ )
330
+ ...
331
+ ```
332
+ """
175
333
  def __init__(self, exception, title = None):
176
334
  ...
177
335
  def render(self, *args, **kwargs):
@@ -179,6 +337,21 @@ class Error(metaflow.plugins.cards.card_modules.components.UserComponent, metacl
179
337
  ...
180
338
 
181
339
  class Markdown(metaflow.plugins.cards.card_modules.components.UserComponent, metaclass=type):
340
+ """
341
+ A block of text formatted in Markdown.
342
+
343
+ Example:
344
+ ```
345
+ current.card.append(
346
+ Markdown("# This is a header appended from `@step` code")
347
+ )
348
+ ```
349
+
350
+ Parameters
351
+ ----------
352
+ text : str
353
+ Text formatted in Markdown.
354
+ """
182
355
  def update(self, text = None):
183
356
  ...
184
357
  def __init__(self, text = None):
@@ -208,6 +381,39 @@ class VegaChart(metaflow.plugins.cards.card_modules.components.UserComponent, me
208
381
  ...
209
382
 
210
383
  class ProgressBar(metaflow.plugins.cards.card_modules.components.UserComponent, metaclass=type):
384
+ """
385
+ A Progress bar for tracking progress of any task.
386
+
387
+ Example:
388
+ ```
389
+ progress_bar = ProgressBar(
390
+ max=100,
391
+ label="Progress Bar",
392
+ value=0,
393
+ unit="%",
394
+ metadata="0.1 items/s"
395
+ )
396
+ current.card.append(
397
+ progress_bar
398
+ )
399
+ for i in range(100):
400
+ progress_bar.update(i, metadata="%s items/s" % i)
401
+
402
+ ```
403
+
404
+ Parameters
405
+ ----------
406
+ max : int
407
+ The maximum value of the progress bar.
408
+ label : str, optional
409
+ Optional label for the progress bar.
410
+ value : int, optional
411
+ Optional initial value of the progress bar.
412
+ unit : str, optional
413
+ Optional unit for the progress bar.
414
+ metadata : str, optional
415
+ Optional additional information to show on the progress bar.
416
+ """
211
417
  def __init__(self, max: int = 100, label: str = None, value: int = 0, unit: str = None, metadata: str = None):
212
418
  ...
213
419
  def update(self, new_value: int, metadata: str = None):
metaflow-stubs/cli.pyi CHANGED
@@ -1,15 +1,35 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.22.1+obcheckpoint(0.0.11);ob(v1) #
4
- # Generated on 2024-09-20T21:42:44.562759 #
3
+ # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-04T10:13:10.653970 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import metaflow.metaflow_current
12
11
  import metaflow.exception
12
+ import metaflow.metaflow_current
13
+
14
+ def get_metadata() -> str:
15
+ """
16
+ Returns the current Metadata provider.
17
+
18
+ If this is not set explicitly using `metadata`, the default value is
19
+ determined through the Metaflow configuration. You can use this call to
20
+ check that your configuration is set up properly.
21
+
22
+ If multiple configuration profiles are present, this call returns the one
23
+ selected through the `METAFLOW_PROFILE` environment variable.
24
+
25
+ Returns
26
+ -------
27
+ str
28
+ Information about the Metadata provider currently selected. This information typically
29
+ returns provider specific information (like URL for remote providers or local paths for
30
+ local providers).
31
+ """
32
+ ...
13
33
 
14
34
  def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
15
35
  """
@@ -1,17 +1,17 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.22.1+obcheckpoint(0.0.11);ob(v1) #
4
- # Generated on 2024-09-20T21:42:44.553361 #
3
+ # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-04T10:13:10.645394 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import metaflow.events
11
+ import metaflow.client.core
12
12
  import typing
13
+ import metaflow.events
13
14
  import datetime
14
- import metaflow.client.core
15
15
 
16
16
  def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
17
17
  """
@@ -119,6 +119,19 @@ def default_metadata() -> str:
119
119
  ...
120
120
 
121
121
  class Metaflow(object, metaclass=type):
122
+ """
123
+ Entry point to all objects in the Metaflow universe.
124
+
125
+ This object can be used to list all the flows present either through the explicit property
126
+ or by iterating over this object.
127
+
128
+ Attributes
129
+ ----------
130
+ flows : List[Flow]
131
+ Returns the list of all `Flow` objects known to this metadata provider. Note that only
132
+ flows present in the current namespace will be returned. A `Flow` is present in a namespace
133
+ if it has at least one run in the namespace.
134
+ """
122
135
  def __init__(self):
123
136
  ...
124
137
  @property
@@ -170,6 +183,17 @@ class Metaflow(object, metaclass=type):
170
183
  ...
171
184
 
172
185
  class Flow(metaflow.client.core.MetaflowObject, metaclass=type):
186
+ """
187
+ A Flow represents all existing flows with a certain name, in other words,
188
+ classes derived from `FlowSpec`. A container of `Run` objects.
189
+
190
+ Attributes
191
+ ----------
192
+ latest_run : Run
193
+ Latest `Run` (in progress or completed, successfully or not) of this flow.
194
+ latest_successful_run : Run
195
+ Latest successfully completed `Run` of this flow.
196
+ """
173
197
  def __init__(self, *args, **kwargs):
174
198
  ...
175
199
  @property
@@ -256,6 +280,26 @@ class Flow(metaflow.client.core.MetaflowObject, metaclass=type):
256
280
  ...
257
281
 
258
282
  class Run(metaflow.client.core.MetaflowObject, metaclass=type):
283
+ """
284
+ A `Run` represents an execution of a `Flow`. It is a container of `Step`s.
285
+
286
+ Attributes
287
+ ----------
288
+ data : MetaflowData
289
+ a shortcut to run['end'].task.data, i.e. data produced by this run.
290
+ successful : bool
291
+ True if the run completed successfully.
292
+ finished : bool
293
+ True if the run completed.
294
+ finished_at : datetime
295
+ Time this run finished.
296
+ code : MetaflowCode
297
+ Code package for this run (if present). See `MetaflowCode`.
298
+ trigger : MetaflowTrigger
299
+ Information about event(s) that triggered this run (if present). See `MetaflowTrigger`.
300
+ end_task : Task
301
+ `Task` for the end step (if it is present already).
302
+ """
259
303
  def steps(self, *tags: str) -> typing.Iterator[metaflow.client.core.Step]:
260
304
  """
261
305
  [Legacy function - do not use]
@@ -488,6 +532,23 @@ class Run(metaflow.client.core.MetaflowObject, metaclass=type):
488
532
  ...
489
533
 
490
534
  class Step(metaflow.client.core.MetaflowObject, metaclass=type):
535
+ """
536
+ A `Step` represents a user-defined step, that is, a method annotated with the `@step` decorator.
537
+
538
+ It contains `Task` objects associated with the step, that is, all executions of the
539
+ `Step`. The step may contain multiple `Task`s in the case of a foreach step.
540
+
541
+ Attributes
542
+ ----------
543
+ task : Task
544
+ The first `Task` object in this step. This is a shortcut for retrieving the only
545
+ task contained in a non-foreach step.
546
+ finished_at : datetime
547
+ Time when the latest `Task` of this step finished. Note that in the case of foreaches,
548
+ this time may change during execution of the step.
549
+ environment_info : Dict[str, Any]
550
+ Information about the execution environment.
551
+ """
491
552
  @property
492
553
  def task(self) -> typing.Optional[metaflow.client.core.Task]:
493
554
  """
@@ -622,6 +683,55 @@ class Step(metaflow.client.core.MetaflowObject, metaclass=type):
622
683
  ...
623
684
 
624
685
  class Task(metaflow.client.core.MetaflowObject, metaclass=type):
686
+ """
687
+ A `Task` represents an execution of a `Step`.
688
+
689
+ It contains all `DataArtifact` objects produced by the task as
690
+ well as metadata related to execution.
691
+
692
+ Note that the `@retry` decorator may cause multiple attempts of
693
+ the task to be present. Usually you want the latest attempt, which
694
+ is what instantiating a `Task` object returns by default. If
695
+ you need to e.g. retrieve logs from a failed attempt, you can
696
+ explicitly get information about a specific attempt by using the
697
+ following syntax when creating a task:
698
+
699
+ `Task('flow/run/step/task', attempt=<attempt>)`
700
+
701
+ where `attempt=0` corresponds to the first attempt etc.
702
+
703
+ Attributes
704
+ ----------
705
+ metadata : List[Metadata]
706
+ List of all metadata events associated with the task.
707
+ metadata_dict : Dict[str, str]
708
+ A condensed version of `metadata`: A dictionary where keys
709
+ are names of metadata events and values the latest corresponding event.
710
+ data : MetaflowData
711
+ Container of all data artifacts produced by this task. Note that this
712
+ call downloads all data locally, so it can be slower than accessing
713
+ artifacts individually. See `MetaflowData` for more information.
714
+ artifacts : MetaflowArtifacts
715
+ Container of `DataArtifact` objects produced by this task.
716
+ successful : bool
717
+ True if the task completed successfully.
718
+ finished : bool
719
+ True if the task completed.
720
+ exception : object
721
+ Exception raised by this task if there was one.
722
+ finished_at : datetime
723
+ Time this task finished.
724
+ runtime_name : str
725
+ Runtime this task was executed on.
726
+ stdout : str
727
+ Standard output for the task execution.
728
+ stderr : str
729
+ Standard error output for the task execution.
730
+ code : MetaflowCode
731
+ Code package for this task (if present). See `MetaflowCode`.
732
+ environment_info : Dict[str, str]
733
+ Information about the execution environment.
734
+ """
625
735
  def __init__(self, *args, **kwargs):
626
736
  ...
627
737
  @property
@@ -936,6 +1046,21 @@ class Task(metaflow.client.core.MetaflowObject, metaclass=type):
936
1046
  ...
937
1047
 
938
1048
  class DataArtifact(metaflow.client.core.MetaflowObject, metaclass=type):
1049
+ """
1050
+ A single data artifact and associated metadata. Note that this object does
1051
+ not contain other objects as it is the leaf object in the hierarchy.
1052
+
1053
+ Attributes
1054
+ ----------
1055
+ data : object
1056
+ The data contained in this artifact, that is, the object produced during
1057
+ execution of this run.
1058
+ sha : string
1059
+ A unique ID of this artifact.
1060
+ finished_at : datetime
1061
+ Corresponds roughly to the `Task.finished_at` time of the parent `Task`.
1062
+ An alias for `DataArtifact.created_at`.
1063
+ """
939
1064
  @property
940
1065
  def data(self) -> typing.Any:
941
1066
  """