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 ^^^^^^^^^^^^^^^^ .. code-block:: console pip install psij-python Install from Source ^^^^^^^^^^^^^^^^^^^ .. code-block:: console git clone https://github.com/ExaWorks/psij-python.git cd psij-python pip install . Overview -------- In PSI/J's terminology, a :class:`Job ` represents an executable plus a bunch of attributes. Static job attributes such as resource requirements are defined by the :class:`JobSpec ` at creation. Dynamic job attributes such as the :class:`JobState ` are modified by :class:`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 :meth:`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 :class:`JobExecutor ` instance. #. Create a :class:`JobSpec ` object and populate it with information about your job. #. Create a :class:`Job ` with that :class:`JobSpec `. #. Submit the :class:`Job ` instance to the :class:`JobExecutor `. 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. .. rst-class:: executor-type-selector selector-mode-tabs Local // Slurm // LSF // PBS // Cobalt .. literalinclude:: ../tests/getting_started/test_simple_example.py :language: python :dedent: 4 :lines: 7-11 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.