A collection of models for HPC used in NWPC.
Project description
nwpc-hpc-model
A key-value model for HPC resources in NWPC. Including models for:
- LoadLeveler's
llq -l
query - Slurm's
sinfo
andsqueue -o %all
query - Disk usage and disk space query
Installation
Download source code from Github releases or get the latest code from Github repo.
Run pip install .
to install.
Getting started
The following example uses nwpc-hpc-model
to extract job id and job owner from a llq -l
query.
A config YAML file is used to create query categories.
category_list:
-
id: "llq.id"
display_name: "Id"
label: "Job Step Id"
record_parser_class: "DetailLabelParser"
record_parser_arguments:
- "Job Step Id"
value_saver_class: "StringSaver"
value_saver_arguments: []
-
id: "llq.owner"
display_name: "Owner"
label: "Owner"
record_parser_class: "DetailLabelParser"
record_parser_arguments:
- "Owner"
value_saver_class: "StringSaver"
value_saver_arguments: []
First create QueryCategoryList
according to the config json file.
from nwpc_hpc_model.workload.loadleveler import QueryCategoryList, \
QueryCategory, record_parser, value_saver
import yaml
with open('config_file_path', 'r') as f:
config = yaml.load(f)
category_list = QueryCategoryList()
for an_item in config['category_list']:
category = QueryCategory(
category_id=an_item['id'],
display_name=an_item['display_name'],
label=an_item['display_name'],
record_parser_class=getattr(record_parser, an_item['record_parser_class']),
record_parser_arguments=tuple(an_item['record_parser_arguments']),
value_saver_class=getattr(value_saver, an_item['value_saver_class']),
value_saver_arguments=tuple(an_item['value_saver_arguments'])
)
category_list.append(category)
Get llq -l
command output.
import subprocess
command = "/usr/bin/llq -l"
pipe = subprocess.Popen([command], stdout=subprocess.PIPE, shell=True)
output = pipe.communicate()[0]
output_string = output.decode()
output_lines = output_string.split("\n")
Build QueryModel
from QueryCategoryList
from nwpc_hpc_model.workload.loadleveler import LoadLevelerQueryModel
model = LoadLevelerQueryModel.build_from_category_list(output_lines, category_list)
model
contains data of all categories in the config file.
Test
Use pytest
to run all tests.
License
Copyright © 2016-2019, Perilla Roc.
nwpc-hpc-model
is licensed under The MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nwpc-hpc-model-0.3.2.tar.gz
.
File metadata
- Download URL: nwpc-hpc-model-0.3.2.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0845228bc4a0e392d8cacb7cb0c5fa951f2e38eeb07c1998a02f088bf2fbda75 |
|
MD5 | 63a037384edced0c429ee843f2e37535 |
|
BLAKE2b-256 | 7a4f37f98523af2a3ce40c778af52a0215d7cd502288d0cf4708e86347169da1 |
File details
Details for the file nwpc_hpc_model-0.3.2-py3-none-any.whl
.
File metadata
- Download URL: nwpc_hpc_model-0.3.2-py3-none-any.whl
- Upload date:
- Size: 40.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03e8dfc5bbf72f2925bd923d96581abeeff90d24a7150ac2be102c31d5a67fcf |
|
MD5 | a065a862bde6f55817a0e19773aaee14 |
|
BLAKE2b-256 | ea8d1ac03736a77610da7393791c43a75e0032b22d4b44327481c5b924dbba05 |