[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r28185 - gnunet-planetlab/gplmt/gplmt
From: |
gnunet |
Subject: |
[GNUnet-SVN] r28185 - gnunet-planetlab/gplmt/gplmt |
Date: |
Fri, 19 Jul 2013 10:59:17 +0200 |
Author: wachs
Date: 2013-07-19 10:59:17 +0200 (Fri, 19 Jul 2013)
New Revision: 28185
Modified:
gnunet-planetlab/gplmt/gplmt/Worker.py
Log:
implemented run per host
Modified: gnunet-planetlab/gplmt/gplmt/Worker.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt/Worker.py 2013-07-19 08:39:48 UTC (rev
28184)
+++ gnunet-planetlab/gplmt/gplmt/Worker.py 2013-07-19 08:59:17 UTC (rev
28185)
@@ -305,7 +305,37 @@
self.ssh.close()
return TaskExecutionResult (Tasks.Taskresult.success, "", "")
def exec_run_per_host (self, task):
- raise NotImplementedError (inspect.stack()[0][3])
+ found = False
+ default = None
+ cmd = None
+ try:
+ f = open(task.command_file, 'r')
+ for line in f:
+ if (line[0] == '#'):
+ continue;
+ sline = line.split (';',2)
+ if (sline[0] == self.node.hostname):
+ cmd = sline[1].strip()
+ found = True
+ if (sline[0] == ''):
+ default = sline[1].strip()
+ f.close()
+ except IOError as e:
+ return TaskExecutionResult (Tasks.Taskresult.fail, "Cannot open
command file '" +task.command_file+ "' : " + str(e), "")
+ pass
+ t = task.copy()
+ if (found == True):
+ g_logger.log (self.node.hostname + " : Found specific command '"+
cmd + "'")
+ t.command = cmd
+ t.arguments = ""
+ elif ((found == False) and (default != None)):
+ g_logger.log (self.node.hostname + " : Using default command '"+
default + "'")
+ t.command = default
+ t.arguments = ""
+ else:
+ g_logger.log (self.node.hostname + " : Task '"+ task.name + "'
failed: no command to execute")
+ return TaskExecutionResult (Tasks.Taskresult.fail, "no command to
execute", "")
+ return self.exec_run (t)
def exec_run (self, task):
global interrupt
message = "undefined"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r28185 - gnunet-planetlab/gplmt/gplmt,
gnunet <=