Changeset 96 for trunk/oarutils


Ignore:
Timestamp:
Jan 26, 2013, 10:58:11 AM (11 years ago)
Author:
g7moreau
Message:
  • Change sleep function (do not work) with manual timer
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/oarutils/oar-dispatch

    r95 r96  
    1010use Coro::Signal;
    1111use Coro::Semaphore;
    12 use Coro::Timer qw(sleep);
     12use Coro::AnyEvent;
    1313use Coro::Handle;
    1414use IO::File;
     
    206206         }
    207207      cede;
    208      
     208
    209209      # asynchrone guard for job end
    210210      async {
    211          my $job_id = shift;
     211         my $timer;
    212212         GUARD:
    213213         while () {
    214             sleep 15; # async, do not re-launch oarstat to fast
     214            cede;
     215            $timer = AE::now + 5;
     216            while ( AE::now < $timer ) { AE::now_update; cede; }
    215217            my $is_finish = `oarstat -s -j $job_id`;
    216218            chomp $is_finish;
     
    231233         $job_todo->down;
    232234         delete $scheduled{$job_id};
    233          } $job_id;
     235         }
    234236      }
    235237   };
Note: See TracChangeset for help on using the changeset viewer.