qstat-cache 3.0__tar.gz
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.
- qstat_cache-3.0/.github/workflows/publish-to-pypi.yml +95 -0
- qstat_cache-3.0/.gitignore +10 -0
- qstat_cache-3.0/LICENSE +21 -0
- qstat_cache-3.0/Makefile +27 -0
- qstat_cache-3.0/PKG-INFO +190 -0
- qstat_cache-3.0/README.md +174 -0
- qstat_cache-3.0/bin/qstat +10 -0
- qstat_cache-3.0/pyproject.toml +34 -0
- qstat_cache-3.0/setup.cfg +4 -0
- qstat_cache-3.0/src/qscache/cfg/casper.cfg +30 -0
- qstat_cache-3.0/src/qscache/cfg/derecho.cfg +30 -0
- qstat_cache-3.0/src/qscache/cfg/gust.cfg +29 -0
- qstat_cache-3.0/src/qscache/cfg/site.cfg.example +64 -0
- qstat_cache-3.0/src/qscache/gen_data.py +123 -0
- qstat_cache-3.0/src/qscache/qscache.py +761 -0
- qstat_cache-3.0/src/qstat_cache.egg-info/PKG-INFO +190 -0
- qstat_cache-3.0/src/qstat_cache.egg-info/SOURCES.txt +20 -0
- qstat_cache-3.0/src/qstat_cache.egg-info/dependency_links.txt +1 -0
- qstat_cache-3.0/src/qstat_cache.egg-info/entry_points.txt +2 -0
- qstat_cache-3.0/src/qstat_cache.egg-info/top_level.txt +1 -0
- qstat_cache-3.0/util/gen_data +10 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
name: Publish package to PyPI
|
|
2
|
+
on: push
|
|
3
|
+
|
|
4
|
+
jobs:
|
|
5
|
+
build:
|
|
6
|
+
name: 📦 Build distribution
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
|
|
9
|
+
steps:
|
|
10
|
+
- uses: actions/checkout@v4
|
|
11
|
+
with:
|
|
12
|
+
persist-credentials: false
|
|
13
|
+
- name: Set up Python
|
|
14
|
+
uses: actions/setup-python@v5
|
|
15
|
+
with:
|
|
16
|
+
python-version: "3.x"
|
|
17
|
+
- name: Install pypa/build
|
|
18
|
+
run: >-
|
|
19
|
+
python3 -m
|
|
20
|
+
pip install
|
|
21
|
+
build
|
|
22
|
+
--user
|
|
23
|
+
- name: Build a binary wheel and a source tarball
|
|
24
|
+
run: python3 -m build
|
|
25
|
+
- name: Store the distribution packages
|
|
26
|
+
uses: actions/upload-artifact@v4
|
|
27
|
+
with:
|
|
28
|
+
name: python-package-distributions
|
|
29
|
+
path: dist/
|
|
30
|
+
|
|
31
|
+
publish-to-pypi:
|
|
32
|
+
name: 🐍 Publish package to PyPI
|
|
33
|
+
# Trigger this and signing step only when a tag is pushed
|
|
34
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
35
|
+
needs:
|
|
36
|
+
- build
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
environment:
|
|
39
|
+
name: pypi
|
|
40
|
+
url: https://pypi.org/p/qstat-cache
|
|
41
|
+
permissions:
|
|
42
|
+
# IMPORTANT: mandatory for trusted publishing
|
|
43
|
+
id-token: write
|
|
44
|
+
|
|
45
|
+
steps:
|
|
46
|
+
- name: Download all the dists
|
|
47
|
+
uses: actions/download-artifact@v4
|
|
48
|
+
with:
|
|
49
|
+
name: python-package-distributions
|
|
50
|
+
path: dist/
|
|
51
|
+
- name: Publish distribution to PyPI
|
|
52
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
53
|
+
|
|
54
|
+
github-release:
|
|
55
|
+
name: >-
|
|
56
|
+
📝 Sign the distribution with Sigstore
|
|
57
|
+
and upload them to GitHub Release
|
|
58
|
+
needs:
|
|
59
|
+
- publish-to-pypi
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
|
|
62
|
+
permissions:
|
|
63
|
+
contents: write # IMPORTANT: mandatory for making GitHub Releases
|
|
64
|
+
id-token: write # IMPORTANT: mandatory for sigstore
|
|
65
|
+
|
|
66
|
+
steps:
|
|
67
|
+
- name: Download all the dists
|
|
68
|
+
uses: actions/download-artifact@v4
|
|
69
|
+
with:
|
|
70
|
+
name: python-package-distributions
|
|
71
|
+
path: dist/
|
|
72
|
+
- name: Sign the dists with Sigstore
|
|
73
|
+
uses: sigstore/gh-action-sigstore-python@v3.0.0
|
|
74
|
+
with:
|
|
75
|
+
inputs: >-
|
|
76
|
+
./dist/*.tar.gz
|
|
77
|
+
./dist/*.whl
|
|
78
|
+
- name: Create GitHub Release
|
|
79
|
+
env:
|
|
80
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
81
|
+
run: >-
|
|
82
|
+
gh release create
|
|
83
|
+
"$GITHUB_REF_NAME"
|
|
84
|
+
--repo "$GITHUB_REPOSITORY"
|
|
85
|
+
--notes ""
|
|
86
|
+
- name: Upload artifact signatures to GitHub Release
|
|
87
|
+
env:
|
|
88
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
89
|
+
# Upload to GitHub Release using the `gh` CLI.
|
|
90
|
+
# `dist/` contains the built packages, and the
|
|
91
|
+
# sigstore-produced signatures and certificates.
|
|
92
|
+
run: >-
|
|
93
|
+
gh release upload
|
|
94
|
+
"$GITHUB_REF_NAME" dist/**
|
|
95
|
+
--repo "$GITHUB_REPOSITORY"
|
qstat_cache-3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 National Center for Atmospheric Research
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
qstat_cache-3.0/Makefile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
PREFIX ?= /usr/local
|
|
2
|
+
VERSION := 3.0
|
|
3
|
+
|
|
4
|
+
make install:
|
|
5
|
+
mkdir -p $(PREFIX)/bin $(PREFIX)/util $(PREFIX)/lib
|
|
6
|
+
sed 's|/src|/lib|' bin/qstat > $(PREFIX)/bin/qstat
|
|
7
|
+
sed 's|/src|/lib|' util/gen_data > $(PREFIX)/util/gen_data
|
|
8
|
+
cp -r src/qscache $(PREFIX)/lib/qscache
|
|
9
|
+
ln -s lib/qscache/cfg $(PREFIX)/cfg
|
|
10
|
+
chmod +x $(PREFIX)/bin/qstat $(PREFIX)/util/gen_data
|
|
11
|
+
|
|
12
|
+
build:
|
|
13
|
+
python3 -m build
|
|
14
|
+
|
|
15
|
+
# These commands can only be run successfully by package maintainers
|
|
16
|
+
manual-upload:
|
|
17
|
+
python3 -m twine upload dist/*
|
|
18
|
+
|
|
19
|
+
test-upload:
|
|
20
|
+
python3 -m twine upload --repository testpypi dist/*
|
|
21
|
+
|
|
22
|
+
#release: man
|
|
23
|
+
# git tag v$(VERSION)
|
|
24
|
+
# git push origin v$(VERSION)
|
|
25
|
+
|
|
26
|
+
clean:
|
|
27
|
+
rm -rf dist build
|
qstat_cache-3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qstat-cache
|
|
3
|
+
Version: 3.0
|
|
4
|
+
Summary: A caching qstat that reduces load on the PBS server
|
|
5
|
+
Author-email: Brian Vanderwende <vanderwb@ucar.edu>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: homepage, https://github.com/NCAR/qstat-cache
|
|
8
|
+
Project-URL: issues, https://github.com/NCAR/qstat-cache/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Topic :: System :: Distributed Computing
|
|
12
|
+
Requires-Python: >=3.6
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
|
|
17
|
+
# qstat-cache
|
|
18
|
+
A cached version of the PBS Pro qstat command that reduces load on the
|
|
19
|
+
scheduler's database
|
|
20
|
+
|
|
21
|
+
## Details
|
|
22
|
+
Most users run the qstat command at reasonable intervals and things work well.
|
|
23
|
+
However, with the advent of workflow managers more users are running qstat at
|
|
24
|
+
frequencies much too high for current versions of PBS Pro to support well. This
|
|
25
|
+
utility creates a simple text-based cache of common qstat output and provides a
|
|
26
|
+
script to serve that data to users. If an option is not cached (e.g., -Q
|
|
27
|
+
output), the query is sent to PBS's version of qstat for processing. Usage:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
usage: qstat [-h] [-1] [-a] [-D DELIMITER] [-f] [-F {json,dsv}]
|
|
31
|
+
[--format FORMAT] [-H] [-J] [--noheader] [-n] [-s]
|
|
32
|
+
[--status STATUS] [-t] [-T] [-u USER] [-w] [-x]
|
|
33
|
+
[filters ...]
|
|
34
|
+
|
|
35
|
+
This command provides a lightweight alternative to qstat. Data are queried and
|
|
36
|
+
updated every minute from the PBS job scheduler. Options not listed here will
|
|
37
|
+
be forwarded to the scheduler. Please use those options sparingly. Job IDs, if
|
|
38
|
+
provided, should be numeric only and space delimited. If a destination is
|
|
39
|
+
provided, it should be a valid execution queue on the chosen server. This
|
|
40
|
+
cached version of qstat does not allow mixed queries from multiple servers -
|
|
41
|
+
only one server may be specified per request.
|
|
42
|
+
|
|
43
|
+
positional arguments:
|
|
44
|
+
filters job IDs or queues
|
|
45
|
+
|
|
46
|
+
options:
|
|
47
|
+
-h, --help show this help message and exit
|
|
48
|
+
-1 display node or comment information on job line
|
|
49
|
+
-a display all jobs (default unless -f specified)
|
|
50
|
+
-D DELIMITER specify a delimiter if using -Fdsv (default = '|')
|
|
51
|
+
-f display full output for a job
|
|
52
|
+
-F {json,dsv} full output (-f) in custom format
|
|
53
|
+
--format FORMAT column output in custom format (=help for more)
|
|
54
|
+
-H all moved or finished jobs / specific job of any state
|
|
55
|
+
-J only show information for jobs (or subjobs with -t)
|
|
56
|
+
--noheader disable labels (no header)
|
|
57
|
+
-n display a list of nodes at the end of the line
|
|
58
|
+
-s display administrator comment on the next line
|
|
59
|
+
--status STATUS filter jobs by specific single-character status code
|
|
60
|
+
-t show information for both jobs and array subjobs
|
|
61
|
+
-T displays estimated start time for queued jobs
|
|
62
|
+
-u USER filter jobs by the submitting user
|
|
63
|
+
-w use wide format output (120 columns)
|
|
64
|
+
-x all job records in recent history
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
|
|
69
|
+
There are two methods for installing **qstat-cache** - using the included
|
|
70
|
+
`Makefile` or with `pip`.
|
|
71
|
+
|
|
72
|
+
### Makefile method
|
|
73
|
+
|
|
74
|
+
1. Clone this repository on your system.
|
|
75
|
+
2. Install at your desired path using `make install
|
|
76
|
+
PREFIX=/path/to/qstat-cache`.
|
|
77
|
+
|
|
78
|
+
### pip method
|
|
79
|
+
|
|
80
|
+
1. If desired, first create a virtual environment with `venv` or `conda/mamba`
|
|
81
|
+
and activate it.
|
|
82
|
+
2. Now run `python3 -m pip install qstat-cache`.
|
|
83
|
+
|
|
84
|
+
### Site setup
|
|
85
|
+
|
|
86
|
+
In either case, the following steps are required to finish configuration.
|
|
87
|
+
|
|
88
|
+
3. In `$PREFIX/lib/qscache/cfg` or `lib/python3.x/site-packages/qscache/cfg`,
|
|
89
|
+
copy the `site.cfg.example` file to `site.cfg` and customize settings as
|
|
90
|
+
described below. Alternatively, copy the example to `<system>.cfg` and then
|
|
91
|
+
set the environment variable `QSCACHE_SERVER=<system>`. The latter approach
|
|
92
|
+
allows you to cache multiple servers in a complex at the same time.
|
|
93
|
+
4. Schedule the `util/gen_data.sh` script to run at regular intervals (typically
|
|
94
|
+
every minute via a cron job).
|
|
95
|
+
7. Add the cached version of `qstat` to your (and your users') environment PATH.
|
|
96
|
+
|
|
97
|
+
### site.cfg settings
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
[paths]
|
|
101
|
+
# Temporary data path used by gen_data when creating
|
|
102
|
+
# cached output from qstat (fast file system is best)
|
|
103
|
+
Temp = ${install_dir}/temp/derecho
|
|
104
|
+
|
|
105
|
+
# Path where cached data will be stored and accessed
|
|
106
|
+
Data = ${install_dir}/data
|
|
107
|
+
|
|
108
|
+
# Optional path for logging qstat invocations
|
|
109
|
+
# If set, a log will be created for each user on each day
|
|
110
|
+
# that records calls to qstat along with arguments
|
|
111
|
+
# If blank, logging will be disabled
|
|
112
|
+
Logs = ${install_dir}/test/logs
|
|
113
|
+
|
|
114
|
+
[cache]
|
|
115
|
+
# The maximum wait time in seconds before the cache is
|
|
116
|
+
# bypassed and the real qstat is called
|
|
117
|
+
MaxWait = 20
|
|
118
|
+
|
|
119
|
+
# The maximum allowed age in seconds of cache data. Beyond
|
|
120
|
+
# this age we bypass the cache and call the true qstat
|
|
121
|
+
MaxAge = 300
|
|
122
|
+
|
|
123
|
+
# Delay in seconds to impose on qstat calls that bypass
|
|
124
|
+
# the cache due to aged data. Increasing this value can help
|
|
125
|
+
# the scheduler when under high load
|
|
126
|
+
AgeDelay = 5
|
|
127
|
+
|
|
128
|
+
# Specify the sub-minute frequency to generate data
|
|
129
|
+
# in seconds
|
|
130
|
+
Frequency = 60
|
|
131
|
+
|
|
132
|
+
[pbs]
|
|
133
|
+
# Specify the location of the actual qstat command
|
|
134
|
+
Qstat = /opt/pbs/bin/qstat
|
|
135
|
+
|
|
136
|
+
# Some sites may need to prefix calls to PBS with another
|
|
137
|
+
# command (e.g., a sudo operation). Use this variable to
|
|
138
|
+
# specify a prefix for PBS calls
|
|
139
|
+
Prefix = sudo -u adminuser
|
|
140
|
+
|
|
141
|
+
[servermap]
|
|
142
|
+
# Mapping of long-form server names for peer-scheduling
|
|
143
|
+
# user queries (use qstat -Bf to get server names)
|
|
144
|
+
casper = casper-pbs
|
|
145
|
+
derecho = desched1
|
|
146
|
+
|
|
147
|
+
[privileges]
|
|
148
|
+
# Enable privilege checking according to following user and
|
|
149
|
+
# group settings. If false, all queries allowed.
|
|
150
|
+
Active = True
|
|
151
|
+
|
|
152
|
+
[priv.all]
|
|
153
|
+
# Permit users and groups from these two lists respectively to
|
|
154
|
+
# see "full" job output from other users excluding the user
|
|
155
|
+
# environment contained in a job's Variable_List
|
|
156
|
+
Users = vanderwb
|
|
157
|
+
Groups = csgteam
|
|
158
|
+
|
|
159
|
+
[priv.env]
|
|
160
|
+
# Permit users and groups from these two lists to view all full
|
|
161
|
+
# job output, including the user environment
|
|
162
|
+
Users = vanderwb
|
|
163
|
+
Groups =
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Example crontab
|
|
167
|
+
|
|
168
|
+
Here is a sample crontab that will run the `gen_data.sh` script every minute
|
|
169
|
+
(sub-minute scheduled is recommended and enabled via the site.cfg). The idea
|
|
170
|
+
here is to run often enough that users and their workflows are satisfied, but
|
|
171
|
+
not so often that we put our own load on PBS.
|
|
172
|
+
|
|
173
|
+
Here, we use the `QSCACHE_SERVER` variable to specify a particular system in a
|
|
174
|
+
multi-server complex.
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
# Run qstat cache generation script every minute
|
|
178
|
+
# Added by Joe User on 4 Dec 2019
|
|
179
|
+
* * * * * QSCACHE_SERVER=sitename /path/to/qstat_cache/util/gen_data.sh
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Debugging
|
|
183
|
+
|
|
184
|
+
There are two environment variables you may set to assist in debugging. Setting
|
|
185
|
+
`QSCACHE_DEBUG` will cause qstat to print the age of the cache, assuming it can
|
|
186
|
+
be found.
|
|
187
|
+
|
|
188
|
+
If you set `QSCACHE_BYPASS` to `true`, the cache will be bypassed regardless of
|
|
189
|
+
which options are set, and the scheduler version of qstat will instead be
|
|
190
|
+
called.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# qstat-cache
|
|
2
|
+
A cached version of the PBS Pro qstat command that reduces load on the
|
|
3
|
+
scheduler's database
|
|
4
|
+
|
|
5
|
+
## Details
|
|
6
|
+
Most users run the qstat command at reasonable intervals and things work well.
|
|
7
|
+
However, with the advent of workflow managers more users are running qstat at
|
|
8
|
+
frequencies much too high for current versions of PBS Pro to support well. This
|
|
9
|
+
utility creates a simple text-based cache of common qstat output and provides a
|
|
10
|
+
script to serve that data to users. If an option is not cached (e.g., -Q
|
|
11
|
+
output), the query is sent to PBS's version of qstat for processing. Usage:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
usage: qstat [-h] [-1] [-a] [-D DELIMITER] [-f] [-F {json,dsv}]
|
|
15
|
+
[--format FORMAT] [-H] [-J] [--noheader] [-n] [-s]
|
|
16
|
+
[--status STATUS] [-t] [-T] [-u USER] [-w] [-x]
|
|
17
|
+
[filters ...]
|
|
18
|
+
|
|
19
|
+
This command provides a lightweight alternative to qstat. Data are queried and
|
|
20
|
+
updated every minute from the PBS job scheduler. Options not listed here will
|
|
21
|
+
be forwarded to the scheduler. Please use those options sparingly. Job IDs, if
|
|
22
|
+
provided, should be numeric only and space delimited. If a destination is
|
|
23
|
+
provided, it should be a valid execution queue on the chosen server. This
|
|
24
|
+
cached version of qstat does not allow mixed queries from multiple servers -
|
|
25
|
+
only one server may be specified per request.
|
|
26
|
+
|
|
27
|
+
positional arguments:
|
|
28
|
+
filters job IDs or queues
|
|
29
|
+
|
|
30
|
+
options:
|
|
31
|
+
-h, --help show this help message and exit
|
|
32
|
+
-1 display node or comment information on job line
|
|
33
|
+
-a display all jobs (default unless -f specified)
|
|
34
|
+
-D DELIMITER specify a delimiter if using -Fdsv (default = '|')
|
|
35
|
+
-f display full output for a job
|
|
36
|
+
-F {json,dsv} full output (-f) in custom format
|
|
37
|
+
--format FORMAT column output in custom format (=help for more)
|
|
38
|
+
-H all moved or finished jobs / specific job of any state
|
|
39
|
+
-J only show information for jobs (or subjobs with -t)
|
|
40
|
+
--noheader disable labels (no header)
|
|
41
|
+
-n display a list of nodes at the end of the line
|
|
42
|
+
-s display administrator comment on the next line
|
|
43
|
+
--status STATUS filter jobs by specific single-character status code
|
|
44
|
+
-t show information for both jobs and array subjobs
|
|
45
|
+
-T displays estimated start time for queued jobs
|
|
46
|
+
-u USER filter jobs by the submitting user
|
|
47
|
+
-w use wide format output (120 columns)
|
|
48
|
+
-x all job records in recent history
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
There are two methods for installing **qstat-cache** - using the included
|
|
54
|
+
`Makefile` or with `pip`.
|
|
55
|
+
|
|
56
|
+
### Makefile method
|
|
57
|
+
|
|
58
|
+
1. Clone this repository on your system.
|
|
59
|
+
2. Install at your desired path using `make install
|
|
60
|
+
PREFIX=/path/to/qstat-cache`.
|
|
61
|
+
|
|
62
|
+
### pip method
|
|
63
|
+
|
|
64
|
+
1. If desired, first create a virtual environment with `venv` or `conda/mamba`
|
|
65
|
+
and activate it.
|
|
66
|
+
2. Now run `python3 -m pip install qstat-cache`.
|
|
67
|
+
|
|
68
|
+
### Site setup
|
|
69
|
+
|
|
70
|
+
In either case, the following steps are required to finish configuration.
|
|
71
|
+
|
|
72
|
+
3. In `$PREFIX/lib/qscache/cfg` or `lib/python3.x/site-packages/qscache/cfg`,
|
|
73
|
+
copy the `site.cfg.example` file to `site.cfg` and customize settings as
|
|
74
|
+
described below. Alternatively, copy the example to `<system>.cfg` and then
|
|
75
|
+
set the environment variable `QSCACHE_SERVER=<system>`. The latter approach
|
|
76
|
+
allows you to cache multiple servers in a complex at the same time.
|
|
77
|
+
4. Schedule the `util/gen_data.sh` script to run at regular intervals (typically
|
|
78
|
+
every minute via a cron job).
|
|
79
|
+
7. Add the cached version of `qstat` to your (and your users') environment PATH.
|
|
80
|
+
|
|
81
|
+
### site.cfg settings
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
[paths]
|
|
85
|
+
# Temporary data path used by gen_data when creating
|
|
86
|
+
# cached output from qstat (fast file system is best)
|
|
87
|
+
Temp = ${install_dir}/temp/derecho
|
|
88
|
+
|
|
89
|
+
# Path where cached data will be stored and accessed
|
|
90
|
+
Data = ${install_dir}/data
|
|
91
|
+
|
|
92
|
+
# Optional path for logging qstat invocations
|
|
93
|
+
# If set, a log will be created for each user on each day
|
|
94
|
+
# that records calls to qstat along with arguments
|
|
95
|
+
# If blank, logging will be disabled
|
|
96
|
+
Logs = ${install_dir}/test/logs
|
|
97
|
+
|
|
98
|
+
[cache]
|
|
99
|
+
# The maximum wait time in seconds before the cache is
|
|
100
|
+
# bypassed and the real qstat is called
|
|
101
|
+
MaxWait = 20
|
|
102
|
+
|
|
103
|
+
# The maximum allowed age in seconds of cache data. Beyond
|
|
104
|
+
# this age we bypass the cache and call the true qstat
|
|
105
|
+
MaxAge = 300
|
|
106
|
+
|
|
107
|
+
# Delay in seconds to impose on qstat calls that bypass
|
|
108
|
+
# the cache due to aged data. Increasing this value can help
|
|
109
|
+
# the scheduler when under high load
|
|
110
|
+
AgeDelay = 5
|
|
111
|
+
|
|
112
|
+
# Specify the sub-minute frequency to generate data
|
|
113
|
+
# in seconds
|
|
114
|
+
Frequency = 60
|
|
115
|
+
|
|
116
|
+
[pbs]
|
|
117
|
+
# Specify the location of the actual qstat command
|
|
118
|
+
Qstat = /opt/pbs/bin/qstat
|
|
119
|
+
|
|
120
|
+
# Some sites may need to prefix calls to PBS with another
|
|
121
|
+
# command (e.g., a sudo operation). Use this variable to
|
|
122
|
+
# specify a prefix for PBS calls
|
|
123
|
+
Prefix = sudo -u adminuser
|
|
124
|
+
|
|
125
|
+
[servermap]
|
|
126
|
+
# Mapping of long-form server names for peer-scheduling
|
|
127
|
+
# user queries (use qstat -Bf to get server names)
|
|
128
|
+
casper = casper-pbs
|
|
129
|
+
derecho = desched1
|
|
130
|
+
|
|
131
|
+
[privileges]
|
|
132
|
+
# Enable privilege checking according to following user and
|
|
133
|
+
# group settings. If false, all queries allowed.
|
|
134
|
+
Active = True
|
|
135
|
+
|
|
136
|
+
[priv.all]
|
|
137
|
+
# Permit users and groups from these two lists respectively to
|
|
138
|
+
# see "full" job output from other users excluding the user
|
|
139
|
+
# environment contained in a job's Variable_List
|
|
140
|
+
Users = vanderwb
|
|
141
|
+
Groups = csgteam
|
|
142
|
+
|
|
143
|
+
[priv.env]
|
|
144
|
+
# Permit users and groups from these two lists to view all full
|
|
145
|
+
# job output, including the user environment
|
|
146
|
+
Users = vanderwb
|
|
147
|
+
Groups =
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Example crontab
|
|
151
|
+
|
|
152
|
+
Here is a sample crontab that will run the `gen_data.sh` script every minute
|
|
153
|
+
(sub-minute scheduled is recommended and enabled via the site.cfg). The idea
|
|
154
|
+
here is to run often enough that users and their workflows are satisfied, but
|
|
155
|
+
not so often that we put our own load on PBS.
|
|
156
|
+
|
|
157
|
+
Here, we use the `QSCACHE_SERVER` variable to specify a particular system in a
|
|
158
|
+
multi-server complex.
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
# Run qstat cache generation script every minute
|
|
162
|
+
# Added by Joe User on 4 Dec 2019
|
|
163
|
+
* * * * * QSCACHE_SERVER=sitename /path/to/qstat_cache/util/gen_data.sh
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Debugging
|
|
167
|
+
|
|
168
|
+
There are two environment variables you may set to assist in debugging. Setting
|
|
169
|
+
`QSCACHE_DEBUG` will cause qstat to print the age of the cache, assuming it can
|
|
170
|
+
be found.
|
|
171
|
+
|
|
172
|
+
If you set `QSCACHE_BYPASS` to `true`, the cache will be bypassed regardless of
|
|
173
|
+
which options are set, and the scheduler version of qstat will instead be
|
|
174
|
+
called.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Setuptools version required for PEP 639
|
|
2
|
+
[build-system]
|
|
3
|
+
requires = [
|
|
4
|
+
"setuptools >= 77.0",
|
|
5
|
+
"setuptools-scm>=8",
|
|
6
|
+
]
|
|
7
|
+
build-backend = "setuptools.build_meta"
|
|
8
|
+
|
|
9
|
+
[project]
|
|
10
|
+
name = "qstat-cache"
|
|
11
|
+
dynamic = [ "version" ]
|
|
12
|
+
authors = [
|
|
13
|
+
{ name="Brian Vanderwende", email="vanderwb@ucar.edu" },
|
|
14
|
+
]
|
|
15
|
+
description = "A caching qstat that reduces load on the PBS server"
|
|
16
|
+
readme = "README.md"
|
|
17
|
+
requires-python = ">=3.6"
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Topic :: System :: Distributed Computing",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
license = "MIT"
|
|
25
|
+
license-files = ["LICENSE"]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
homepage = "https://github.com/NCAR/qstat-cache"
|
|
29
|
+
issues = "https://github.com/NCAR/qstat-cache/issues"
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
qstat = "qscache.qscache:main"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools_scm]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[paths]
|
|
2
|
+
Temp = ${install_dir}/temp/casper
|
|
3
|
+
Data = ${install_dir}/data
|
|
4
|
+
#Logs = /glade/derecho/scratch/csgteam/logs/qstat
|
|
5
|
+
|
|
6
|
+
[cache]
|
|
7
|
+
MaxWait = 20
|
|
8
|
+
MaxAge = 300
|
|
9
|
+
AgeDelay = 5
|
|
10
|
+
Frequency = 60
|
|
11
|
+
|
|
12
|
+
[history]
|
|
13
|
+
MaxAge = 600
|
|
14
|
+
|
|
15
|
+
[pbs]
|
|
16
|
+
Qstat = /opt/pbs/bin/qstat
|
|
17
|
+
Prefix = sudo -u csgteam
|
|
18
|
+
|
|
19
|
+
[servermap]
|
|
20
|
+
casper = casper-pbs
|
|
21
|
+
derecho = desched1
|
|
22
|
+
|
|
23
|
+
[privileges]
|
|
24
|
+
Active = True
|
|
25
|
+
|
|
26
|
+
[priv.all]
|
|
27
|
+
Users = *
|
|
28
|
+
|
|
29
|
+
[priv.env]
|
|
30
|
+
Groups = csg
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[paths]
|
|
2
|
+
Temp = ${install_dir}/temp/derecho
|
|
3
|
+
Data = ${install_dir}/data
|
|
4
|
+
#Logs = /glade/derecho/scratch/csgteam/logs/qstat
|
|
5
|
+
|
|
6
|
+
[cache]
|
|
7
|
+
MaxWait = 20
|
|
8
|
+
MaxAge = 300
|
|
9
|
+
AgeDelay = 5
|
|
10
|
+
Frequency = 60
|
|
11
|
+
|
|
12
|
+
[history]
|
|
13
|
+
MaxAge = 600
|
|
14
|
+
|
|
15
|
+
[pbs]
|
|
16
|
+
Qstat = /opt/pbs/bin/qstat
|
|
17
|
+
Prefix = sudo -u csgteam
|
|
18
|
+
|
|
19
|
+
[servermap]
|
|
20
|
+
casper = casper-pbs
|
|
21
|
+
derecho = desched1
|
|
22
|
+
|
|
23
|
+
[privileges]
|
|
24
|
+
Active = True
|
|
25
|
+
|
|
26
|
+
[priv.all]
|
|
27
|
+
Users = *
|
|
28
|
+
|
|
29
|
+
[priv.env]
|
|
30
|
+
Groups = csg
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[paths]
|
|
2
|
+
Temp = ${install_dir}/temp/gust
|
|
3
|
+
Data = ${install_dir}/data
|
|
4
|
+
Logs = /glade/gust/scratch/csgteam/logs/qstat
|
|
5
|
+
|
|
6
|
+
[cache]
|
|
7
|
+
MaxWait = 20
|
|
8
|
+
MaxAge = 300
|
|
9
|
+
AgeDelay = 5
|
|
10
|
+
Frequency = 60
|
|
11
|
+
|
|
12
|
+
[history]
|
|
13
|
+
MaxAge = 600
|
|
14
|
+
|
|
15
|
+
[pbs]
|
|
16
|
+
Qstat = /opt/pbs/bin/qstat
|
|
17
|
+
Prefix = sudo -u csgteam
|
|
18
|
+
|
|
19
|
+
[servermap]
|
|
20
|
+
gust = gusched1
|
|
21
|
+
|
|
22
|
+
[privileges]
|
|
23
|
+
Active = True
|
|
24
|
+
|
|
25
|
+
[priv.all]
|
|
26
|
+
Users = *
|
|
27
|
+
|
|
28
|
+
[priv.env]
|
|
29
|
+
Groups = csg
|