Commit 9bc9b929 authored by S. Lackner's avatar S. Lackner

[sched] Add more information to job output

parent 9f3a73aa
......@@ -19,6 +19,8 @@ class Job:
"""A job is a wrapper around a batsim job to extend the basic API of Pybatsim with more
object oriented approaches on the implementation of the scheduler.
:param number: the number of this job in the queue.
:param batsim_job: the batsim job object from the underlying Pybatsim scheduler.
:param scheduler: the associated scheduler managing this job.
......@@ -32,6 +34,7 @@ class Job:
def __init__(
self,
number=None,
batsim_job=None,
scheduler=None,
jobs_list=None,
......@@ -64,6 +67,8 @@ class Job:
self._comment = None
self._number = number
self._workload_description = None
self._subjobs_workload = None
......@@ -91,6 +96,11 @@ class Job:
except KeyError:
return default
@property
def number(self):
"""The number of this job (place in the queue)."""
return self._number
@property
def messages(self):
"""The buffer of incoming messages"""
......@@ -540,9 +550,9 @@ class Job:
def __str__(self):
return (
"<Job {}; sub:{} reqtime:{} res:{} prof:{} start:{} fin:{} stat:{} killreason:{} ret:{} comment:{}>"
"<Job {}; queue:{} sub:{} reqtime:{} res:{} prof:{} start:{} fin:{} stat:{} killreason:{} ret:{} comment:{}>"
.format(
self.id, self.submit_time, self.requested_time,
self.id, self.number, self.submit_time, self.requested_time,
self.requested_resources, self.profile,
self.start_time,
self.finish_time, self.state,
......
......@@ -35,6 +35,7 @@ class BaseBatsimScheduler(BatsimScheduler):
self._scheduler = scheduler
self._jobmap = {}
self._next_job_number = 0
def onSimulationBegins(self):
self._scheduler.info(
......@@ -98,10 +99,12 @@ class BaseBatsimScheduler(BatsimScheduler):
job=job,
type="job_submission_received2")
newjob = Job(
number=self._next_job_number,
batsim_job=job,
scheduler=self._scheduler,
jobs_list=self._scheduler.jobs)
self._jobmap[job.id] = newjob
self._next_job_number += 1
self._scheduler.jobs.add(newjob)
......@@ -120,8 +123,12 @@ class BaseBatsimScheduler(BatsimScheduler):
job_description.job = newjob
newjob._workload_description = workload
self._scheduler.info("Received job submission from Batsim ({job})",
job=newjob, type="job_submission_received")
self._scheduler.info(
"Received job submission from Batsim (job={job}, open_jobs_in_queue={open_jobs_in_queue})",
job=newjob,
open_jobs_in_queue=len(
self._scheduler.jobs.open),
type="job_submission_received")
self._scheduler.on_job_submission(newjob)
self._scheduler._do_schedule()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment