Skip to main content

qdir

A very low overhead first-in, first-out job queue for the local machine

This type of queue is ideal when you have multiple programs (jobs) that must run sequentially rather than in parallel, often due to resource constraints or dependencies. For example, to run several finite element analysis models in sequence. You can add jobs to the queue at any time, monitor the current job list and remove specific jobs as necessary. (see usage below)

The queue operates by maintaining a directory of small job status files. When a new job is added, it identifies preceeding jobs by their status files and then creates its own file. Each job waits for all preceding jobs to finish before running its command. By default, jobs check every 2 seconds for their turn to run. Once a job finishes, it deletes its status file.

The queue directory where status files are stored may be set to a shared location on multi-user systems (/tmp by default in Linux) in order to coordinate sequential execution among all users.

Installation

Requires python3 on Windows, Linux, or MacOS.

Installing with python3 and pip

The pip application is a traditional Python package manager which is often installed with Python. One way to get python3 on Windows is through the Microsoft Store. Here is the command to install qdir once python3 is available:

python3 -m pip install qdir

See installation of pip if there is "no module named pip."

If there is a warning that the script directory is not in the PATH then it must be added in order to use the command line tools. Otherwise, see below without modifying PATH.

Check the installation with python3 -m qdir which will find the location of the command scripts and check if they are in your PATH.

Installing with uv

The uv application is a modern, powerful, and fast Python package manager. If you have uv then you may use these commands to install qdir as a uv tool and to verify its commands are in your PATH:

uv tool install qdir
uv tool update-shell

Abaqus Finite Element Analysis (FEA) extras

The package includes additional files to help Abaqus users submit and monitor the qdir job queue. Use the following command to configure Abaqus after qdir itself has been installed:

python3 -m qdir.abaqus install

By default, the necessary settings are appended to the end of the user abaqus_v6.env file. The following command may be used to remove qdir settings for Abaqus:

python3 -m qdir.abaqus uninstall

Usage

Below is a brief overview of usage. The command line tools accept a -h or --help argument to list their full options.

Command line job submission

Submit commands or job scripts to the queue using the qsub command. Job scripts, which are text, are scanned for any qdir directives (see Job script directives below). Binary executables are also accepted but are not scanned. For example, on Linux:

qsub ./myJobFile.sh
qsub --name timer sleep 60
qsub --name files ls -l

or similar examples on Windows:

qsub myJobFile.cmd
qsub --name timer ping localhost -n 60
qsub --name files cmd /c dir

Any printed output from the command (stdout and stderr) will be saved to a new file whose name has the job Id appended to the end.

Display command options with qsub -h

Command line queue status

Check status of queued jobs with the qstat command, for example:

qstat

More detailed job data may be requested with qstat -f or qstat --full

Command line job removal

First use the qstat command above to find the job Ids and job names in the queue. Delete or kill jobs with the qdel command followed by its jobId or job name. For example, to delete job 12343:

qdel 12343

The jobId is a number matching its process ID. This means on Linux you may terminate or remove a job from queue by killing that process ID, for example, kill 12343 Also, deleting a job's status file will terminate or remove the job from queue.

Usage without script directory in PATH

The qsub, qstat, and qdel commands are shortcuts to call python3 methods. These commands will not be available at the command line if the directory where pip installed them is not in the PATH (check with python3 -m qdir). It's most convenient to add this directory to the PATH but it is also possible to run the methods directly with some additional typing, such as python3 -m qdir.qstat to execute qstat

Abaqus extras

Submit Abaqus jobs as usual from the command line, nothing special is required. For example, to submit the whatever.inp model for analysis on 4 cores:

abaqus job=whatever cpus=4

Internally this will invoke the qdir_submit.py module to create a job script and submit it to the queue.

You may also submit jobs within Abaqus CAE by selecting qdir as the Job's queue before submitting. You may check the queue status within CAE in the menu Plug-ins > QDir Job Queue Monitor... Click on a Job to see more detailed information. Right-click on a Job to open a popup menu allowing you to delete the Job.

Customization

Most parameters used by qdir may be customized with command line options, system environment variables, or directives within the job script itself. Settings from command line parameters have the highest priority, followed by job script directives and environment variables.

The Python string Formatter is used to evaluate these settings. Field names available in job status may be referenced if enclosed in {} braces.

Option Description
-N NAME, --name NAME Name for the job. For example, -N Job-1. Default is environment variable QDIR_JOBNAME or {cmd[0]} (the command itself)
-q QUEUE, --queue QUEUE Directory to store the queue files. Default is environment variable QDIR_QUEUE or /tmp on Linux
-c INTERVAL, --interval INTERVAL Polling interval in seconds. For example, -c 2.5 to sleep 2.5 seconds between checks. Default is environment variable QDIR_POLL_INTERVAL or 2.0
--affinity AFFINITY Optionally specify the list of cpu cores the cmd is allowed to run on. This can be used, for example, to increase performance by avoiding efficiency cores. For example: --affinity 0,1,2,3 if the first 4 cores are high performance. If the list contains spaces then it must be enclosed by " quotes to prevent errors. Default is environment variable QDIR_AFFINITY or no specific affinity
-i INFO, --info INFO Specify the format of information about jobs in queue. Default is environment variable QDIR_INFO or "{jobId:8} {owner:12} {time:25} {status:8} {name}"
-o OUTPUT, --output OUTPUT File name for combined stdout and stderr. Default is environment variable QDIR_LOGNAME or {name}._{jobId}
-s STATUS, --status STATUS Specify the format of job status messages output to terminal. Default is environment variable QDIR_STATUS or "{jobId} {name} {status} after {duration}"
-v VERBOSE, --verbose VERBOSE Set the verbosity level to an integer 0 thru 3 regulating the amount of output from qdir commands. For example, -v 3 for more information. Default is environment variable QDIR_VERBOSE or 2

Fields available in job status

The following fields are maintained by qdir for each job. The command qstat -f will list the current values. Field names are case-sensitive when referenced by the options above.

Field Description
jobId The process ID of the job which is used as a unique job identification
name The name assigned to the job
owner User name of job owner
cmd List of the job's command and any arguments
directory Working directory where job was submitted
affinity List of speicfied processor affinity for the command, if any
position Place in the queue. Running job has position 1
behind List of other jobId which must finish before this job, if any
status Current job status: Queued or Started
history List of status updates for this job
output Filename of the output file
time Current date and time
duration Time spent at the current status

Job script directives

The qsub command will search the submitted cmd file contents for built-in qdir settings called directives. Binary executables will abort the search so this method of setting parameters only works when submitting scripts. Lines beginning with # QDIR or @rem QDIR may be followed by directives. The directives are the same parameters listed above. For example:

#!/bin/sh
# This is an example Linux job script.
# It's a normal script with a couple optional comments added for qdir.

# Example directives on the next two comment lines will override qdir defaults
# QDIR -N Example
# QDIR --output {name}.out

# The next line launches the main program, in this case myBigProgram
exec /opt/bin/myBigProgram "$@"

or, on Windows:

@echo off
rem This is an example Windows job script.
rem It's a normal script with a couple optional comments added for qdir.

rem Example directives on the next two comment lines will override qdir defaults
rem QDIR -N Example
rem QDIR --output {name}.out

rem The next lines launch an example "myBigProgram"
c:\Temp\myBigProgram

Metadata

Release files for qdir 1.3.0

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

Source distribution (sdist)

Source distribution for qdir 1.3.0
File Size Uploaded Provenance Actions
qdir-1.3.0.tar.gz 22.7 kB With provenance Details for qdir-1.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 44.4 kB

Release files / qdir-1.3.0.tar.gz

Download URL qdir-1.3.0.tar.gz
Size 22.7 kB
Tags Source
SHA-256 checksum
How to use checksums
beb95426e222649f7df5aefcae952f50de79c7c25abbc7807d55db63af6e63f7
BLAKE2b-256 checksum
How to use checksums
6f846f5d8a12f32964ec36a01827bb7a94150d890bf99c7d61b7fb5bace879bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / qdir-1.3.0-py3-none-any.whl

Download URL qdir-1.3.0-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0cb558e497e6b2f3c822dd6ceb86ec6732a921bc95f9f3393cf05b597f5b3a10
BLAKE2b-256 checksum
How to use checksums
b112f47063b139150dbca249e6a7364a5cb6f6c75d2ce3046082902e0526a88e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for qdir 1.3.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for qdir-1.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

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