Skip to content

Commit

Permalink
Merge pull request #469 from omnivector-solutions/tucker/PENG-2064--a…
Browse files Browse the repository at this point in the history
…dd-slurm-job-state

PENG-2064 Capture job state info in jobbergate
  • Loading branch information
dusktreader authored Feb 8, 2024
2 parents 74049e3 + 8c967c5 commit 374204a
Show file tree
Hide file tree
Showing 34 changed files with 3,632 additions and 2,419 deletions.
2 changes: 1 addition & 1 deletion examples/simple-job-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

print("Executing simple job script")

output_file = Path(f"/nfs/simple-output.txt")
output_file = Path(f"simple-output.txt")
output_file.write_text(f"Simple output from {gethostname()}")
8 changes: 8 additions & 0 deletions examples/simple-job-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

#SBATCH -J dummy_job
#SBATCH -t 60

echo "Executing simple job script"

echo "Simple output from $HOSTNAME" > simple-output.txt
8 changes: 8 additions & 0 deletions examples/sleepy-job-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

#SBATCH -J dummy_job
#SBATCH -t 0:0:60

echo "Executing sleepy job script"
sleep 120
echo "Sleepy job script woke up"
7 changes: 6 additions & 1 deletion jobbergate-agent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
This file keeps track of all notable changes to jobbergate-core

## Unreleased

- Revamped job_submissions statuses and tracked more details slurm job_state [PENG-2064]
- Renamed the finish.py module to update.py
- Changed logic such that all active jobs have their job state updated on each pass
- Moved all logic from the api.py module to update.py and submit.py
- Updated schemas for revised job payloads
- Updated and added unit tests

## 4.3.0a6 -- 2024-02-06
## 4.3.0a5 -- 2024-02-02
Expand Down
2 changes: 1 addition & 1 deletion jobbergate-agent/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8-slim-buster
FROM python:3.12-slim-bookworm

WORKDIR /app

Expand Down
109 changes: 0 additions & 109 deletions jobbergate-agent/jobbergate_agent/jobbergate/api.py

This file was deleted.

31 changes: 4 additions & 27 deletions jobbergate-agent/jobbergate_agent/jobbergate/constants.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,8 @@
from collections import defaultdict
from enum import Enum
from typing import DefaultDict
from auto_name_enum import AutoNameEnum, auto


class FileType(str, Enum):
class FileType(AutoNameEnum):
"""File type enum."""

ENTRYPOINT = "ENTRYPOINT"
SUPPORT = "SUPPORT"


class JobSubmissionStatus(str, Enum):
"""
Enumeration of possible job_submission statuses.
"""

CREATED = "CREATED"
SUBMITTED = "SUBMITTED"
COMPLETED = "COMPLETED"
FAILED = "FAILED"
CANCELLED = "CANCELLED"
REJECTED = "REJECTED"


status_map: DefaultDict[str, JobSubmissionStatus] = defaultdict(
lambda: JobSubmissionStatus.SUBMITTED,
COMPLETED=JobSubmissionStatus.COMPLETED,
FAILED=JobSubmissionStatus.FAILED,
CANCELLED=JobSubmissionStatus.CANCELLED,
)
ENTRYPOINT = auto()
SUPPORT = auto()
68 changes: 0 additions & 68 deletions jobbergate-agent/jobbergate_agent/jobbergate/finish.py

This file was deleted.

14 changes: 5 additions & 9 deletions jobbergate-agent/jobbergate_agent/jobbergate/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pydantic

from jobbergate_agent.jobbergate.constants import FileType, JobSubmissionStatus, status_map
from jobbergate_agent.jobbergate.constants import FileType


class JobScriptFile(pydantic.BaseModel, extra=pydantic.Extra.ignore):
Expand Down Expand Up @@ -94,17 +94,13 @@ class SlurmSubmitResponse(pydantic.BaseModel, extra=pydantic.Extra.ignore):
job_id: Optional[int]


class SlurmSubmittedJobStatus(pydantic.BaseModel, extra=pydantic.Extra.ignore):
class SlurmJobData(pydantic.BaseModel, extra=pydantic.Extra.ignore):
"""
Specialized model for the cluster-agent to pull a concluded job_submission.
Specialized model for the cluster-agent to pull job state information from slurm and post the data as an update
to the Jobbergate API.
"""

job_id: Optional[int]
job_state: Optional[str]
job_info: Optional[str]
state_reason: Optional[str]

@property
def jobbergate_status(self) -> Optional[JobSubmissionStatus]:
if self.job_state:
return status_map[self.job_state]
return None
Loading

0 comments on commit 374204a

Please sign in to comment.