Skip to main content

qstat for python TravisBuildStatus PyPIStatus BlackStyle

A python API for qstat

The sungrid job submission framework known as `qsub` is a powerful tool to distribute your workload over many machines in parallel. To check the status of the jobs in the queue there is `qstat` which can print a human readable status table on the command line. Such status can be useful to keep track of your submitted compute jobs to e.g. prevent duplicate submission.

This python qstat wrapper parses the jobs listed in `qstat -xml` into a list of dictionaries.

Install with

$ pip install qstat

Usage

Get python dictionaries descibing your `qsub` jobs.

from qstat import qstat

queue_info, job_info = qstat()

queue_info[13]
{'@state': 'running',
 'JAT_prio': '0.55008',
 'JAT_start_time': '2017-09-04T16:22:50',
 'JB_job_number': '6384796',
 'JB_name': 'phs_obs_20120102_001',
 'JB_owner': 'relleums',
 'queue_name': 'test@isdc-cn11.astro.unige.ch',
 'slots': '1',
 'state': 'r'}

Add both `queue_info` and `job_info` to have one list of both running and waiting jobs:

from qstat import qstat

queue_info, job_info = qstat()

all_jobs = queue_info + job_info

for job in all_jobs:
    print(job['JB_name'], 'is', job['@state'])
my_job_001 is running
my_job_002 is running
my_job_003 is running

or combine with e.g. with pandas DataFrame

from qstat import qstat
q, j = qstat()

import pandas as pd
df = pd.DataFrame(q + j)

df.tail()
      @state JAT_prio JAT_start_time JB_job_number               JB_name  \
190  pending  0.00000            NaN       6384973  phs_obs_20160102_002
191  pending  0.00000            NaN       6384974  phs_obs_20160201_001
192  pending  0.00000            NaN       6384975  phs_obs_20160201_002
193  pending  0.00000            NaN       6384976  phs_obs_20160202_001
194  pending  0.00000            NaN       6384977  phs_obs_20160202_002

     JB_owner   JB_submission_time queue_name slots state
190  relleums  2017-09-04T16:22:51       None     1    qw
191  relleums  2017-09-04T16:22:51       None     1    qw
192  relleums  2017-09-04T16:22:51       None     1    qw
193  relleums  2017-09-04T16:22:51       None     1    qw
194  relleums  2017-09-04T16:22:51       None     1    qw

Metadata

Release files for qstat 0.0.5

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

Source distribution (sdist)

Source distribution for qstat 0.0.5
File Size Uploaded
qstat-0.0.5.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qstat 0.0.5
File Interpreter ABI Platform
qstat-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 23.7 kB

Release files / qstat-0.0.5.tar.gz

Download URL qstat-0.0.5.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
56606ada5eddbe11ad9edfd8778fb2efea67e5cb27164d290529fcf26c0c9279
BLAKE2b-256 checksum
How to use checksums
625516e727b0bd0ae330ab444a5d4ffe8e60c0da44407d7966c7b41f15bdd93c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release files / qstat-0.0.5-py3-none-any.whl

Download URL qstat-0.0.5-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ec6d2d5ae747d3aa0ca15056788e7e84f12f0a886948b4e88e0b688a2a222f6
BLAKE2b-256 checksum
How to use checksums
45672a0f08422eacbca97e31c891afc67fba031058bc42e7bbb8265ddd6e8580
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

1 release file

0.0.1

1 release file

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