Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
alexboden committed Jan 17, 2025
1 parent dbbf12c commit bcd0ccf
Show file tree
Hide file tree
Showing 2 changed files with 177 additions and 73 deletions.
35 changes: 27 additions & 8 deletions RunningJob.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
from typing import List
from typing import List, Optional
from datetime import datetime

class RunningJob:
def __init__(self, job_id: int, slurm_job_id: int, workflow_name: str, job_name: str, labels: List[str]):
"""Class to represent a running Github Actions Job on Slurm."""
def __init__(
self,
job_id: int,
slurm_job_id: Optional[int],
workflow_name: str,
job_name: str,
labels: List[str],
start_time: Optional[datetime] = None
):
"""
Class to represent a running GitHub Actions Job on Slurm.
:param job_id: The GitHub Actions job ID.
:param slurm_job_id: The corresponding SLURM job ID (if allocated).
:param workflow_name: Name of the workflow that launched this job.
:param job_name: Name of this specific job.
:param labels: Labels associated with the job (e.g. 'slurm-runner-medium').
:param start_time: When the job began, if known. Defaults to None.
"""
self.job_id = job_id
self.slurm_job_id = slurm_job_id
self.workflow_name = workflow_name
self.job_name = job_name
self.labels = labels
self.start_time = start_time

def __str__(self) -> str:
return (f"RunningJob(job_id = {self.job_id}, slurm_job_id = {self.slurm_job_id}, "
f"workflow_name = {self.workflow_name}, "
f"job_name = {self.job_name}, labels = {self.labels})")
return (f"RunningJob(job_id={self.job_id}, slurm_job_id={self.slurm_job_id}, "
f"workflow_name={self.workflow_name}, job_name={self.job_name}, "
f"labels={self.labels}, start_time={self.start_time})")

def __repr__(self) -> str:
return self.__str__()
return self.__str__()
Loading

0 comments on commit bcd0ccf

Please sign in to comment.