Changeset 97 for trunk/oarutils
- Timestamp:
- Jan 26, 2013, 11:06:54 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/oarutils/oar-dispatch
r96 r97 24 24 my $sig_transmit; 25 25 my $sig_checkpoint = 'USR2'; 26 my $brake = 5; # five second time brake 26 27 27 28 Getopt::Long::GetOptions( … … 36 37 'transmit' => \$sig_transmit, 37 38 'kill=s' => \$sig_checkpoint, 39 'brake=i' => \$brake, 38 40 ) || pod2usage(-verbose => 0); 39 41 pod2usage(-verbose => 2) if $help; … … 213 215 while () { 214 216 cede; 215 $timer = AE::now + 5; 216 while ( AE::now < $timer ) { AE::now_update; cede; } 217 218 # wait to not re-launch oarstat to fast 219 # equivalent to sleep $brake 220 $timer = AE::now + $brake; 221 while ( AE::now < $timer ) { 222 # force update of AE time 223 AE::now_update; 224 cede; 225 } 226 217 227 my $is_finish = `oarstat -s -j $job_id`; 218 228 chomp $is_finish; … … 223 233 $scheduled{$job_id}->{name}, $job_id, time; 224 234 225 226 227 228 229 230 235 # Job non finish, just suspend if received checkpoint signal 236 $msg =~ s/^end\s+job/suspend job/ 237 if $sig_transmit and $oar_checkpoint->count() > 0; 238 239 $log_h->print($msg) if $logtrace; 240 print($msg) if $verbose; 231 241 232 242 $job_active->down; … … 235 245 } 236 246 } 237 } ;247 } 238 248 239 249 async { 240 250 while () { 241 # for my $job_id (keys %scheduled) {242 # my $is_finish = `oarstat -s -j $job_id`;243 # chomp $is_finish;244 # if ($is_finish =~ m/Terminated/) {245 # delete $scheduled{$job_id};246 # $job_active->down;247 # $job_todo->down;248 # }249 # cede;250 # }251 252 251 # checkpointing ! just finishing running job and quit 253 252 $finished->send if $oar_checkpoint->count() > 0 and scalar(keys(%scheduled)) == 0; … … 256 255 cede; 257 256 } 258 } ;257 } 259 258 260 259 cede;
Note: See TracChangeset
for help on using the changeset viewer.