Skip to main content

nwpc-hpc-model

Build Status codecov

A key-value model for HPC resources in NWPC. Including models for:

  • LoadLeveler's llq -l query
  • Slurm's sinfo and squeue -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.

Metadata

Release files for nwpc-hpc-model 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nwpc-hpc-model 0.3.2
File Size Uploaded Provenance Actions
nwpc-hpc-model-0.3.2.tar.gz 17.6 kB Without provenance Details for nwpc-hpc-model-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nwpc-hpc-model 0.3.2
File Interpreter ABI Platform Actions
nwpc_hpc_model-0.3.2-py3-none-any.whl Python 3 none any Details for nwpc_hpc_model-0.3.2-py3-none-any.whl

Total release size: 57.6 kB

Release files / nwpc-hpc-model-0.3.2.tar.gz

Download URL nwpc-hpc-model-0.3.2.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0845228bc4a0e392d8cacb7cb0c5fa951f2e38eeb07c1998a02f088bf2fbda75
BLAKE2b-256 checksum
How to use checksums
7a4f37f98523af2a3ce40c778af52a0215d7cd502288d0cf4708e86347169da1
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / nwpc_hpc_model-0.3.2-py3-none-any.whl

Download URL nwpc_hpc_model-0.3.2-py3-none-any.whl
Size 40.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03e8dfc5bbf72f2925bd923d96581abeeff90d24a7150ac2be102c31d5a67fcf
BLAKE2b-256 checksum
How to use checksums
ea8d1ac03736a77610da7393791c43a75e0032b22d4b44327481c5b924dbba05
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for nwpc-hpc-model 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page