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

Corrected handling of grid ids.

parent 06e02286
......@@ -191,9 +191,9 @@ class JobManager:
self.unlock()
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])
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))]
# print header
......@@ -233,7 +233,7 @@ class JobManager:
def _write_array_jobs(array_jobs):
for array_job in array_jobs:
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)
self.lock()
......
......@@ -57,7 +57,7 @@ class ArrayJob(Base):
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 "" )
return format.format(job_id, queue, status)
return format.format("", job_id, queue, status)
class Job(Base):
......
......@@ -160,7 +160,7 @@ def run_scheduler(args):
def list(args):
"""Lists the jobs in the given database."""
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):
......
......@@ -10,7 +10,7 @@ from __future__ import print_function
from .manager import JobManager
from .setshell import environ
from .models import add_job
from .models import add_job, Job
from .tools import logger, qsub, qstat, qdel, make_shell
import os, sys
......@@ -155,6 +155,17 @@ class JobManagerSGE(JobManager):
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):
"""Stops the jobs in the grid."""
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