Commit bab11e31 authored by André Anjos's avatar André Anjos 💬
Browse files

More bug fixes; Better printout

parent a495715e
......@@ -15,12 +15,13 @@ named `.jobmanager.db`) is read or written so it preserves its state during
decoupled calls. The database contains all informations about jobs that is
required for the Job Manager to:
* submit jobs (includes wrapped jobs or Torch5spro specific jobs)
* submit jobs (includes wrapped python jobs or Torch5spro specific jobs)
* probe for submitted jobs
* query SGE for submitted jobs
* identify problems with submitted jobs
* cleanup logs from submitted jobs
* easily re-submit jobs if problems occur
* support for parametric (array) jobs
Many of these features are also achieveable using the stock SGE utilities, the
Job Manager only makes it dead simple.
......@@ -48,6 +49,14 @@ and consider all remaining arguments as part of the command to be submitted.
way to submit a job using the Job Manager. You can use either `submit` or
`wrapper`. Read the full help message of `jman` for details and instructions.
Submitting a parametric job
.. code-block:: sh
$ jman torch -t 1-5:2 -- --help
Submitted (torch'd) 6151645 @all.q (0 seconds ago) -S /usr/bin/python /idiap/group/torch5spro/nightlies/last/bin/ -- --help
Probing for jobs
......@@ -26,7 +26,7 @@ querying SGE. Here is quick example on how to use the `gridtk` framework:
# For more options look do help(gridtk.qsub)
job = man.submit(command, cwd=True, stdout='logs', name='testjob')
You can do, programatically, everything you can do with the job manager just
You can do, programatically, everything you can do with the job manager - just
browse the help messages and the `jman` script for more information.
.. note::
......@@ -243,12 +243,12 @@ class Job:
return "%s @%s (%s ago) %s" % (,
self.queue(), self.age(short=False), ' '.join(self.args[0]))
def row(self, fmt):
def row(self, fmt, maxcmd=0):
"""Returns a string containing the job description suitable for a table."""
cmdline = ' '.join(self.args[0])
if len(cmdline) > fmt[-1]:
cmdline = cmdline[:(fmt[-1]-3)] + '...'
if maxcmd and len(cmdline) > maxcmd:
cmdline = cmdline[:(maxcmd-3)] + '...'
return fmt % (, self.queue(), self.age(), cmdline)
......@@ -349,9 +349,14 @@ class JobManager:
def __str__(self):
"""Returns the status of each job still being tracked"""
return self.table(43)
def table(self, maxcmdline=0):
"""Returns the status of each job still being tracked"""
# configuration
fields = ("job-id", "queue", "age", "arguments")
lengths = (16, 5, 3, 47)
lengths = (20, 5, 3, 43)
marker = '='
# work
......@@ -361,7 +366,7 @@ class JobManager:
header = ' '.join(header)
return '\n'.join([header] + [delimiter] + \
[self[k].row(fmt) for k in self.job])
[self[k].row(fmt, maxcmdline) for k in self.job])
def clear(self):
"""Clear the whole job queue"""
......@@ -41,7 +41,8 @@ def ls(args):
"""List action"""
jm = setup(args)
print jm
if args.verbose: print jm.table(0)
else: print jm
def save_jobs(j, name):
"""Saves jobs in a database"""
Supports Markdown
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