changeset 0:54da0bd509b0

commit
author pitagora <ryota.yamanaka@riken.jp>
date Tue, 31 Mar 2015 03:21:33 +0900
parents
children 6ea5fd3cbf6a
files time.pl time.xml
diffstat 2 files changed, 50 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/time.pl	Tue Mar 31 03:21:33 2015 +0900
@@ -0,0 +1,37 @@
+use Time::Local 'timegm';
+use POSIX 'strftime';
+
+my $file = "/home/galaxy/galaxy-dist/paster.log";
+open(my $fh, "<", $file)
+  or die "Cannot open $file: $!";
+
+my %dic_sta;
+my %dic_end;
+
+while (my $line = readline $fh) {
+  if ($line =~ /([0-9]+)-([0-9]+)-([0-9]+) ([0-9]+):([0-9]+):([0-9]+),[0-9]+ \(([0-9]+)\) Job dispatched/) {
+    #print $line;
+    $sec_sta = timegm($6, $5, $4, $3, $2 - 1, $1);
+    $dic_sta{$7} = $sec_sta;
+  }
+  if ($line =~ /galaxy.jobs DEBUG ([0-9]+)-([0-9]+)-([0-9]+) ([0-9]+):([0-9]+):([0-9]+),[0-9]+ job ([0-9]+) ended/) {
+    #print $line;
+    $sec_end = timegm($6, $5, $4, $3, $2 - 1, $1);
+    $dic_end{$7} = $sec_end;
+  }
+}
+
+foreach (sort {$b<=>$a} keys %dic_sta) {
+  $time_sta = $dic_sta{$_};
+  $time_end = $dic_end{$_};
+  print "Dataset ", $_, "\t", strftime("%Y-%m-%d %H:%M:%S", localtime($time_sta)), "\t";
+  if ($time_end != "") {
+    $total = $time_end - $time_sta;
+    $hour  = int($total/60/60);
+    $min   = int(($total - $hour*60*60)/60);
+    $sec   = $total - $hour*60*60 - $min*60;
+    print strftime("%Y-%m-%d %H:%M:%S", localtime($time_end)), "\t", $hour, " hour\t", $min, " min\t", $sec,  " sec\n";
+  } else {
+    print "Running or aborted.\t-\t-\t-\n";
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/time.xml	Tue Mar 31 03:21:33 2015 +0900
@@ -0,0 +1,13 @@
+<tool id="time" name="Elapsed time" version="1.0">
+  <description>of each job</description>
+  <command interpreter="perl">
+    time.pl > $output
+  </command>
+  <inputs>
+  </inputs>
+  <outputs>
+    <data name="output" format="tabular" label="${tool.name} on ${on_string}"/>
+  </outputs>
+  <help>
+  </help>
+</tool>