FlowerPower 0.9.13.1__py3-none-any.whl → 1.0.0b2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. flowerpower/__init__.py +17 -2
  2. flowerpower/cfg/__init__.py +201 -149
  3. flowerpower/cfg/base.py +122 -24
  4. flowerpower/cfg/pipeline/__init__.py +254 -0
  5. flowerpower/cfg/pipeline/adapter.py +66 -0
  6. flowerpower/cfg/pipeline/run.py +40 -11
  7. flowerpower/cfg/pipeline/schedule.py +69 -79
  8. flowerpower/cfg/project/__init__.py +149 -0
  9. flowerpower/cfg/project/adapter.py +57 -0
  10. flowerpower/cfg/project/job_queue.py +165 -0
  11. flowerpower/cli/__init__.py +92 -37
  12. flowerpower/cli/job_queue.py +878 -0
  13. flowerpower/cli/mqtt.py +32 -1
  14. flowerpower/cli/pipeline.py +559 -406
  15. flowerpower/cli/utils.py +29 -18
  16. flowerpower/flowerpower.py +12 -8
  17. flowerpower/fs/__init__.py +20 -2
  18. flowerpower/fs/base.py +350 -26
  19. flowerpower/fs/ext.py +797 -216
  20. flowerpower/fs/storage_options.py +1097 -55
  21. flowerpower/io/base.py +13 -18
  22. flowerpower/io/loader/__init__.py +28 -0
  23. flowerpower/io/loader/deltatable.py +7 -10
  24. flowerpower/io/metadata.py +1 -0
  25. flowerpower/io/saver/__init__.py +28 -0
  26. flowerpower/io/saver/deltatable.py +4 -3
  27. flowerpower/job_queue/__init__.py +252 -0
  28. flowerpower/job_queue/apscheduler/__init__.py +11 -0
  29. flowerpower/job_queue/apscheduler/_setup/datastore.py +110 -0
  30. flowerpower/job_queue/apscheduler/_setup/eventbroker.py +93 -0
  31. flowerpower/job_queue/apscheduler/manager.py +1063 -0
  32. flowerpower/job_queue/apscheduler/setup.py +524 -0
  33. flowerpower/job_queue/apscheduler/trigger.py +169 -0
  34. flowerpower/job_queue/apscheduler/utils.py +309 -0
  35. flowerpower/job_queue/base.py +382 -0
  36. flowerpower/job_queue/rq/__init__.py +10 -0
  37. flowerpower/job_queue/rq/_trigger.py +37 -0
  38. flowerpower/job_queue/rq/concurrent_workers/gevent_worker.py +226 -0
  39. flowerpower/job_queue/rq/concurrent_workers/thread_worker.py +231 -0
  40. flowerpower/job_queue/rq/manager.py +1449 -0
  41. flowerpower/job_queue/rq/setup.py +150 -0
  42. flowerpower/job_queue/rq/utils.py +69 -0
  43. flowerpower/pipeline/__init__.py +5 -0
  44. flowerpower/pipeline/base.py +118 -0
  45. flowerpower/pipeline/io.py +407 -0
  46. flowerpower/pipeline/job_queue.py +505 -0
  47. flowerpower/pipeline/manager.py +1586 -0
  48. flowerpower/pipeline/registry.py +560 -0
  49. flowerpower/pipeline/runner.py +560 -0
  50. flowerpower/pipeline/visualizer.py +142 -0
  51. flowerpower/plugins/mqtt/__init__.py +12 -0
  52. flowerpower/plugins/mqtt/cfg.py +16 -0
  53. flowerpower/plugins/mqtt/manager.py +789 -0
  54. flowerpower/settings.py +110 -0
  55. flowerpower/utils/logging.py +21 -0
  56. flowerpower/utils/misc.py +57 -9
  57. flowerpower/utils/sql.py +122 -24
  58. flowerpower/utils/templates.py +2 -142
  59. flowerpower-1.0.0b2.dist-info/METADATA +324 -0
  60. flowerpower-1.0.0b2.dist-info/RECORD +94 -0
  61. flowerpower/_web/__init__.py +0 -61
  62. flowerpower/_web/routes/config.py +0 -103
  63. flowerpower/_web/routes/pipelines.py +0 -173
  64. flowerpower/_web/routes/scheduler.py +0 -136
  65. flowerpower/cfg/pipeline/tracker.py +0 -14
  66. flowerpower/cfg/project/open_telemetry.py +0 -8
  67. flowerpower/cfg/project/tracker.py +0 -11
  68. flowerpower/cfg/project/worker.py +0 -19
  69. flowerpower/cli/scheduler.py +0 -309
  70. flowerpower/cli/web.py +0 -44
  71. flowerpower/event_handler.py +0 -23
  72. flowerpower/mqtt.py +0 -609
  73. flowerpower/pipeline.py +0 -2499
  74. flowerpower/scheduler.py +0 -680
  75. flowerpower/tui.py +0 -79
  76. flowerpower/utils/datastore.py +0 -186
  77. flowerpower/utils/eventbroker.py +0 -127
  78. flowerpower/utils/executor.py +0 -58
  79. flowerpower/utils/trigger.py +0 -140
  80. flowerpower-0.9.13.1.dist-info/METADATA +0 -586
  81. flowerpower-0.9.13.1.dist-info/RECORD +0 -76
  82. /flowerpower/{cfg/pipeline/params.py → cli/worker.py} +0 -0
  83. {flowerpower-0.9.13.1.dist-info → flowerpower-1.0.0b2.dist-info}/WHEEL +0 -0
  84. {flowerpower-0.9.13.1.dist-info → flowerpower-1.0.0b2.dist-info}/entry_points.txt +0 -0
  85. {flowerpower-0.9.13.1.dist-info → flowerpower-1.0.0b2.dist-info}/top_level.txt +0 -0
flowerpower/scheduler.py DELETED
@@ -1,680 +0,0 @@
1
- import importlib.util
2
- import sys
3
-
4
- if importlib.util.find_spec("apscheduler"):
5
- from apscheduler import Scheduler, current_scheduler
6
- from apscheduler.executors.async_ import AsyncJobExecutor
7
- from apscheduler.executors.subprocess import ProcessPoolJobExecutor
8
- from apscheduler.executors.thread import ThreadPoolJobExecutor
9
-
10
- from .utils.monkey import patch_pickle
11
-
12
- patch_pickle()
13
-
14
- else:
15
- raise ImportError(
16
- "APScheduler is not installed. Please install it using `pip install"
17
- "'apscheduler>4.0.0a1'`, 'conda install apscheduler4' or `pip install flowerpower[scheduler]`"
18
- )
19
-
20
- import posixpath
21
- import uuid
22
- from pathlib import Path
23
- from typing import Any
24
-
25
- from fsspec.spec import AbstractFileSystem
26
- from loguru import logger
27
-
28
- from .cfg import Config
29
- from .fs import get_filesystem
30
- from .utils.datastore import setup_data_store
31
- from .utils.eventbroker import setup_event_broker
32
- from .utils.scheduler import display_jobs, display_schedules, display_tasks
33
-
34
-
35
- class SchedulerManager(Scheduler):
36
- def __init__(
37
- self,
38
- name: str | None = None,
39
- base_dir: str | None = None,
40
- storage_options: dict = {},
41
- fs: AbstractFileSystem | None = None,
42
- **kwargs,
43
- ):
44
- """
45
- Initializes the Scheduler object.
46
-
47
- Args:
48
- name (str | None, optional): The name of the scheduler. Defaults to None.
49
- base_dir (str | None, optional): The flowerpower base path. Defaults to None.
50
- **kwargs: Additional keyword arguments.
51
-
52
- """
53
- self.name = name or ""
54
- self._base_dir = base_dir or str(Path.cwd())
55
- self._storage_options = storage_options
56
- if fs is None:
57
- fs = get_filesystem(self._base_dir, **self._storage_options)
58
- self._fs = fs
59
-
60
- self._conf_path = "conf"
61
- self._pipelines_path = "pipelines" # or pipelines_path
62
-
63
- self._sync_fs()
64
- self.load_config()
65
-
66
- self._setup_data_store()
67
- self._setup_event_broker()
68
- self._setup_job_executors()
69
-
70
- super().__init__(
71
- data_store=self._data_store,
72
- event_broker=self._event_broker,
73
- job_executors=self._job_executors,
74
- identity=self.name,
75
- logger=logger,
76
- cleanup_interval=self.cfg.project.worker.cleanup_interval,
77
- max_concurrent_jobs=self.cfg.project.worker.max_concurrent_jobs,
78
- **kwargs,
79
- )
80
-
81
- sys.path.append(self._pipelines_path)
82
-
83
- def _sync_fs(self):
84
- """
85
- Sync the filesystem.
86
-
87
- Returns:
88
- None
89
- """
90
- if self._fs.is_cache_fs:
91
- self._fs.sync()
92
-
93
- modules_path = posixpath.join(self._fs.path, self._pipelines_path)
94
- if modules_path not in sys.path:
95
- sys.path.append(modules_path)
96
-
97
- def load_config(self):
98
- """
99
- Load the configuration file.
100
-
101
- This method loads the configuration file specified by the `_conf_dir` attribute and
102
- assigns it to the `cfg` attribute.
103
-
104
- """
105
- self.cfg = Config.load(base_dir=self._base_dir, fs=self._fs)
106
-
107
- def _setup_data_store(self):
108
- """
109
- Sets up the data store based on the configuration.
110
-
111
- If the configuration specifies a data store type, it retrieves the data store and SQLA engine
112
- using the `get_data_store` function. The data store type is obtained from the `type` key in the
113
- `data_store` section of the configuration. The engine or URI is obtained from the `uri` key in
114
- the `data_store` section of the configuration.
115
-
116
- Returns:
117
- None
118
- """
119
- self._data_store, self._sqla_engine = setup_data_store(
120
- type=self.cfg.project.worker.data_store.get("type", "memory"),
121
- engine_or_uri=self.cfg.project.worker.data_store.get("uri", None),
122
- schema=self.cfg.project.worker.data_store.get("schema", "flowerpower"),
123
- username=self.cfg.project.worker.data_store.get("username", None),
124
- password=self.cfg.project.worker.data_store.get("password", None),
125
- ssl=self.cfg.project.worker.data_store.get("ssl", False),
126
- **self.cfg.project.worker.data_store.get("kwargs", {}),
127
- )
128
-
129
- def _setup_event_broker(self):
130
- """
131
- Sets up the event broker based on the configuration settings.
132
-
133
- If the 'event_broker' key is present in the configuration, it checks for the 'type' key.
134
- If the 'type' key is present, it initializes the event broker using the specified type and other optional
135
- parameters.
136
- The optional parameters include 'uri', 'sqla_engine', 'host', 'port', 'username', and 'password'.
137
-
138
- Parameters:
139
- None
140
-
141
- Returns:
142
- None
143
- """
144
- self._event_broker = setup_event_broker(
145
- type=self.cfg.project.worker.event_broker.get("type", "memory"),
146
- uri=self.cfg.project.worker.event_broker.get("uri", None),
147
- sqla_engine=self._sqla_engine,
148
- host=self.cfg.project.worker.event_broker.get("host", None),
149
- port=self.cfg.project.worker.event_broker.get("port", 0),
150
- username=self.cfg.project.worker.event_broker.get("username", None),
151
- password=self.cfg.project.worker.event_broker.get("password", None),
152
- )
153
-
154
- def _setup_job_executors(self):
155
- self._job_executors = {
156
- "async": AsyncJobExecutor(),
157
- "threadpool": ThreadPoolJobExecutor(),
158
- "processpool": ProcessPoolJobExecutor(),
159
- }
160
-
161
- def start_worker(
162
- self,
163
- background: bool = False,
164
- ):
165
- """
166
- Starts the worker.
167
-
168
- Parameters:
169
- background (bool): If True, starts the worker in the background. If False, runs the worker until stopped.
170
- """
171
- if background:
172
- self.start_in_background()
173
- else:
174
- self.run_until_stopped()
175
-
176
- def stop_worker(self) -> None:
177
- """
178
- Stops the worker and closes the exit stack.
179
-
180
- Returns:
181
- None
182
- """
183
- self.stop()
184
- self._exit_stack.close()
185
-
186
- def remove_all_schedules(self):
187
- """
188
- Removes all schedules from the scheduler.
189
-
190
- This method iterates over all schedules in the scheduler and removes them one by one.
191
-
192
- Parameters:
193
- None
194
-
195
- Returns:
196
- None
197
- """
198
- for sched in self.get_schedules():
199
- self.remove_schedule(sched.id)
200
-
201
- def get_tasks(self, as_dict: bool = False):
202
- """
203
- Get all tasks from the scheduler.
204
-
205
- Args:
206
- as_dict (bool, optional): Whether to return the tasks as a list of dictionaries. Defaults to False.
207
-
208
- Returns:
209
- list: A list of tasks.
210
- """
211
- tasks = super().get_tasks()
212
- if as_dict:
213
- return [task.to_dict() for task in tasks]
214
- return super().get_tasks()
215
-
216
- def get_schedules(self, as_dict: bool = False):
217
- """
218
- Get all schedules from the scheduler.
219
-
220
- Args:
221
- as_dict (bool, optional): Whether to return the schedules as a list of dictionaries. Defaults to False.
222
-
223
- Returns:
224
- list: A list of schedules.
225
- """
226
- schedules = super().get_schedules()
227
- if as_dict:
228
- return [schedule.to_dict() for schedule in schedules]
229
- return schedules
230
-
231
- def get_schedule(self, id: str, as_dict: bool = False):
232
- """
233
- Get a schedule by ID.
234
-
235
- Args:
236
- id (str): The ID of the schedule.
237
- as_dict (bool, optional): Whether to return the schedule as a dictionary. Defaults to False.
238
-
239
- Returns:
240
- Schedule: The schedule object.
241
- """
242
- schedule = super().get_schedule(id)
243
- if as_dict:
244
- return schedule.to_dict()
245
- return schedule
246
-
247
- def get_jobs(self, as_dict: bool = False):
248
- """
249
- Get all jobs from the scheduler.
250
-
251
- Args:
252
- as_dict (bool, optional): Whether to return the jobs as a list of dictionaries. Defaults to False.
253
-
254
- Returns:
255
- list: A list of jobs.
256
- """
257
- jobs = super().get_jobs()
258
- if as_dict:
259
- return [job.to_dict() for job in jobs]
260
- return jobs
261
-
262
- def show_schedules(self):
263
- """
264
- Shows all schedules in the scheduler.
265
-
266
- This method iterates over all schedules in the scheduler and prints their details.
267
-
268
- Parameters:
269
- None
270
- """
271
- display_schedules(self.get_schedules())
272
-
273
- def show_tasks(self):
274
- """
275
- Shows all tasks in the scheduler.
276
-
277
- This method iterates over all tasks in the scheduler and prints their details.
278
-
279
- Parameters:
280
- None
281
- """
282
- display_tasks(self.get_tasks())
283
-
284
- def show_jobs(self):
285
- """
286
- Shows all jobs in the scheduler.
287
-
288
- This method iterates over all jobs in the scheduler and prints their details.
289
-
290
- Parameters:
291
- None
292
- """
293
- display_jobs(self.get_jobs())
294
-
295
-
296
- # Wrapper functions for backward compatibility
297
- def get_schedule_manager(
298
- name: str | None = None,
299
- base_dir: str | None = None,
300
- storage_options: dict = {},
301
- fs: AbstractFileSystem | None = None,
302
- **kwargs,
303
- ) -> SchedulerManager:
304
- """
305
- Returns a SchedulerManager instance with the specified name and base path.
306
-
307
- Args:
308
- name (str | None, optional): The name of the scheduler manager. Defaults to None.
309
- base_dir (str | None, optional): The base path for the scheduler manager. Defaults to None.
310
- storage_options (dict, optional): The storage options. Defaults to {}.
311
- fs (AbstractFileSystem, optional): The filesystem. Defaults to None.
312
- **kwargs: Additional keyword arguments to be passed to the SchedulerManager constructor.
313
-
314
- Returns:
315
- SchedulerManager: The initialized SchedulerManager instance.
316
- """
317
- manager = SchedulerManager(
318
- name, base_dir, storage_options=storage_options, fs=fs, **kwargs
319
- )
320
- return manager
321
-
322
-
323
- def get_current_scheduler_manager() -> SchedulerManager | None:
324
- """
325
- Returns the current scheduler manager.
326
-
327
- Returns:
328
- The current scheduler manager if available, otherwise None.
329
- """
330
- return current_scheduler.get()
331
-
332
-
333
- def start_worker(
334
- name: str | None = None,
335
- base_dir: str | None = None,
336
- background: bool = False,
337
- storage_options: dict = {},
338
- fs: AbstractFileSystem | None = None,
339
- **kwargs,
340
- ) -> SchedulerManager:
341
- """
342
- Start the scheduler.
343
-
344
- Args:
345
- name (str | None, optional): The name of the scheduler. Defaults to None.
346
- base_dir (str | None, optional): The base path for the scheduler. Defaults to None.
347
- background (bool, optional): Whether to start the scheduler in the background. Defaults to False.
348
- storage_options (dict, optional): The storage options. Defaults to {}.
349
- fs (AbstractFileSystem, optional): The filesystem. Defaults to None.
350
- **kwargs: Additional keyword arguments.
351
-
352
- Returns:
353
- SchedulerManager: The scheduler instance.
354
- """
355
- # manager = get_schedule_manager(name, base_dir, role="worker", storage_options=storage_options, fs=fs, **kwargs)
356
- with SchedulerManager(
357
- name, base_dir, storage_options=storage_options, fs=fs, **kwargs
358
- ) as manager:
359
- manager.start_worker(background=background)
360
-
361
-
362
- def remove_all_schedules(
363
- name: str | None = None,
364
- base_dir: str | None = None,
365
- storage_options: dict = {},
366
- fs: AbstractFileSystem | None = None,
367
- **kwargs,
368
- ):
369
- """
370
- Remove all schedules.
371
-
372
- Args:
373
- name (str | None, optional): The name of the scheduler. Defaults to None.
374
- base_dir (str | None, optional): The base path. Defaults to None.
375
- storage_options (dict, optional): The storage options. Defaults to {}.
376
- fs (AbstractFileSystem, optional): The filesystem. Defaults to None.
377
- **kwargs: Additional keyword arguments.
378
- """
379
- with SchedulerManager(
380
- name,
381
- base_dir,
382
- role="scheduler",
383
- storage_options=storage_options,
384
- fs=fs,
385
- **kwargs,
386
- ) as manager:
387
- manager.remove_all_schedules()
388
-
389
-
390
- def add_schedule(
391
- name: str | None = None,
392
- base_dir: str | None = None,
393
- storage_options: dict = {},
394
- fs: AbstractFileSystem | None = None,
395
- **kwargs,
396
- ) -> str:
397
- """
398
- Add a schedule to the scheduler.
399
-
400
- Args:
401
- name (str, optional): The name of the schedule. Defaults to None.
402
- base_dir (str, optional): The base path for the schedule. Defaults to None.
403
- storage_options (dict, optional): The storage options. Defaults to {}.
404
- fs (AbstractFileSystem, optional): The filesystem. Defaults to None.
405
- **kwargs: Arbitrary keyword arguments.
406
-
407
- Returns:
408
- str: The ID of the added schedule.
409
- """
410
- with SchedulerManager(name, base_dir, role="scheduler") as manager:
411
- id_ = manager.add_schedule(storage_options=storage_options, fs=fs, **kwargs)
412
- return id_
413
-
414
-
415
- def add_job(
416
- name: str | None = None,
417
- base_dir: str | None = None,
418
- storage_options: dict = {},
419
- fs: AbstractFileSystem | None = None,
420
- **kwargs,
421
- ) -> uuid.UUID:
422
- """
423
- Add a job to the scheduler. Executes the job immediatly and returns the job id (UUID).
424
- The job result will be stored in the data store for the given `result_expiration_time` and
425
- can be fetched using the job id (UUID).
426
-
427
- Args:
428
- name (str | None): The name of the job. Defaults to None.
429
- base_dir (str | None): The base path for the job. Defaults to None.
430
- storage_options (dict, optional): The storage options. Defaults to {}.
431
- fs (AbstractFileSystem, optional): The filesystem. Defaults to None.
432
- **kwargs: Arbitrary keyword arguments.
433
-
434
- Returns:
435
- uuid.UUID: The ID of the added job.
436
- """
437
- with SchedulerManager(name, base_dir, role="scheduler") as manager:
438
- id_ = manager.add_job(storage_options=storage_options, fs=fs, **kwargs)
439
- return id_
440
-
441
-
442
- def run_job(
443
- name: str | None = None,
444
- base_dir: str | None = None,
445
- storage_options: dict = {},
446
- fs: AbstractFileSystem | None = None,
447
- **kwargs,
448
- ) -> Any:
449
- """
450
- Run a job using the SchedulerManager. Executes the job immediatly and returns the result of the job.
451
-
452
- Args:
453
- name (str, optional): The name of the job. Defaults to None.
454
- base_dir (str, optional): The base path of the job. Defaults to None.
455
- storage_options (dict, optional): The storage options. Defaults to {}.
456
- fs (AbstractFileSystem, optional): The filesystem. Defaults to None.
457
- **kwargs: Arbitrary keyword arguments.
458
-
459
- Returns:
460
- Any: The SchedulerManager instance.
461
-
462
- """
463
- with SchedulerManager(name, base_dir, role="scheduler") as manager:
464
- result = manager.run_job(storage_options=storage_options, fs=fs, **kwargs)
465
-
466
- return result
467
-
468
-
469
- def get_schedules(
470
- name: str | None = None,
471
- base_dir: str | None = None,
472
- storage_options: dict = {},
473
- fs: AbstractFileSystem | None = None,
474
- **kwargs,
475
- ):
476
- """
477
- Get all schedules from the scheduler.
478
-
479
- Args:
480
- name (str | None, optional): The name of the scheduler. Defaults to None.
481
- base_dir (str | None, optional): The base path. Defaults to None.
482
- storage_options (dict, optional): The storage options. Defaults to {}.
483
- fs (AbstractFileSystem, optional): The filesystem. Defaults to None.
484
- **kwargs: Additional keyword arguments.
485
-
486
- Returns:
487
- list: A list of schedules.
488
- """
489
- with SchedulerManager(
490
- name,
491
- base_dir,
492
- role="scheduler",
493
- storage_options=storage_options,
494
- fs=fs,
495
- **kwargs,
496
- ) as manager:
497
- schedules = manager.get_schedules()
498
- return schedules
499
-
500
-
501
- def get_tasks(
502
- name: str | None = None,
503
- base_dir: str | None = None,
504
- storage_options: dict = {},
505
- fs: AbstractFileSystem | None = None,
506
- **kwargs,
507
- ):
508
- """
509
- Get all tasks from the scheduler.
510
-
511
- Args:
512
- name (str | None, optional): The name of the scheduler. Defaults to None.
513
- base_dir (str | None, optional): The base path. Defaults to None.
514
- storage_options (dict, optional): The storage options. Defaults to {}.
515
- fs (AbstractFileSystem, optional): The filesystem. Defaults to None.
516
- **kwargs: Additional keyword arguments.
517
-
518
- Returns:
519
- list: A list of tasks.
520
- """
521
- with SchedulerManager(
522
- name,
523
- base_dir,
524
- role="scheduler",
525
- storage_options=storage_options,
526
- fs=fs,
527
- **kwargs,
528
- ) as manager:
529
- tasks = manager.get_tasks()
530
- return tasks
531
-
532
-
533
- def get_jobs(
534
- name: str | None = None,
535
- base_dir: str | None = None,
536
- storage_options: dict = {},
537
- fs: AbstractFileSystem | None = None,
538
- **kwargs,
539
- ):
540
- """
541
- Get all jobs from the scheduler.
542
-
543
- Args:
544
- name (str | None, optional): The name of the scheduler. Defaults to None.
545
- base_dir (str | None, optional): The base path. Defaults to None.
546
- storage_options (dict, optional): The storage options. Defaults to {}.
547
- fs (AbstractFileSystem, optional): The filesystem. Defaults to None.
548
- **kwargs: Additional keyword arguments.
549
-
550
- Returns:
551
- list: A list of jobs.
552
- """
553
- with SchedulerManager(
554
- name,
555
- base_dir,
556
- role="scheduler",
557
- storage_options=storage_options,
558
- fs=fs,
559
- **kwargs,
560
- ) as manager:
561
- jobs = manager.get_jobs()
562
- return jobs
563
-
564
-
565
- def get_job_result(
566
- job_id: str,
567
- name: str | None = None,
568
- base_dir: str | None = None,
569
- storage_options: dict = {},
570
- fs: AbstractFileSystem | None = None,
571
- **kwargs,
572
- ) -> Any:
573
- """
574
- Get the result of a job using the job id.
575
-
576
- Args:
577
- job_id (str): The ID of the job.
578
- name (str | None, optional): The name of the job. Defaults to None.
579
- base_dir (str | None, optional): The base path. Defaults to None.
580
- storage_options (dict, optional): The storage options. Defaults to {}.
581
- fs (AbstractFileSystem, optional): The filesystem. Defaults to None.
582
- **kwargs: Additional keyword arguments.
583
-
584
- Returns:
585
- Any: The result of the job.
586
- """
587
- with SchedulerManager(
588
- name,
589
- base_dir,
590
- role="scheduler",
591
- storage_options=storage_options,
592
- fs=fs,
593
- **kwargs,
594
- ) as manager:
595
- result = manager.get_job_result(job_id)
596
- return result
597
-
598
-
599
- def show_schedules(
600
- name: str | None = None,
601
- base_dir: str | None = None,
602
- storage_options: dict = {},
603
- fs: AbstractFileSystem | None = None,
604
- **kwargs,
605
- ):
606
- """
607
- Show all schedules in the scheduler.
608
-
609
- Args:
610
- name (str | None, optional): The name of the scheduler. Defaults to None.
611
- base_dir (str | None, optional): The base path. Defaults to None.
612
- storage_options (dict, optional): The storage options. Defaults to {}.
613
- fs (AbstractFileSystem, optional): The filesystem. Defaults
614
- **kwargs: Additional keyword arguments.
615
- """
616
- with SchedulerManager(
617
- name,
618
- base_dir,
619
- role="scheduler",
620
- storage_options=storage_options,
621
- fs=fs,
622
- **kwargs,
623
- ) as manager:
624
- manager.show_schedules()
625
-
626
-
627
- def show_tasks(
628
- name: str | None = None,
629
- base_dir: str | None = None,
630
- storage_options: dict = {},
631
- fs: AbstractFileSystem | None = None,
632
- **kwargs,
633
- ):
634
- """
635
- Show all tasks in the scheduler.
636
-
637
- Args:
638
- name (str | None, optional): The name of the scheduler. Defaults to None.
639
- base_dir (str | None, optional): The base path. Defaults to None.
640
- storage_options (dict, optional): The storage options. Defaults to {}.
641
- fs (AbstractFileSystem, optional): The filesystem. Defaults
642
- **kwargs: Additional keyword arguments.
643
- """
644
- with SchedulerManager(
645
- name,
646
- base_dir,
647
- role="scheduler",
648
- storage_options=storage_options,
649
- fs=fs,
650
- **kwargs,
651
- ) as manager:
652
- manager.show_tasks()
653
-
654
-
655
- def show_jobs(
656
- name: str | None = None,
657
- base_dir: str | None = None,
658
- storage_options: dict = {},
659
- fs: AbstractFileSystem | None = None,
660
- **kwargs,
661
- ):
662
- """
663
- Show all jobs in the scheduler.
664
-
665
- Args:
666
- name (str | None, optional): The name of the scheduler. Defaults to None.
667
- base_dir (str | None, optional): The base path. Defaults to None.
668
- storage_options (dict, optional): The storage options. Defaults to {}.
669
- fs (AbstractFileSystem, optional): The filesystem. Defaults
670
- **kwargs: Additional keyword arguments.
671
- """
672
- with SchedulerManager(
673
- name,
674
- base_dir,
675
- role="scheduler",
676
- storage_options=storage_options,
677
- fs=fs,
678
- **kwargs,
679
- ) as manager:
680
- manager.show_jobs()