diff options
-rw-r--r-- | steuermann/db.sql | 4 | ||||
-rw-r--r-- | steuermann/report.py | 8 | ||||
-rw-r--r-- | steuermann/run_all.py | 42 |
3 files changed, 48 insertions, 6 deletions
diff --git a/steuermann/db.sql b/steuermann/db.sql index 99bc752..bc35f62 100644 --- a/steuermann/db.sql +++ b/steuermann/db.sql @@ -2,7 +2,7 @@ -- Before we start running anything, we insert a record for every -- command in the test run. The initial status is 'S'. -CREATE TABLE sm_status ( +CREATE TABLE sm_status ( run VARCHAR(100), -- name of this run @@ -33,6 +33,8 @@ CREATE TABLE sm_status ( notes VARCHAR(1000), -- notes reported by the script + logs INTEGER, + FOREIGN KEY(run) REFERENCES runs(run) -- run name has to be in the run table ); diff --git a/steuermann/report.py b/steuermann/report.py index 97dda29..17ccd6d 100644 --- a/steuermann/report.py +++ b/steuermann/report.py @@ -32,12 +32,12 @@ simple_status = ( 'N', 'P', 'S', 'W' ) def info_callback_gui( db, run, tablename, host, cmd ) : c = db.cursor() - c.execute("SELECT status, start_time, end_time FROM sm_status WHERE run = ? AND host = ? AND tablename = ? AND cmd = ?",( + c.execute("SELECT status, start_time, end_time, logs FROM sm_status WHERE run = ? AND host = ? AND tablename = ? AND cmd = ?",( run, host, tablename, cmd ) ) x = c.fetchone() if x is None : return '' - status, start_time, end_time = x + status, start_time, end_time, logs_exist = x if start_time is None : start_time = '' if end_time is None : @@ -71,6 +71,10 @@ def info_callback_gui( db, run, tablename, host, cmd ) : link = link + " : " + st + " - " + et # h_result = '%s %s %s %s'%(link, d_status, start_time, end_time) + + if logs_exist: + link += '<BR/>LINK' + h_result = link return ( t_result, h_result ) diff --git a/steuermann/run_all.py b/steuermann/run_all.py index c3ed796..d61f10d 100644 --- a/steuermann/run_all.py +++ b/steuermann/run_all.py @@ -32,8 +32,8 @@ username=getpass.getuser() def main() : global xnodes global no_run + # read all the input files - if readline : history = os.path.join(os.path.expanduser("~"), ".steuermann_history") try : @@ -491,8 +491,44 @@ def run_step( runner, xnodes, run_name, db ) : # note who and log it x_host, x_table, x_cmd = nodes.crack_name(who_exited[0]) - db.execute("UPDATE sm_status SET end_time = ?, status = ? WHERE ( run = ? AND host = ? AND tablename = ? AND cmd = ? )", - ( str(datetime.datetime.now()), who_exited[1], run_name, x_host, x_table, x_cmd ) ) + logs_exist = 0 + + args = runner.get_host_info(x_host) + workdir = args['workdir'] + hostname = args['hostname'] + + src = os.path.join(workdir, run_name, who_exited[0]) + dst = os.path.join(steuermann.config.host_logs, run_name, who_exited[0]) + + ''' + print + print "host " + hostname + print "workdir " + workdir + print src + print dst + print + ''' + + try: + os.system('mkdir -p %s' %os.path.dirname(dst)) + except: + print 'mkdir -p %s failed' %os.path.dirname(dst) + try: + os.system('scp -r %s:%s %s' %(hostname, src, dst)) + except: + print 'scp failed' + + + if not os.path.exists(dst): + print 'WARNING - %s does not exist' %dst + else: + print os.listdir(dst) + if len(os.listdir(dst)) > 0: + logs_exist = 1 + print 'FOUND SOME LOGS' + + db.execute("UPDATE sm_status SET end_time = ?, status = ?, logs = ? WHERE ( run = ? AND host = ? AND tablename = ? AND cmd = ? )", + ( str(datetime.datetime.now()), who_exited[1], logs_exist, run_name, x_host, x_table, x_cmd ) ) db.commit() # runner.display_procs() |