-#!/usr/bin/env python3
+#!/usr/bin/env python
""" A simple tool to run jobs from a database in parallel."""
__author__ = "Stefan Huber"
exitcode = proc.wait()
if verbose:
- print(out, err)
+ print out, err
return exitcode, out, err
c.execute("SELECT cmd FROM jobs WHERE id=?", (jobid,))
cmd, = c.fetchone()
- print("Process job %d: %s" % (jobid, cmd))
-
+ print "Job %d: '%s'..." % (jobid, cmd),
ec, out, err = runCmd(cmd)
+ if ec==0:
+ print " [OK]"
+ else:
+ print " [FAILED: %d]" % ec
+
c.execute("UPDATE jobs SET exitcode=?, done=1 WHERE id=?;", (ec, jobid))
propstr = []
# Create table, if necessary
c.execute("SELECT count(name) FROM sqlite_master WHERE name='jobs';")
if c.fetchone() == (0,):
- print("Creating jobs table.")
+ print "Creating jobs table."
conn.execute("CREATE TABLE jobs ( \
id INTEGER PRIMARY KEY AUTOINCREMENT, \
cmd STRING NOT NULL, \