Skip to content

some more doc fixes #287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ theme:
name: Switch to dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
accent: lime
toggle:
icon: material/brightness-4
name: Switch to light mode
Expand All @@ -35,6 +36,7 @@ theme:
plugins:
- search
- awesome-pages
- autorefs
- mike
- mkdocstrings:
handlers:
Expand All @@ -51,6 +53,13 @@ markdown_extensions:
- admonition
- pymdownx.snippets:
check_paths: true
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.superfences
- pymdownx.details

extra:
version:
Expand Down
2 changes: 1 addition & 1 deletion pyslurm/core/job/job.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ from pyslurm.slurm cimport (


cdef class Jobs(dict):
"""A collection of Job objects.
"""A collection of [pyslurm.Job][] objects.

Args:
jobs (Union[list, dict], optional=None):
Expand Down
22 changes: 9 additions & 13 deletions pyslurm/core/job/job.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,9 @@ cdef class Jobs(dict):
This function fills in the "steps" attribute for all Jobs in the
collection.

Note: Pending Jobs will be ignored, since they don't have any Steps
yet.
!!! note

Pending Jobs will be ignored, since they don't have any Steps yet.

Raises:
RPCError: When retrieving the Job information for all the Steps
Expand Down Expand Up @@ -241,7 +242,8 @@ cdef class Job:

Implements the slurm_load_job RPC.

Note:
!!! note

If the Job is not pending, the related Job steps will also be
loaded.

Expand Down Expand Up @@ -454,8 +456,6 @@ cdef class Job:
release the Job again. If you specify the mode as "user", the
User will also be able to release the job.

Note: Uses the modify() function to set the Job's priority to 0.

Raises:
RPCError: When holding the Job was not successful.

Expand All @@ -478,9 +478,6 @@ cdef class Job:
def release(self):
"""Release a currently held Job, allowing it to be scheduled again.

Note: Uses the modify() function to reset the priority back to
be controlled by the slurmctld's priority calculation routine.

Raises:
RPCError: When releasing a held Job was not successful.

Expand Down Expand Up @@ -1223,14 +1220,13 @@ cdef class Job:
def get_resource_layout_per_node(self):
"""Retrieve the resource layout of this Job on each node.

The dict returned contains the following information for each node:
* cpu_ids (str)
* gres (dict)
* memory (int)
!!! warning

Return type may still be subject to change in the future

Returns:
(dict): Resource layout, where the key is the name of the name and
its value another dict with the components described above.
its value another dict with the CPU-ids, memory and gres.
"""
# The code for this function is a modified reimplementation from here:
# https://github.com/SchedMD/slurm/blob/d525b6872a106d32916b33a8738f12510ec7cf04/src/api/job_info.c#L739
Expand Down
2 changes: 1 addition & 1 deletion pyslurm/core/job/step.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ from pyslurm.core.job.task_dist cimport TaskDistribution


cdef class JobSteps(dict):
"""A collection of [`pyslurm.JobStep`][] objects for a given Job.
"""A collection of [pyslurm.JobStep][] objects for a given Job.

Args:
job (Union[Job, int]):
Expand Down
4 changes: 2 additions & 2 deletions pyslurm/core/job/submission.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ cdef class JobSubmitDescription:

* "no" or "exclusive"
No sharing of resources is allowed. (--exclusive from sbatch)
distribution (Union[dict, str]):
TODO
distribution (str):
Task distribution for the Job, same as --distribution from sbatch
time_limit (str):
The time limit for the job.
This is the same as -t/--time from sbatch.
Expand Down
24 changes: 24 additions & 0 deletions pyslurm/core/job/submission.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,35 @@ cdef class JobSubmitDescription:
def load_environment(self, overwrite=False):
"""Load values of attributes provided through the environment.

!!! note

Instead of `SBATCH_`, pyslurm uses `PYSLURM_JOBDESC_` as a prefix to
identify environment variables which should be used to set
attributes.

Args:
overwrite (bool):
If set to True, the value from an option found in the
environment will override the current value of the attribute
in this instance. Default is False

Examples:
Lets consider you want to set the name of the Job and its
Account name. Therefore, you will need to have set these two
environment variables:

```bash
export PYSLURM_JOBDESC_ACCOUNT="myaccount"
export PYSLURM_JOBDESC_NAME="myjobname"
```

In python, you can do this now:

>>> import pyslurm
>>> desc = pyslurm.JobSubmitDescription(...other args...)
>>> desc.load_environment()
>>> print(desc.name, desc.account)
myjobname, myaccount
"""
self._parse_env(overwrite)

Expand Down
2 changes: 1 addition & 1 deletion pyslurm/core/node.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ from pyslurm.utils.uint cimport *


cdef class Nodes(dict):
"""A collection of Node objects.
"""A collection of [pyslurm.Node][] objects.

Args:
nodes (Union[list, dict, str], optional=None):
Expand Down
4 changes: 3 additions & 1 deletion pyslurm/core/node.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ cdef class Nodes(dict):
def reload(self):
"""Reload the information for nodes in a collection.

Note: Only information for nodes which are already in the collection at
!!! note

Only information for nodes which are already in the collection at
the time of calling this method will be reloaded.

Raises:
Expand Down
2 changes: 1 addition & 1 deletion pyslurm/db/job.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ cdef class JobSearchFilter:


cdef class Jobs(dict):
"""A collection of [`pyslurm.db.Job`][] objects."""
"""A collection of [pyslurm.db.Job][] objects."""
cdef:
SlurmList info
Connection db_conn
Expand Down
3 changes: 2 additions & 1 deletion pyslurm/db/stats.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ from pyslurm.utils cimport cstr
cdef class JobStatistics:
"""Statistics for a Slurm Job or Step.

Note:
!!! note

For more information also see the sacct manpage.

Attributes:
Expand Down
2 changes: 1 addition & 1 deletion pyslurm/db/step.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ from pyslurm.db.tres cimport TrackableResources, TrackableResource


cdef class JobSteps(dict):
"""A collection of [`pyslurm.db.JobStep`][] objects"""
"""A collection of [pyslurm.db.JobStep][] objects"""
pass


Expand Down
1 change: 1 addition & 0 deletions scripts/builddocs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

python setup.py clean
pip install -r doc_requirements.txt
pip install --no-build-isolation -e .
mkdocs build