Getting Started¶
Installation¶
PSI/J can be installed via pip or from source.
Requirements¶
The only requirements are Python 3.7+ and pip, which almost always comes with Python.
Install from pip¶
pip install psij
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 for a variable period of time,
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
JobExecutorinstance.Create a
JobSpecobject and populate it with information about your job.Submit the
Jobinstance 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, JobExecutor, JobSpec
ex = JobExecutor.get_instance(execparams.executor)
job = Job(JobSpec(executable="/bin/date"))
ex.submit(job)
The executable="/bin/date") part 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.