You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plugins can be third-party modules (pip-installable) outside gpustat core, or a local file (e.g., gpustat_conf.py, ~/.config/gpustat/gpustat_conf.py, similar to pytest's conftest.py)
Site-packages plugins are discovered through setuptools entry points: e.g., entry_points={"gpustat": ["gpustat-slurm = gpustat_slurm"]}
A side note: Recommend users to have "Framework :: gpustat" in the PyPI classifiers
Plugins has priority.
Determines the order in which plugins (including core) will be executed in sequence.
Core plugins will be 0
Hooks and Plugin APIs
Two major categories are: data-related hooks and format-related hooks. Names are tentative.
Metadata:
name: The name of the plugin.
priority: The priority (execution order) of the plugin.
Data:
add_options: Configure command-line ArgParser.
configure: Called only once at the beginning of the program (no matter interactive or not).
before_query: Called every time new_query() is used, after nvmlInit. Once in one-shot mode; Multiple times on interactive mode.
query_device: Fill in the entry by querying each GPU device.
get_process_info: Fill in the process entry by querying by PID. Heavy jobs are not recommended (use on_new_query instead).
after_query: Called every time after all query is done (used for cleanup).
Formatting:
repr_process: Tweak computing process representation to display
repr_gpu: Tweak GPUStat.__repr__ (how it will be displayed)
print_header: Prints additional information before GPU lines.
print_footer: Prints additional information after GPU lines.
Etc.
Any comments or suggestions will be appreciated.
The text was updated successfully, but these errors were encountered:
A new major feature: it'd be great to allow more programmatic and flexible customization through plugins.
Example applications
(The following are subject to change and be updated)
Design
Similar to pytest's plugin architecture, which is a great example of modular plugin architecture design.
gpustat_conf.py
,~/.config/gpustat/gpustat_conf.py
, similar to pytest's conftest.py)entry_points={"gpustat": ["gpustat-slurm = gpustat_slurm"]}
Hooks and Plugin APIs
Two major categories are: data-related hooks and format-related hooks. Names are tentative.
Metadata:
name
: The name of the plugin.priority
: The priority (execution order) of the plugin.Data:
add_options
: Configure command-line ArgParser.configure
: Called only once at the beginning of the program (no matter interactive or not).before_query
: Called every time new_query() is used, after nvmlInit. Once in one-shot mode; Multiple times on interactive mode.query_device
: Fill in the entry by querying each GPU device.get_process_info
: Fill in the process entry by querying by PID. Heavy jobs are not recommended (use on_new_query instead).after_query
: Called every time after all query is done (used for cleanup).Formatting:
repr_process
: Tweak computing process representation to displayrepr_gpu
: TweakGPUStat.__repr__
(how it will be displayed)print_header
: Prints additional information before GPU lines.print_footer
: Prints additional information after GPU lines.Etc.
Any comments or suggestions will be appreciated.
The text was updated successfully, but these errors were encountered: