[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r28165 - in gnunet-planetlab/gplmt: . gplmt
From: |
gnunet |
Subject: |
[GNUnet-SVN] r28165 - in gnunet-planetlab/gplmt: . gplmt |
Date: |
Thu, 18 Jul 2013 15:40:50 +0200 |
Author: wachs
Date: 2013-07-18 15:40:50 +0200 (Thu, 18 Jul 2013)
New Revision: 28165
Modified:
gnunet-planetlab/gplmt/gplmt.py
gnunet-planetlab/gplmt/gplmt/Notifications.py
gnunet-planetlab/gplmt/gplmt/Worker.py
Log:
improvements in worker queue
Modified: gnunet-planetlab/gplmt/gplmt/Notifications.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt/Notifications.py 2013-07-18 13:36:24 UTC
(rev 28164)
+++ gnunet-planetlab/gplmt/gplmt/Notifications.py 2013-07-18 13:40:50 UTC
(rev 28165)
@@ -210,18 +210,16 @@
if (None == nodeObj):
print "Node not found!"
return
- print "Task completed" + task.name
nodeObj.tasks.append (Task (task))
return
def task_completed (self, node, task, result, message, output):
nodeObj = self.nodes.get(node)
for t in nodeObj.tasks:
if t.task is task:
- print "Task completed" + task.name
if (result != Tasklist.Taskresult.success):
t.finished (result, True, message, output)
- else:
- t.finished (result, False, message, output)
+ #else:
+ # t.finished (result, False, message, output)
return
class SimpleNotification (Notification):
@@ -243,28 +241,28 @@
return
def node_connected (self, node, success, message):
if (success == True):
- print node + " : connected successfully"
+ print node.hostname + " : connected successfully"
else:
- print node + " : connection failed: " + message
+ print node.hostname + " : connection failed: " + message
def node_disconnected (self, node, success, message):
if (success == True):
- print node + " : disconnected"
+ print node.hostname + " : disconnected"
else:
- print node + " : disconnected with failure"
+ print node.hostname + " : disconnected with failure"
def tasklist_started (self, node, tasks, message):
- print node + " : Tasklist '" + tasks.name + "' started"
+ print node.hostname + " : Tasklist '" + tasks.name + "' started"
#self.nodes.add (Node(node))
def tasklist_completed (self, node, tasks, success, message):
if (success == True):
- print node + " : Tasklist '" + tasks.name + "' completed
successfully"
+ print node.hostname + " : Tasklist '" + tasks.name + "' completed
successfully"
else:
- print node + " : Tasklist '" + tasks.name + "' completed with
failure"
+ print node.hostname + " : Tasklist '" + tasks.name + "' completed
with failure"
def task_started (self, node, task, message):
- print node + " : Task '" + task.name + "' started"
+ print node.hostname + " : Task '" + task.name + "' started"
def task_completed (self, node, task, result, message, output):
if (result == Tasklist.Taskresult.success):
- print node + " : Task '" + task.name + "' completed successfully"
+ print node.hostname + " : Task '" + task.name + "' completed
successfully"
elif (result == Tasklist.Taskresult.src_file_not_found):
- print node + " : Task '" + task.name + "' failed : source file
not found"
+ print node.hostname + " : Task '" + task.name + "' failed :
source file not found"
else:
- print node + " : Task '" + task.name + "' completed with failure"
+ print node.hostname + " : Task '" + task.name + "' completed with
failure"
Modified: gnunet-planetlab/gplmt/gplmt/Worker.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt/Worker.py 2013-07-18 13:36:24 UTC (rev
28164)
+++ gnunet-planetlab/gplmt/gplmt/Worker.py 2013-07-18 13:40:50 UTC (rev
28165)
@@ -106,6 +106,7 @@
raise NotImplementedError
def run(self):
global interrupt
+ tasklist_success = True
# Connecting
res = self.connect()
if (False == res):
@@ -115,8 +116,8 @@
g_notifications.node_connected (self.node, True, "Connected
successfully")
# Starting tasklist
- g_logger.log (self.node.hostname + " : Starting tasklist " +
self.tasks.name)
- g_notifications.tasklist_started (self.node.hostname, self.tasks, "")
+ g_logger.log (self.node.hostname + " : Starting tasklist '" +
self.tasks.name + "'")
+ g_notifications.tasklist_started (self.node, self.tasks, "")
task = self.tasks.get()
#if (interrupt):
@@ -125,32 +126,40 @@
# Executing Tasks
while (None != task and not interrupt):
g_logger.log (self.node.hostname + " : Running task id "
+str(task.id)+" '" + task.name + "'")
- g_notifications.task_started (self.node.hostname, task, "")
+ g_notifications.task_started (self.node, task, "")
if (task.type == Tasks.Operation.run):
task_result = self.exec_run (task)
assert (None != task_result)
- g_notifications.task_completed (self.node.hostname, task,
task_result.result, task_result.message, task_result.output)
+ g_notifications.task_completed (self.node, task,
task_result.result, task_result.message, task_result.output)
elif (task.type == Tasks.Operation.put):
task_result = self.exec_put (task)
assert (None != task_result)
- g_notifications.task_completed (self.node.hostname, task,
task_result, "")
+ g_notifications.task_completed (self.node, task,
task_result.result, task_result.message, task_result.output)
elif (task.type == Tasks.Operation.get):
task_result = self.exec_get (task)
assert (None != task_result)
- g_notifications.task_completed (self.node.hostname, task,
task_result, "")
+ g_notifications.task_completed (self.node, task,
task_result.result, task_result.message, task_result.output)
elif (task.type == Tasks.Operation.run_per_host):
task_result = self.exec_run_per_host (task)
assert (None != task_result)
- g_notifications.task_completed (self.node.hostname, task,
task_result, "")
+ g_notifications.task_completed (self.node, task,
task_result.result, task_result.message, task_result.output)
else:
- print "UNSUPPORTED OPERATION!"
+ print "UNSUPPORTED OPERATION!"
+ if ((task_result.result != Tasks.Taskresult.success) and
(task.stop_on_fail == True)):
+ g_logger.log (self.node.hostname + " : Task failed and
therefore execution is stopped")
+ g_notifications.task_completed (self.node.hostname, task,
task_result.result, task_result.message, task_result.output)
+ self.disconnect()
+ tasklist_success = False
+ break
task = self.tasks.get()
+
#disconnect
res = self.disconnect()
if (False == res):
g_notifications.node_disconnected (self.node, False, "Failed to
disconnect")
else:
g_notifications.node_disconnected (self.node, True, "Disconnected
successfully")
+ g_notifications.tasklist_completed (self.node, self.tasks,
tasklist_success, "")
@@ -160,16 +169,16 @@
def disconnect (self):
return True
def exec_run_per_host (self, task):
- print "Executing per host " + task.name
+ print "TestWorker executes per host '" + task.name + "'"
return TaskExecutionResult(Tasks.Taskresult.success,
"exec_run_per_host successful", "")
def exec_run (self, task):
- print "Executing " + task.name
+ print "TestWorker executes '" + task.name + "'"
return TaskExecutionResult(Tasks.Taskresult.success, "exec_run
successful", "")
def exec_put (self):
- print "Putting " + task.name
+ print "TestWorker puts " + task.name + "'"
return TaskExecutionResult(Tasks.Taskresult.success, "exec_put
successful", "")
def exec_get (self):
- print "Getting " + task.name
+ print "TestWorker puts '" + task.name + "'"
return TaskExecutionResult(Tasks.Taskresult.success, "exec_get
successful", "")
class LocalWorker (AbstractWorker):
Modified: gnunet-planetlab/gplmt/gplmt.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt.py 2013-07-18 13:36:24 UTC (rev 28164)
+++ gnunet-planetlab/gplmt/gplmt.py 2013-07-18 13:40:50 UTC (rev 28165)
@@ -85,7 +85,7 @@
# Parse command line arguments
try:
- opts, args = getopt.getopt(sys.argv[1:], "C:hvVc:n:t:ap:s:H:",
["help", "verbose", "config=", "nodes=", "tasklist=", "command=", "all",
"password", "startid", "host"])
+ opts, args = getopt.getopt(sys.argv[1:], "C:hvVc:n:l:t:ap:s:H:",
["help", "verbose", "config=", "nodes=", "tasklist=", "command=", "all",
"password", "startid", "host"])
except getopt.GetoptError, err:
# print help information and exit:
print str(err) # will print something like "option -a not
recognized"
@@ -144,22 +144,28 @@
# Load taskfile file
- if (None == command):
+ if (None != command):
+ print "Loading single command : " + str (command)
tasklist = Tasklist.Tasklist (configuration.taskfile, main.logger,
startid);
+ tasklist.load_singletask(command, main.logger)
+ elif (configuration.taskfile):
+ print "Loading task file : " + configuration.taskfile
+ tasklist = Tasklist.Tasklist (configuration.taskfile, main.logger,
startid);
if (tasklist.load() == False):
sys.exit(2)
- else:
- print "Running single command : " + str (command)
- tasklist = Tasklist.Tasklist (configuration.taskfile, main.logger,
startid);
- tasklist.load_singletask(command, main.logger)
+ else:
+ print "No tasks given!"
+ sys.exit(2)
# Check target
if ((target == undefined_target) and (tasklist.target ==
undefined_target)):
print "No target to run on defined!"
return
- if (target != undefined_target) and (tasklist.target !=
undefined_target):
- print "OVEr" + str (tasklist.target) + " " + str (target)
+ if ((target == undefined_target) and (tasklist.target !=
undefined_target)):
target = tasklist.target
+ else:
+ print "Duplicate target to run on defined, command line wins!"
+
print "Using target " + str (target)
if (target == Targets.Target (Targets.Target.planetlab)):
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r28165 - in gnunet-planetlab/gplmt: . gplmt,
gnunet <=