Tags:
create new tag
view all tags

The Database (SQL)

drop table if exists RUNS_JMALT;
create table RUNS_JMALT ( i INT NOT NULL AUTO_INCREMENT, job INT, run_file VARCHAR(128), out_file VARCHAR(128), error_file VARCHAR(128), state INT, PRIMARY KEY(i));
create index idx_job on RUNS_JMALT(job);
create index idx_run_file on RUNS_JMALT(run_file);
create index idx_out_file on RUNS_JMALT(out_file);
create index idx_error_file on RUNS_JMALT(error_file);

Checking Script (PERL)

# This is designed to run on the cluster, wrap in a SH script with the $SGE_TASK_ID var

($job, @dummies) = @ARGV;
$dbCommand = "mysql -u<Your User Name> -hsamos -P4040 <Your Database Name> -s -e ";
chomp $job;
print "$dbCommand \"select out_file from RUNS_JMALT where state = 0 limit $job, 1;\"\n";
($out_file, @dummies) = `$dbCommand \"select out_file from RUNS_JMALT where state = 0 limit $job, 1;\"`;
($run_file, @dummies) = `$dbCommand \"select run_file from RUNS_JMALT where state = 0 limit $job, 1;\"`;
   
chomp($out_file);
print "Checking <$out_file>\n";
if(-e $out_file){
   print "CLEAN\n";
   update_status($job, 1);
}
else{
   print "MISSING\n";
   update_status($job, 0);
}
sub update_status{
   ($jobNumber, $newStatus)= @_;
   print `$dbCommand \"update RUNS_JMALT set state = $newStatus where job = $jobNumber\"\n`;   
}
Topic revision: r1 - 2007-10-31 - ErikZawadzki
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback