A python package for working with the Portable Batch System (PBS) job scheduler.
See the documentation for more information.
from pbspy import Job, JobDescription
# Run a job with some explicit parameters
job_a = (
JobDescription(name="job_a", ncpus=4, mem="192GB", walltime="00:05:00")
.add_command(["echo", "A"])
.submit()
)
# Submit another job that waits for job_a to finish
job_b = (
JobDescription(name="job_b", ncpus=1, walltime="00:05:00", afterok=[job_a])
.add_command(["echo", "B"])
.submit()
)
# Get the result of the jobs
# result_a = job_a.result() # wait for job_a to finish and get result
(result_a, result_b) = Job.result_all(
[job_a, job_b]
) # wait for job_a and job_b to finish and get results
print("job_a:", result_a.output.strip())
print("job_b:", result_b.output.strip())PBS operations use LocalBackend by default and run on the current host.
JobDescription.submit() also accepts any implementation of the public Backend
interface, allowing alternate execution mechanisms to live in separate packages.
pbspy is licensed under the MIT License LICENSE or http://opensource.org/licenses/MIT.