Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit 4bb7c5d5 authored by MOMMESSIN Clement's avatar MOMMESSIN Clement
Browse files

Split execute_job and execute_jobs functions

parent 7c6e68e1
......@@ -137,36 +137,48 @@ class Batsim(object):
)
self.nb_jobs_scheduled += 1
def execute_jobs(self, jobs, io_jobs=None):
""" args:jobs: list of jobs to execute
job.allocation MUST be not None and should be a non-empty ProcSet"""
for job in jobs:
assert job.allocation is not None
message = {
"timestamp": self.time(),
"type": "EXECUTE_JOB",
"data": {
"job_id": job.id,
"alloc": str(job.allocation)
}
def execute_job(self, job, io_job = None):
""" ergs.job: Job to execute
job.allocation MUST be not None and should be a non-empty ProcSet
"""
assert job.allocation is not None
message = {
"timestamp": self.time(),
"type": "EXECUTE_JOB",
"data": {
"job_id": job.id,
"alloc": str(job.allocation)
}
if io_jobs is not None and job.id in io_jobs:
message["data"]["additional_io_job"] = io_jobs[job.id]
}
if hasattr(job, "mapping"):
message["data"]["mapping"] = job.mapping
self.jobs[job.id].mapping = job.mapping
self.jobs[job.id].allocation = job.allocation
self.jobs[job.id].state = Job.State.RUNNING
if hasattr(job, "storage_mapping"):
message["data"]["storage_mapping"] = job.storage_mapping
self.jobs[job.id].storage_mapping = job.storage_mapping
if io_job is not None:
message["data"]["additional_io_job"] = io_job
self.jobs[job.id].allocation = job.allocation
if hasattr(job, "mapping"):
message["data"]["mapping"] = job.mapping
self.jobs[job.id].mapping = job.mapping
self._events_to_send.append(message)
self.nb_jobs_scheduled += 1
if hasattr(job, "storage_mapping"):
message["data"]["storage_mapping"] = job.storage_mapping
self.jobs[job.id].storage_mapping = job.storage_mapping
self.jobs[job.id].allocation = job.allocation
self._events_to_send.append(message)
self.nb_jobs_scheduled += 1
def execute_jobs(self, jobs, io_jobs=None):
""" args:jobs: list of jobs to execute
job.allocation MUST be not None and should be a non-empty ProcSet
"""
for job in jobs:
if io_jobs is not None:
self.execute_job(job, io_jobs[job.id])
else:
self.execute_job(job)
def reject_jobs(self, jobs):
"""Reject the given jobs."""
......
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