Skip to content
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
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased on the [23.2.x](https://github.com/PySlurm/pyslurm/tree/23.2.x) branch

### Added

- Ability to modify Database Jobs
- New classes to interact with the Partition API
- [pyslurm.Partition](https://pyslurm.github.io/23.2/reference/partition/#pyslurm.Partition)
- [pyslurm.Partitions](https://pyslurm.github.io/23.2/reference/partition/#pyslurm.Partitions)
- New attributes for a Database Job:
- extra
- failed_node
- Now possible to initialize a pyslurm.db.Jobs collection with existing job
ids or pyslurm.db.Job objects

### Fixed

- Fixes a problem that prevented loading specific Jobs from the Database if
the following two conditions were met:
- no start/end time was specified
- the Job was older than a day

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

### Added
Expand Down
29 changes: 9 additions & 20 deletions pyslurm/core/job/job.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ from pyslurm.utils.helpers import (
_getpwall_to_dict,
instance_to_dict,
_sum_prop,
_get_exit_code,
)


Expand Down Expand Up @@ -785,35 +786,23 @@ cdef class Job:

@property
def derived_exit_code(self):
if (self.ptr.derived_ec == slurm.NO_VAL
or not WIFEXITED(self.ptr.derived_ec)):
return None

return WEXITSTATUS(self.ptr.derived_ec)
ec, _ = _get_exit_code(self.ptr.derived_ec)
return ec

@property
def derived_exit_code_signal(self):
if (self.ptr.derived_ec == slurm.NO_VAL
or not WIFSIGNALED(self.ptr.derived_ec)):
return None

return WTERMSIG(self.ptr.derived_ec)
_, sig = _get_exit_code(self.ptr.derived_ec)
return sig

@property
def exit_code(self):
if (self.ptr.exit_code == slurm.NO_VAL
or not WIFEXITED(self.ptr.exit_code)):
return None

return WEXITSTATUS(self.ptr.exit_code)
ec, _ = _get_exit_code(self.ptr.exit_code)
return ec

@property
def exit_code_signal(self):
if (self.ptr.exit_code == slurm.NO_VAL
or not WIFSIGNALED(self.ptr.exit_code)):
return None

return WTERMSIG(self.ptr.exit_code)
_, sig = _get_exit_code(self.ptr.exit_code)
return sig

@property
def batch_constraints(self):
Expand Down
19 changes: 17 additions & 2 deletions pyslurm/db/job.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ from pyslurm.slurm cimport (
slurmdb_job_cond_def_start_end,
slurm_job_state_string,
slurm_job_reason_string,
slurmdb_create_job_rec,
slurmdb_job_modify,
)
from pyslurm.db.util cimport (
SlurmList,
Expand Down Expand Up @@ -162,8 +164,17 @@ cdef class Job:
job_id (int, optional=0):
An Integer representing a Job-ID.

Raises:
MemoryError: If malloc fails to allocate memory.
Other Parameters:
admin_comment (str):
Admin comment for the Job.
comment (str):
Comment for the Job
wckey (str):
Name of the WCKey for this Job
derived_exit_code (int):
Highest exit code of all the Job steps
extra (str):
Arbitrary string that can be stored with a Job.

Attributes:
steps (pyslurm.db.JobSteps):
Expand Down Expand Up @@ -209,10 +220,14 @@ cdef class Job:
When the Job became eligible to run, as a unix timestamp
end_time (int):
When the Job ended, as a unix timestamp
extra (str):
Arbitrary string that can be stored with a Job.
exit_code (int):
Exit code of the job script or salloc.
exit_code_signal (int):
Signal of the exit code for this Job.
failed_node (str):
Name of the failed node that caused the job to get killed.
group_id (int):
ID of the group for this Job
group_name (str):
Expand Down
Loading