Getting Started¶
Installation¶
PSI/J can be installed via pip or from source.
Requirements¶
The only requirements are Python 3.8+ and pip, which almost always comes with Python.
Install from PIP¶
pip install psij-python
Install from Source¶
git clone https://github.com/ExaWorks/psij-python.git
cd psij-python
pip install .
Overview¶
In PSI/J’s terminology, a Job
represents an executable
plus a bunch of attributes. Static job attributes such as resource requirements
are defined by the JobSpec
at
creation. Dynamic job attributes such as the JobState
are modified by JobExecutors
as a job progresses through its lifecycle.
A JobExecutor represents a specific Resource Manager, e.g. Slurm, on which the job is being executed. Generally, when jobs are submitted, they will be queued depending on how busy the target machine is. Once a job is started, its executable is launched and runs to completion.
In PSI/J, a job is submitted by JobExecutor.submit(Job)
which permanently binds the job to that executor and
submits it to the underlying resource manager.
Basic Usage¶
The most basic way to use PSI/J looks something like the following:
Create a
JobExecutor
instance.Create a
JobSpec
object and populate it with information about your job.Submit the
Job
instance to theJobExecutor
.
That’s all there is to it! Assuming there are no errors, you should see a new entry in your resource manager’s queue. Choose from the tabs below for a very simple example showing how to submit a job for that resource manager.
Local // Slurm // LSF // PBS // Cobalt
from psij import Job, JobSpec
job = Job(JobSpec(executable="/bin/date"))
ex = _get_executor_instance(execparams, job)
ex.submit(job)
The executable="/bin/date"
parameter tells PSI/J that we want the job to run
the /bin/date
command. Once that command has finished executing
(which should be almost as soon as the job starts, since date
does very little work)
the resource manager will mark the job as complete, triggering PSI/J to do the same.
Examples¶
Up-to-date and actively tested examples can be found here. Tests of resource-manager-specific and site-specific values (such as accounts, queues/partitions, etc.) can be found in files in the same directory but tend to be buried under layers of indirection in order to reduce code complexity.