From a05f793ce3b3fb8f938ea581f51eadf9c4dcdae1 Mon Sep 17 00:00:00 2001 From: "Krzysztof A. Adamski" Date: Sun, 22 Jun 2008 12:02:44 -0400 Subject: Change job_id from double to string. Use pprint to get better precision. --- func/jobthing.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/func/jobthing.py b/func/jobthing.py index a190dff..c6c616a 100644 --- a/func/jobthing.py +++ b/func/jobthing.py @@ -23,6 +23,7 @@ import sys import fcntl import forkbomb import utils +import pprint JOB_ID_RUNNING = 0 JOB_ID_FINISHED = 1 @@ -110,7 +111,7 @@ def batch_run(pool, callback, nforks): operation will be created in cachedir and subsequently deleted. """ - job_id = time.time() + job_id = pprint.pformat(time.time()) pid = os.fork() if pid != 0: __update_status(job_id, JOB_ID_RUNNING, -1) @@ -132,7 +133,7 @@ def minion_async_run(retriever, method, args): # minion jobs contain the string "minion". - job_id = "%s-minion" % time.time() + job_id = "%s-minion" % pprint.pformat(time.time()) __update_status(job_id, JOB_ID_RUNNING, -1) pid = os.fork() if pid != 0: -- cgit From 4c8980b5d750f3ea2f71170bc7e1f072dd01d5cd Mon Sep 17 00:00:00 2001 From: "Krzysztof A. Adamski" Date: Sun, 22 Jun 2008 13:24:46 -0400 Subject: Eliminate concurency between parent and child in batch_run(). --- func/jobthing.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/func/jobthing.py b/func/jobthing.py index c6c616a..be23cc9 100644 --- a/func/jobthing.py +++ b/func/jobthing.py @@ -112,13 +112,12 @@ def batch_run(pool, callback, nforks): """ job_id = pprint.pformat(time.time()) + __update_status(job_id, JOB_ID_RUNNING, -1) pid = os.fork() if pid != 0: - __update_status(job_id, JOB_ID_RUNNING, -1) return job_id else: # kick off the job - __update_status(job_id, JOB_ID_RUNNING, -1) results = forkbomb.batch_run(pool, callback, nforks) # we now have a list of job id's for each minion, kill the task -- cgit From cbe2d1ef15a2d61ccad30f0f8aa742c2bc46bf9e Mon Sep 17 00:00:00 2001 From: "Krzysztof A. Adamski" Date: Thu, 26 Jun 2008 06:57:56 -0400 Subject: Fix options.async and options.forks problem. --- func/overlord/base_command.py | 6 ++++-- func/overlord/cmd_modules/call.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/func/overlord/base_command.py b/func/overlord/base_command.py index 8f16eca..f7c33c0 100644 --- a/func/overlord/base_command.py +++ b/func/overlord/base_command.py @@ -23,11 +23,13 @@ class BaseCommand(command.Command): interactive = False verbose=0 port=DEFAULT_PORT + async=False + forks=1 def getOverlord(self): self.overlord_obj = client.Overlord(self.server_spec, port=self.port, interactive=self.interactive, verbose=self.verbose, config=self.config, - async=self.options.async, - nforks=self.options.forks) + async=self.async, + nforks=self.forks) diff --git a/func/overlord/cmd_modules/call.py b/func/overlord/cmd_modules/call.py index bb9a61e..53db70e 100644 --- a/func/overlord/cmd_modules/call.py +++ b/func/overlord/cmd_modules/call.py @@ -122,6 +122,8 @@ class Call(base_command.BaseCommand): self.interactive = False + self.async = self.options.async + self.forks = self.options.forks self.server_spec = self.parentCommand.server_spec self.getOverlord() -- cgit