Skip to content

Refactor + improve docs #305

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 28 commits into from
Jul 13, 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
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- New attributes for a Database Job:
- extra
- failed_node
- Now possible to initialize a pyslurm.db.Jobs collection with existing job
- Now possible to initialize a [pyslurm.db.Jobs][] collection with existing job
ids or pyslurm.db.Job objects
- Added `as_dict` function to all Collections
- Added a new Base Class [MultiClusterMap][pyslurm.xcollections.MultiClusterMap] that some Collections inherit from.

### Fixed

Expand All @@ -28,9 +29,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- the Job was older than a day

### Changed

- All Collections (like [pyslurm.Jobs](https://pyslurm.github.io/23.2/reference/job/#pyslurm.Jobs)) inherit from `list` now instead of `dict`

- `JobSearchFilter` has been renamed to `JobFilter`
- Renamed `as_dict` Function of some classes to `to_dict`

## [23.2.1](https://github.com/PySlurm/pyslurm/releases/tag/v23.2.1) - 2023-05-18

Expand Down
1 change: 0 additions & 1 deletion docs/reference/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ title: Config
removed in the future when a replacement is introduced

::: pyslurm.config
handler: python
2 changes: 0 additions & 2 deletions docs/reference/constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ title: constants
---

::: pyslurm.constants
handler: python

1 change: 0 additions & 1 deletion docs/reference/db/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ title: Cluster
removed in the future when a replacement is introduced

::: pyslurm.slurmdb_clusters
handler: python
1 change: 0 additions & 1 deletion docs/reference/db/connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ title: Connection
---

::: pyslurm.db.Connection
handler: python
1 change: 0 additions & 1 deletion docs/reference/db/event.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ title: Event
removed in the future when a replacement is introduced

::: pyslurm.slurmdb_events
handler: python
3 changes: 0 additions & 3 deletions docs/reference/db/job.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ title: Job
will be removed in a future release

::: pyslurm.db.Job
handler: python

::: pyslurm.db.Jobs
handler: python
1 change: 0 additions & 1 deletion docs/reference/db/jobfilter.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ title: JobFilter
---

::: pyslurm.db.JobFilter
handler: python
1 change: 0 additions & 1 deletion docs/reference/db/jobstats.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ title: JobStatistics
---

::: pyslurm.db.JobStatistics
handler: python
3 changes: 0 additions & 3 deletions docs/reference/db/jobstep.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ title: JobStep
---

::: pyslurm.db.JobStep
handler: python

::: pyslurm.db.JobSteps
handler: python
1 change: 0 additions & 1 deletion docs/reference/db/reservation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ title: Reservation
removed in the future when a replacement is introduced

::: pyslurm.slurmdb_reservations
handler: python
3 changes: 0 additions & 3 deletions docs/reference/exceptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ title: Exceptions
---

::: pyslurm.PyslurmError
handler: python

::: pyslurm.RPCError
handler: python
1 change: 0 additions & 1 deletion docs/reference/frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ title: Frontend
removed in the future when a replacement is introduced

::: pyslurm.front_end
handler: python
1 change: 0 additions & 1 deletion docs/reference/hostlist.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ title: Hostlist
removed in the future when a replacement is introduced

::: pyslurm.hostlist
handler: python
3 changes: 0 additions & 3 deletions docs/reference/job.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ title: Job
removed in a future release

::: pyslurm.Job
handler: python

::: pyslurm.Jobs
handler: python
3 changes: 0 additions & 3 deletions docs/reference/jobstep.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ title: JobStep
will be removed in a future release

::: pyslurm.JobStep
handler: python

::: pyslurm.JobSteps
handler: python
1 change: 0 additions & 1 deletion docs/reference/jobsubmitdescription.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ title: JobSubmitDescription
---

::: pyslurm.JobSubmitDescription
handler: python
3 changes: 0 additions & 3 deletions docs/reference/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ title: Node
removed in a future release

::: pyslurm.Node
handler: python

::: pyslurm.Nodes
handler: python
3 changes: 0 additions & 3 deletions docs/reference/partition.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ title: Partition
will be removed in a future release

::: pyslurm.Partition
handler: python

::: pyslurm.Partitions
handler: python
1 change: 0 additions & 1 deletion docs/reference/reservation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ title: Reservation
removed in the future when a replacement is introduced

::: pyslurm.reservation
handler: python
1 change: 0 additions & 1 deletion docs/reference/statistics.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ title: Statistics
removed in the future when a replacement is introduced

::: pyslurm.statistics
handler: python
1 change: 0 additions & 1 deletion docs/reference/topology.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ title: Topology
removed in the future when a replacement is introduced

::: pyslurm.topology
handler: python
1 change: 0 additions & 1 deletion docs/reference/trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ title: Trigger
removed in the future when a replacement is introduced

::: pyslurm.trigger
handler: python
24 changes: 2 additions & 22 deletions docs/reference/utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,17 @@ title: utils
---

::: pyslurm.utils
handler: python
options:
members: []

::: pyslurm.utils.timestr_to_secs
handler: python

::: pyslurm.utils.timestr_to_mins
handler: python

::: pyslurm.utils.secs_to_timestr
handler: python

::: pyslurm.utils.mins_to_timestr
handler: python

::: pyslurm.utils.date_to_timestamp
handler: python

::: pyslurm.utils.timestamp_to_date
handler: python

::: pyslurm.utils.expand_range_str
handler: python

::: pyslurm.utils.humanize
handler: python

::: pyslurm.utils.dehumanize
handler: python

::: pyslurm.utils.nodelist_from_range_str
handler: python

::: pyslurm.utils.nodelist_to_range_str
handler: python
16 changes: 16 additions & 0 deletions docs/reference/xcollections.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: xcollections
---

::: pyslurm.xcollections
handler: python
options:
members:
- MultiClusterMap
- BaseView
- KeysView
- MCKeysView
- ItemsView
- MCItemsView
- ValuesView
- ClustersView
6 changes: 6 additions & 0 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
.md-grid {
max-width: 75%;
}

/* Indentation. */
div.doc-contents:not(.first) {
padding-left: 25px;
border-left: .05rem solid var(--md-typeset-table-color);
}
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ plugins:
docstring_style: google
show_signature: true
show_root_heading: true
show_symbol_type_toc: true
show_symbol_type_heading: true

markdown_extensions:
- admonition
Expand Down
17 changes: 6 additions & 11 deletions pyslurm/core/job/job.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@
from pyslurm.utils cimport cstr, ctime
from pyslurm.utils.uint cimport *
from pyslurm.utils.ctime cimport time_t

from libc.string cimport memcpy, memset
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, int64_t
from libc.stdlib cimport free

from pyslurm.core.job.submission cimport JobSubmitDescription
from pyslurm.core.job.step cimport JobSteps, JobStep

from pyslurm.xcollections cimport MultiClusterMap
from pyslurm cimport slurm
from pyslurm.slurm cimport (
working_cluster_rec,
Expand Down Expand Up @@ -67,8 +65,8 @@ from pyslurm.slurm cimport (
)


cdef class Jobs(list):
"""A collection of [pyslurm.Job][] objects.
cdef class Jobs(MultiClusterMap):
"""A [`Multi Cluster`][pyslurm.xcollections.MultiClusterMap] collection of [pyslurm.Job][] objects.

Args:
jobs (Union[list, dict], optional=None):
Expand All @@ -90,7 +88,7 @@ cdef class Jobs(list):
This is the result of multiplying the run_time with the amount of
cpus for each job.
frozen (bool):
If this is set to True and the reload() method is called, then
If this is set to True and the `reload()` method is called, then
*ONLY* Jobs that already exist in this collection will be
reloaded. New Jobs that are discovered will not be added to this
collection, but old Jobs which have already been purged from the
Expand All @@ -115,15 +113,12 @@ cdef class Job:
job_id (int):
An Integer representing a Job-ID.

Raises:
MemoryError: If malloc fails to allocate memory.

Attributes:
steps (JobSteps):
Steps this Job has.
Before you can access the Steps data for a Job, you have to call
the reload() method of a Job instance or the load_steps() method
of a Jobs collection.
the `reload()` method of a Job instance or the `load_steps()`
method of a Jobs collection.
name (str):
Name of the Job
id (int):
Expand Down
Loading