Skip to content
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

Add prometheus #23

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
37 changes: 29 additions & 8 deletions RunningJob.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
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,
machine_name: Optional[str] = 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
self.machine_name = machine_name

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}), machine_name={self.machine_name}")

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