Skip to content
This repository has been archived by the owner on Apr 16, 2019. It is now read-only.

Commit

Permalink
We are now printing output of the job on the console
Browse files Browse the repository at this point in the history
Added output method to job class
  • Loading branch information
Nikhil Singh committed Feb 23, 2012
1 parent 1d572e3 commit 714b39e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
9 changes: 8 additions & 1 deletion job.py
Expand Up @@ -134,7 +134,7 @@ def poll(self):
else:
self._rcs[unique] = 3

self._output[unique] = output["output"]
self._output[unique] = (output["host"], output["output"])


def success(self):
Expand All @@ -154,3 +154,10 @@ def success(self):
return True
else:
return False


def output(self):
# Pretty print the output
print "Job id: " + self._job_id
for gmjobid, output in self._output.items():
print "Output for host: " + output[0] + "\n" + output[1]
3 changes: 2 additions & 1 deletion roadrunner.py
Expand Up @@ -61,8 +61,10 @@ def subprocess_wrapper(j):
j.poll()
if j.success():
l.debug("Job: " + j._job_id + " executed successfully!")
j.output()
else:
l.error("Job: " + j._job_id + " failed!")
j.output()
sys.exit(1)


Expand All @@ -71,7 +73,6 @@ def subprocess_wrapper(j):
#
def run_jobs(job_flow_config):
# Mandatory fields required in a job flow config
output_plugin = get_dict_val('output_plugin', job_flow_config, True)
flow = get_dict_val('job_flow', job_flow_config, True)
default_timeout = get_dict_val('default_job_timeout', job_flow_config, True)
default_retries = get_dict_val('default_retries', job_flow_config, True)
Expand Down
2 changes: 1 addition & 1 deletion worker.py
Expand Up @@ -37,7 +37,7 @@ def exe_job(worker, job):

retries = retries - 1

return json.dumps({ "rc": rc, "output": output })
return json.dumps({ "rc": rc, "output": output, "host": d['host'] })


#
Expand Down

0 comments on commit 714b39e

Please sign in to comment.