Changeset 40
- Timestamp:
- Dec 5, 2011, 11:19:27 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/oarutils/oar-parexec
r39 r40 43 43 my $log_h = IO::File->new(); 44 44 if (-e $logfile) { 45 46 45 $log_h->open("< $logfile") 46 or die "can't read log file: $!"; 47 47 while (<$log_h>) { 48 $state{$1} = 'start' if m/^start\s job\s(\d+)/;49 $state{$1} = 'end' if m/^end\s job\s(\d+)/;48 $state{$1} = 'start' if m/^start\s+job\s+(\d+)\s/; 49 $state{$1} = 'end' if m/^end\s+job\s+(\d+)\s/; 50 50 } 51 51 $log_h->close(); … … 53 53 if ($logfile) { 54 54 $log_h->open(">> $logfile") 55 or die "can't open log file: $!"; 55 or die "can't append log file $logfile: $!"; 56 $log_h->autoflush; 56 57 $log_h = unblock $log_h; 57 58 } 58 59 59 60 my @job = (); 60 open( JOB_LIST, '<', "$file" ) or die "can't open $file: $!";61 open( JOB_LIST, '<', "$file" ) or die "can't open job file $file: $!"; 61 62 while (<JOB_LIST>) { 62 63 chomp; … … 110 111 for my $job (@job) { 111 112 $job_num++; 112 if (exists $state{$job_num} and $state{$job_num} eq 'end') { 113 delete $state{$job_num}; 114 cede; 115 next; 116 } 117 if (exists $state{$job_num} and $state{$job_num} eq 'start') { 118 print "warning: job $job_num was not finished, relaunching...\n" if $verbose; 119 } 113 114 if (exists $state{$job_num}) { 115 if ($state{$job_num} eq 'start') { 116 print "warning: job $job_num was not finished, relaunching...\n" if $verbose; 117 } 118 elsif ($state{$job_num} eq 'end') { 119 delete $state{$job_num}; 120 $job_todo->down; 121 print "warning: job $job_num already done\n" if $verbose; 122 cede; 123 next; 124 } 125 } 120 126 121 127 my $job_ressource = $ressources->get; 122 128 123 last if $oar_checkpoint->count> 0;129 last if $oar_checkpoint->count() > 0; 124 130 125 131 my ($node_connect) = split ',', $job_ressource; … … 166 172 for my $job_pid ( keys %scheduled ) { 167 173 if ( waitpid( $job_pid, WNOHANG ) ) { 168 $log_h->printf("end job %5i at %s\n", $job_num, time) if $logfile; 174 $log_h->printf("end job %5i at %s\n", 175 $scheduled{$job_pid}->{num}, 176 time) if $logfile; 169 177 printf "end job %5i / %5i at %s on node %s\n", 170 178 $scheduled{$job_pid}->{num}, … … 180 188 } 181 189 182 $finished->sendif $oar_checkpoint->count > 0 and keys(%scheduled) == 0;190 $finished->send if $oar_checkpoint->count > 0 and keys(%scheduled) == 0; 183 191 184 192 $finished->send if $job_todo->count == 0; … … 191 199 $finished->wait; 192 200 193 $log_h->close if $logfile; 201 $log_h->close() if $logfile; 202 194 203 195 204 __END__
Note: See TracChangeset
for help on using the changeset viewer.