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
@@ -1,20 +1,40 @@
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.555769 #
3
+ # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-04T10:13:10.647815 #
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.runner.metaflow_runner
12
11
  import metaflow.runner.subprocess_manager
13
- import datetime
14
12
  import metaflow.events
13
+ import datetime
14
+ import metaflow.runner.metaflow_runner
15
15
  import metaflow.client.core
16
16
 
17
17
  class Run(metaflow.client.core.MetaflowObject, metaclass=type):
18
+ """
19
+ A `Run` represents an execution of a `Flow`. It is a container of `Step`s.
20
+
21
+ Attributes
22
+ ----------
23
+ data : MetaflowData
24
+ a shortcut to run['end'].task.data, i.e. data produced by this run.
25
+ successful : bool
26
+ True if the run completed successfully.
27
+ finished : bool
28
+ True if the run completed.
29
+ finished_at : datetime
30
+ Time this run finished.
31
+ code : MetaflowCode
32
+ Code package for this run (if present). See `MetaflowCode`.
33
+ trigger : MetaflowTrigger
34
+ Information about event(s) that triggered this run (if present). See `MetaflowTrigger`.
35
+ end_task : Task
36
+ `Task` for the end step (if it is present already).
37
+ """
18
38
  def steps(self, *tags: str) -> typing.Iterator[metaflow.client.core.Step]:
19
39
  """
20
40
  [Legacy function - do not use]
@@ -274,13 +294,40 @@ def metadata(ms: str) -> str:
274
294
  """
275
295
  ...
276
296
 
277
- def clear_and_set_os_environ(env: typing.Dict):
297
+ def handle_timeout(tfp_runner_attribute, command_obj: "CommandManager", file_read_timeout: int):
298
+ """
299
+ Handle the timeout for a running subprocess command that reads a file
300
+ and raises an error with appropriate logs if a TimeoutError occurs.
301
+
302
+ Parameters
303
+ ----------
304
+ tfp_runner_attribute : NamedTemporaryFile
305
+ Temporary file that stores runner attribute data.
306
+ command_obj : CommandManager
307
+ Command manager object that encapsulates the running command details.
308
+ file_read_timeout : int
309
+ Timeout for reading the file.
310
+
311
+ Returns
312
+ -------
313
+ str
314
+ Content read from the temporary file.
315
+
316
+ Raises
317
+ ------
318
+ RuntimeError
319
+ If a TimeoutError occurs, it raises a RuntimeError with the command's
320
+ stdout and stderr logs.
321
+ """
278
322
  ...
279
323
 
280
- def read_from_file_when_ready(file_path: str, command_obj: "CommandManager", timeout: float = 5):
324
+ def clear_and_set_os_environ(env: typing.Dict):
281
325
  ...
282
326
 
283
327
  class CommandManager(object, metaclass=type):
328
+ """
329
+ A manager for an individual subprocess.
330
+ """
284
331
  def __init__(self, command: typing.List[str], env: typing.Optional[typing.Dict[str, str]] = None, cwd: typing.Optional[str] = None):
285
332
  """
286
333
  Create a new CommandManager object.
@@ -319,6 +366,8 @@ class CommandManager(object, metaclass=type):
319
366
  be one of `stdout` or `stderr`.
320
367
  """
321
368
  ...
369
+ def sync_wait(self):
370
+ ...
322
371
  def run(self, show_output: bool = False):
323
372
  """
324
373
  Run the subprocess synchronously. This can only be called once.
@@ -391,13 +440,13 @@ class CommandManager(object, metaclass=type):
391
440
  Clean up log files for a running subprocesses.
392
441
  """
393
442
  ...
394
- def kill(self, termination_timeout: float = 5):
443
+ def kill(self, termination_timeout: float = 2):
395
444
  """
396
445
  Kill the subprocess and its descendants.
397
446
 
398
447
  Parameters
399
448
  ----------
400
- termination_timeout : float, default 5
449
+ termination_timeout : float, default 2
401
450
  The time to wait after sending a SIGTERM to the process and its descendants
402
451
  before sending a SIGKILL.
403
452
  """
@@ -405,6 +454,10 @@ class CommandManager(object, metaclass=type):
405
454
  ...
406
455
 
407
456
  class SubprocessManager(object, metaclass=type):
457
+ """
458
+ A manager for subprocesses. The subprocess manager manages one or more
459
+ CommandManager objects, each of which manages an individual subprocess.
460
+ """
408
461
  def __init__(self):
409
462
  ...
410
463
  def __aenter__(self) -> metaflow.runner.subprocess_manager.SubprocessManager:
@@ -481,6 +534,22 @@ class SubprocessManager(object, metaclass=type):
481
534
  ...
482
535
 
483
536
  class ExecutingRun(object, metaclass=type):
537
+ """
538
+ This class contains a reference to a `metaflow.Run` object representing
539
+ the currently executing or finished run, as well as metadata related
540
+ to the process.
541
+
542
+ `ExecutingRun` is returned by methods in `Runner` and `NBRunner`. It is not
543
+ meant to be instantiated directly.
544
+
545
+ This class works as a context manager, allowing you to use a pattern like
546
+ ```python
547
+ with Runner(...).run() as running:
548
+ ...
549
+ ```
550
+ Note that you should use either this object as the context manager or
551
+ `Runner`, not both in a nested manner.
552
+ """
484
553
  def __init__(self, runner: Runner, command_obj: metaflow.runner.subprocess_manager.CommandManager, run_obj: metaflow.client.core.Run):
485
554
  """
486
555
  Create a new ExecutingRun -- this should not be done by the user directly but
@@ -541,9 +610,10 @@ class ExecutingRun(object, metaclass=type):
541
610
  for executing the run.
542
611
 
543
612
  The return value is one of the following strings:
613
+ - `timeout` indicates that the run timed out.
544
614
  - `running` indicates a currently executing run.
545
615
  - `failed` indicates a failed run.
546
- - `successful` a successful run.
616
+ - `successful` indicates a successful run.
547
617
 
548
618
  Returns
549
619
  -------
@@ -603,6 +673,44 @@ class ExecutingRun(object, metaclass=type):
603
673
  ...
604
674
 
605
675
  class Runner(object, metaclass=type):
676
+ """
677
+ Metaflow's Runner API that presents a programmatic interface
678
+ to run flows and perform other operations either synchronously or asynchronously.
679
+ The class expects a path to the flow file along with optional arguments
680
+ that match top-level options on the command-line.
681
+
682
+ This class works as a context manager, calling `cleanup()` to remove
683
+ temporary files at exit.
684
+
685
+ Example:
686
+ ```python
687
+ with Runner('slowflow.py', pylint=False) as runner:
688
+ result = runner.run(alpha=5, tags=["abc", "def"], max_workers=5)
689
+ print(result.run.finished)
690
+ ```
691
+
692
+ Parameters
693
+ ----------
694
+ flow_file : str
695
+ Path to the flow file to run
696
+ show_output : bool, default True
697
+ Show the 'stdout' and 'stderr' to the console by default,
698
+ Only applicable for synchronous 'run' and 'resume' functions.
699
+ profile : Optional[str], default None
700
+ Metaflow profile to use to run this run. If not specified, the default
701
+ profile is used (or the one already set using `METAFLOW_PROFILE`)
702
+ env : Optional[Dict], default None
703
+ Additional environment variables to set for the Run. This overrides the
704
+ environment set for this process.
705
+ cwd : Optional[str], default None
706
+ The directory to run the subprocess in; if not specified, the current
707
+ directory is used.
708
+ file_read_timeout : int, default 3600
709
+ The timeout until which we try to read the runner attribute file.
710
+ **kwargs : Any
711
+ Additional arguments that you would pass to `python myflow.py` before
712
+ the `run` command.
713
+ """
606
714
  def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
607
715
  ...
608
716
  def __enter__(self) -> Runner:
@@ -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.560035 #
3
+ # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-04T10:13:10.651205 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -9,6 +9,30 @@ from __future__ import annotations
9
9
  import typing
10
10
 
11
11
  class Deployer(object, metaclass=type):
12
+ """
13
+ Use the `Deployer` class to configure and access one of the production
14
+ orchestrators supported by Metaflow.
15
+
16
+ Parameters
17
+ ----------
18
+ flow_file : str
19
+ Path to the flow file to deploy.
20
+ show_output : bool, default True
21
+ Show the 'stdout' and 'stderr' to the console by default.
22
+ profile : Optional[str], default None
23
+ Metaflow profile to use for the deployment. If not specified, the default
24
+ profile is used.
25
+ env : Optional[Dict[str, str]], default None
26
+ Additional environment variables to set for the deployment.
27
+ cwd : Optional[str], default None
28
+ The directory to run the subprocess in; if not specified, the current
29
+ directory is used.
30
+ file_read_timeout : int, default 3600
31
+ The timeout until which we try to read the deployer attribute file.
32
+ **kwargs : Any
33
+ Additional arguments that you would pass to `python myflow.py` before
34
+ the deployment command.
35
+ """
12
36
  def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
13
37
  ...
14
38
  def _Deployer__make_function(self, deployer_class):
@@ -40,9 +64,49 @@ def format_flowfile(cell):
40
64
  DEFAULT_DIR: str
41
65
 
42
66
  class NBDeployerInitializationError(Exception, metaclass=type):
67
+ """
68
+ Custom exception for errors during NBDeployer initialization.
69
+ """
43
70
  ...
44
71
 
45
72
  class NBDeployer(object, metaclass=type):
73
+ """
74
+ A wrapper over `Deployer` for deploying flows defined in a Jupyter
75
+ notebook cell.
76
+
77
+ Instantiate this class on the last line of a notebook cell where
78
+ a `flow` is defined. In contrast to `Deployer`, this class is not
79
+ meant to be used in a context manager.
80
+
81
+ ```python
82
+ deployer = NBDeployer(FlowName)
83
+ ar = deployer.argo_workflows(name="madhur")
84
+ ar_obj = ar.create()
85
+ result = ar_obj.trigger(alpha=300)
86
+ print(result.status)
87
+ print(result.run)
88
+ result.terminate()
89
+ ```
90
+
91
+ Parameters
92
+ ----------
93
+ flow : FlowSpec
94
+ Flow defined in the same cell
95
+ show_output : bool, default True
96
+ Show the 'stdout' and 'stderr' to the console by default,
97
+ profile : Optional[str], default None
98
+ Metaflow profile to use to deploy this run. If not specified, the default
99
+ profile is used (or the one already set using `METAFLOW_PROFILE`)
100
+ env : Optional[Dict[str, str]], default None
101
+ Additional environment variables to set. This overrides the
102
+ environment set for this process.
103
+ base_dir : Optional[str], default None
104
+ The directory to run the subprocess in; if not specified, a temporary
105
+ directory is used.
106
+ **kwargs : Any
107
+ Additional arguments that you would pass to `python myflow.py` i.e. options
108
+ listed in `python myflow.py --help`
109
+ """
46
110
  def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str = "/tmp", file_read_timeout: int = 3600, **kwargs):
47
111
  ...
48
112
  def cleanup(self):
@@ -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.556679 #
3
+ # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-04T10:13:10.648826 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -11,6 +11,44 @@ if typing.TYPE_CHECKING:
11
11
  import metaflow.runner.metaflow_runner
12
12
 
13
13
  class Runner(object, metaclass=type):
14
+ """
15
+ Metaflow's Runner API that presents a programmatic interface
16
+ to run flows and perform other operations either synchronously or asynchronously.
17
+ The class expects a path to the flow file along with optional arguments
18
+ that match top-level options on the command-line.
19
+
20
+ This class works as a context manager, calling `cleanup()` to remove
21
+ temporary files at exit.
22
+
23
+ Example:
24
+ ```python
25
+ with Runner('slowflow.py', pylint=False) as runner:
26
+ result = runner.run(alpha=5, tags=["abc", "def"], max_workers=5)
27
+ print(result.run.finished)
28
+ ```
29
+
30
+ Parameters
31
+ ----------
32
+ flow_file : str
33
+ Path to the flow file to run
34
+ show_output : bool, default True
35
+ Show the 'stdout' and 'stderr' to the console by default,
36
+ Only applicable for synchronous 'run' and 'resume' functions.
37
+ profile : Optional[str], default None
38
+ Metaflow profile to use to run this run. If not specified, the default
39
+ profile is used (or the one already set using `METAFLOW_PROFILE`)
40
+ env : Optional[Dict], default None
41
+ Additional environment variables to set for the Run. This overrides the
42
+ environment set for this process.
43
+ cwd : Optional[str], default None
44
+ The directory to run the subprocess in; if not specified, the current
45
+ directory is used.
46
+ file_read_timeout : int, default 3600
47
+ The timeout until which we try to read the runner attribute file.
48
+ **kwargs : Any
49
+ Additional arguments that you would pass to `python myflow.py` before
50
+ the `run` command.
51
+ """
14
52
  def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
15
53
  ...
16
54
  def __enter__(self) -> metaflow.runner.metaflow_runner.Runner:
@@ -114,9 +152,48 @@ def format_flowfile(cell):
114
152
  DEFAULT_DIR: str
115
153
 
116
154
  class NBRunnerInitializationError(Exception, metaclass=type):
155
+ """
156
+ Custom exception for errors during NBRunner initialization.
157
+ """
117
158
  ...
118
159
 
119
160
  class NBRunner(object, metaclass=type):
161
+ """
162
+ A wrapper over `Runner` for executing flows defined in a Jupyter
163
+ notebook cell.
164
+
165
+ Instantiate this class on the last line of a notebook cell where
166
+ a `flow` is defined. In contrast to `Runner`, this class is not
167
+ meant to be used in a context manager. Instead, use a blocking helper
168
+ function like `nbrun` (which calls `cleanup()` internally) or call
169
+ `cleanup()` explictly when using non-blocking APIs.
170
+
171
+ ```python
172
+ run = NBRunner(FlowName).nbrun()
173
+ ```
174
+
175
+ Parameters
176
+ ----------
177
+ flow : FlowSpec
178
+ Flow defined in the same cell
179
+ show_output : bool, default True
180
+ Show the 'stdout' and 'stderr' to the console by default,
181
+ Only applicable for synchronous 'run' and 'resume' functions.
182
+ profile : Optional[str], default None
183
+ Metaflow profile to use to run this run. If not specified, the default
184
+ profile is used (or the one already set using `METAFLOW_PROFILE`)
185
+ env : Optional[Dict], default None
186
+ Additional environment variables to set for the Run. This overrides the
187
+ environment set for this process.
188
+ base_dir : Optional[str], default None
189
+ The directory to run the subprocess in; if not specified, a temporary
190
+ directory is used.
191
+ file_read_timeout : int, default 3600
192
+ The timeout until which we try to read the runner attribute file.
193
+ **kwargs : Any
194
+ Additional arguments that you would pass to `python myflow.py` before
195
+ the `run` command.
196
+ """
120
197
  def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str = "/tmp", file_read_timeout: int = 3600, **kwargs):
121
198
  ...
122
199
  def nbrun(self, **kwargs):
@@ -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.570168 #
3
+ # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-04T10:13:10.661579 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -14,9 +14,16 @@ def kill_process_and_descendants(pid, termination_timeout):
14
14
  ...
15
15
 
16
16
  class LogReadTimeoutError(Exception, metaclass=type):
17
+ """
18
+ Exception raised when reading logs times out.
19
+ """
17
20
  ...
18
21
 
19
22
  class SubprocessManager(object, metaclass=type):
23
+ """
24
+ A manager for subprocesses. The subprocess manager manages one or more
25
+ CommandManager objects, each of which manages an individual subprocess.
26
+ """
20
27
  def __init__(self):
21
28
  ...
22
29
  def __aenter__(self) -> SubprocessManager:
@@ -93,6 +100,9 @@ class SubprocessManager(object, metaclass=type):
93
100
  ...
94
101
 
95
102
  class CommandManager(object, metaclass=type):
103
+ """
104
+ A manager for an individual subprocess.
105
+ """
96
106
  def __init__(self, command: typing.List[str], env: typing.Optional[typing.Dict[str, str]] = None, cwd: typing.Optional[str] = None):
97
107
  """
98
108
  Create a new CommandManager object.
@@ -131,6 +141,8 @@ class CommandManager(object, metaclass=type):
131
141
  be one of `stdout` or `stderr`.
132
142
  """
133
143
  ...
144
+ def sync_wait(self):
145
+ ...
134
146
  def run(self, show_output: bool = False):
135
147
  """
136
148
  Run the subprocess synchronously. This can only be called once.
@@ -203,13 +215,13 @@ class CommandManager(object, metaclass=type):
203
215
  Clean up log files for a running subprocesses.
204
216
  """
205
217
  ...
206
- def kill(self, termination_timeout: float = 5):
218
+ def kill(self, termination_timeout: float = 2):
207
219
  """
208
220
  Kill the subprocess and its descendants.
209
221
 
210
222
  Parameters
211
223
  ----------
212
- termination_timeout : float, default 5
224
+ termination_timeout : float, default 2
213
225
  The time to wait after sending a SIGTERM to the process and its descendants
214
226
  before sending a SIGKILL.
215
227
  """
@@ -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.570482 #
3
+ # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-04T10:13:10.662005 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -22,6 +22,36 @@ def format_flowfile(cell):
22
22
  def clear_and_set_os_environ(env: typing.Dict):
23
23
  ...
24
24
 
25
+ def check_process_status(command_obj: "CommandManager"):
26
+ ...
27
+
25
28
  def read_from_file_when_ready(file_path: str, command_obj: "CommandManager", timeout: float = 5):
26
29
  ...
27
30
 
31
+ def handle_timeout(tfp_runner_attribute, command_obj: "CommandManager", file_read_timeout: int):
32
+ """
33
+ Handle the timeout for a running subprocess command that reads a file
34
+ and raises an error with appropriate logs if a TimeoutError occurs.
35
+
36
+ Parameters
37
+ ----------
38
+ tfp_runner_attribute : NamedTemporaryFile
39
+ Temporary file that stores runner attribute data.
40
+ command_obj : CommandManager
41
+ Command manager object that encapsulates the running command details.
42
+ file_read_timeout : int
43
+ Timeout for reading the file.
44
+
45
+ Returns
46
+ -------
47
+ str
48
+ Content read from the temporary file.
49
+
50
+ Raises
51
+ ------
52
+ RuntimeError
53
+ If a TimeoutError occurs, it raises a RuntimeError with the command's
54
+ stdout and stderr logs.
55
+ """
56
+ ...
57
+
@@ -1,16 +1,16 @@
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.560689 #
3
+ # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-04T10:13:10.651845 #
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.monitor
12
11
  import typing
13
12
  import metaflow.event_logger
13
+ import metaflow.monitor
14
14
 
15
15
  class SystemMonitor(object, metaclass=type):
16
16
  def __init__(self):
@@ -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.585489 #
3
+ # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-04T10:13:10.677360 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -1,15 +1,15 @@
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.585114 #
3
+ # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-04T10:13:10.677002 #
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.monitor
12
11
  import typing
12
+ import metaflow.monitor
13
13
 
14
14
  class SystemMonitor(object, metaclass=type):
15
15
  def __init__(self):
@@ -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.537394 #
3
+ # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-04T10:13:10.629249 #
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.22.1+obcheckpoint(0.0.11);ob(v1) #
4
- # Generated on 2024-09-20T21:42:44.544316 #
3
+ # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-04T10:13:10.636265 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ob-metaflow-stubs
3
- Version: 6.0.3.103rc3
3
+ Version: 6.0.3.105
4
4
  Summary: Metaflow Stubs: Stubs for the metaflow package
5
5
  Author: Netflix, Outerbounds & the Metaflow Community
6
6
  Author-email: help@outerbounds.co