-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdask_memusage_gpus_plugin.py
52 lines (45 loc) · 1.93 KB
/
dask_memusage_gpus_plugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python3
""" Scheduler Plugin Base Module. """
import click
from distributed.scheduler import Scheduler
from dask_memusage_gpus import definitions as defs
from dask_memusage_gpus import plugin, utils
@click.command()
@click.option("--memusage-gpus-path", default=defs.DEFAULT_DATA_FILE)
@click.option("--memusage-gpus-record-type", default=defs.CSV)
@click.option("--memusage-gpus-interval", default=1)
@click.option("--memusage-gpus-max", is_flag=True)
@click.option("--memusage-gpus-run-on-client", is_flag=True)
def dask_setup(scheduler: Scheduler,
memusage_gpus_path: str,
memusage_gpus_record_type: str,
memusage_gpus_interval: int,
memusage_gpus_max: bool,
memusage_gpus_run_on_client: bool):
"""
Setup Dask Scheduler Plugin.
Parameters
----------
scheduler : Scheduler
Dask Scheduler object.
memusage_gpus_path : string
Path of the record file.
memusage_gpus_record_type : string
Type of the record file. It can be CSV, PARQUET, JSON, XML or EXCEL
(default=CSV).
memusage_gpus_interval : int
Interval of the time to fetch the GPU used memory by the plugin
daemon in seconds (default=1).
memusage_gpus_max : bool
Run plugin collection maximum memory usage.
memusage_gpus_run_on_client : bool
Run plugin only when a client connects.
"""
utils.validate_file_type(memusage_gpus_record_type.lower())
memory_plugin = plugin.MemoryUsageGPUsPlugin(scheduler,
memusage_gpus_path,
memusage_gpus_record_type,
memusage_gpus_interval,
memusage_gpus_max,
memusage_gpus_run_on_client)
scheduler.add_plugin(memory_plugin)