Commit 2635bf20 authored by Manuel Günther's avatar Manuel Günther
Browse files

Corrected handling of grid ids.

parent 06e02286
...@@ -191,9 +191,9 @@ class JobManager: ...@@ -191,9 +191,9 @@ class JobManager:
self.unlock() self.unlock()
return return
array_format = "{0:>%d} {1:^%d} {2:^%d}" % lengths[:3] array_format = "{0:^%d} {1:>%d} {2:^%d} {3:^%d}" % lengths[:4]
delimiter = format.format(*['='*k for k in lengths]) delimiter = format.format(*['='*k for k in lengths])
array_delimiter = array_format.format(*["-"*k for k in lengths[:3]]) array_delimiter = array_format.format(*["-"*k for k in lengths[:4]])
header = [fields[k].center(lengths[k]) for k in range(len(lengths))] header = [fields[k].center(lengths[k]) for k in range(len(lengths))]
# print header # print header
...@@ -233,7 +233,7 @@ class JobManager: ...@@ -233,7 +233,7 @@ class JobManager:
def _write_array_jobs(array_jobs): def _write_array_jobs(array_jobs):
for array_job in array_jobs: for array_job in array_jobs:
if unfinished or array_job.status in accepted_status: if unfinished or array_job.status in accepted_status:
print("Array Job", str(array_job.unique), ":") print("Array Job", str(array_job.id), ":")
_write_contents(array_job) _write_contents(array_job)
self.lock() self.lock()
......
...@@ -57,7 +57,7 @@ class ArrayJob(Base): ...@@ -57,7 +57,7 @@ class ArrayJob(Base):
queue = self.job.queue_name if self.machine_name is None else self.machine_name queue = self.job.queue_name if self.machine_name is None else self.machine_name
status = "%s" % self.status + (" (%d)" % self.result if self.result is not None else "" ) status = "%s" % self.status + (" (%d)" % self.result if self.result is not None else "" )
return format.format(job_id, queue, status) return format.format("", job_id, queue, status)
class Job(Base): class Job(Base):
......
...@@ -160,7 +160,7 @@ def run_scheduler(args): ...@@ -160,7 +160,7 @@ def run_scheduler(args):
def list(args): def list(args):
"""Lists the jobs in the given database.""" """Lists the jobs in the given database."""
jm = setup(args) jm = setup(args)
jm.list(job_ids=get_ids(args.job_ids), print_array_jobs=args.print_array_jobs, print_dependencies=args.print_dependencies, status=args.status, long=args.verbose > 1 or args.long, ids_only=args.ids_only, names=args.names) jm.list(job_ids=get_ids(args.job_ids), print_array_jobs=args.print_array_jobs, print_dependencies=args.print_dependencies, status=args.status, long=args.long, ids_only=args.ids_only, names=args.names)
def communicate(args): def communicate(args):
......
...@@ -10,7 +10,7 @@ from __future__ import print_function ...@@ -10,7 +10,7 @@ from __future__ import print_function
from .manager import JobManager from .manager import JobManager
from .setshell import environ from .setshell import environ
from .models import add_job from .models import add_job, Job
from .tools import logger, qsub, qstat, qdel, make_shell from .tools import logger, qsub, qstat, qdel, make_shell
import os, sys import os, sys
...@@ -155,6 +155,17 @@ class JobManagerSGE(JobManager): ...@@ -155,6 +155,17 @@ class JobManagerSGE(JobManager):
self.unlock() self.unlock()
def run_job(self, job_id, array_id = None):
"""Overwrites the run-job command from the manager to extract the correct job id before calling base class implementation."""
# get the unique job id from the given grid id
self.lock()
job = self.session.query(Job).filter(Job.id == job_id)
job_id = list(job)[0].unique
self.unlock()
# call base class implementation with the corrected job id
return JobManager.run_job(self, job_id, array_id)
def stop_jobs(self, job_ids): def stop_jobs(self, job_ids):
"""Stops the jobs in the grid.""" """Stops the jobs in the grid."""
self.lock() self.lock()
......
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