Changeset fdbba6d01c088f2248591d4df8b5792bc62525ab in xas-supervisor


Ignore:
Timestamp:
12/04/15 14:13:32 (4 years ago)
Author:
Kevin L. Esteb <kevin@…>
Branches:
master
Children:
c381f17e441575b3b3c05fcc82b1b0687bc0264a
Parents:
46cd4240670ef645a4b78521eabbc2c10aae9891
git-author:
Kevin L. Esteb <kevin@…> (12/04/15 14:13:32)
git-committer:
Kevin L. Esteb <kevin@…> (12/04/15 14:13:32)
Message:

supervisor is working

Location:
trunk/lib/XAS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/XAS/Msgs/Supervisor.msg

    re941b3b70118b141c0535180df00742d2c121c6f rfdbba6d01c088f2248591d4df8b5792bc62525ab  
    1111supervisor_status   = %s is currently "%s" 
    1212supervisor_nostatus = unable to determine status for %s 
    13  
     13supervisor_list     = the following processes are known: %s 
  • trunk/lib/XAS/Supervisor/Controller.pm

    r46cd4240670ef645a4b78521eabbc2c10aae9891 rfdbba6d01c088f2248591d4df8b5792bc62525ab  
    1010  base      => 'XAS::Lib::Net::Server', 
    1111  mixin     => 'XAS::Lib::Mixins::JSON::Server', 
    12   utils     => ':validation', 
     12  utils     => ':validation stat2text', 
    1313  constants => ':process :jsonrpc HASHREF', 
    1414  vars => { 
     
    4040    $poe_kernel->state('resume_process', $self, '_resume_process'); 
    4141    $poe_kernel->state('check_status',   $self, '_check_status'); 
     42    $poe_kernel->state('list_processes', $self, '_list_processes'); 
    4243 
    4344    # walk the chain 
     
    137138 
    138139        my $stat     = $process->stat_process(); 
    139         my $status   = $self->_convert_stat($stat); 
     140        my $status   = stat2text($stat); 
    140141        my $response = $self->message('supervisor_status', $name, $status); 
    141142 
     
    295296} 
    296297 
     298sub _list_processes { 
     299    my $self = $_[OBJECT]; 
     300    my ($params, $ctx) = validate_params(\@_[ARG0,ARG1], [ 
     301        { type => HASHREF }, 
     302        { type => HASHREF }, 
     303    ]); 
     304 
     305    my $alias = $self->alias; 
     306    my $list = join(',', sort(keys($self->processes))); 
     307    my $response = $self->message('supervisor_list', $list); 
     308 
     309    $self->process_response($response, $ctx); 
     310 
     311} 
     312 
    297313# ---------------------------------------------------------------------- 
    298314# Private Methods 
    299315# ---------------------------------------------------------------------- 
    300  
    301 sub _convert_stat { 
    302     my $self = shift; 
    303     my $stat = shift; 
    304  
    305     my $status = 'unknown'; 
    306  
    307     $status = 'suspended ready'   if ($stat == 6); 
    308     $status = 'suspended blocked' if ($stat == 5); 
    309     $status = 'blocked'           if ($stat == 4); 
    310     $status = 'running'           if ($stat == 3); 
    311     $status = 'ready'             if ($stat == 2); 
    312     $status = 'other'             if ($stat == 1); 
    313  
    314     return $status; 
    315  
    316 } 
    317316 
    318317sub init { 
     
    327326        'kill_process', 
    328327        'pause_process', 
    329         'resume_process' 
     328        'resume_process', 
     329        'list_processes', 
    330330    ]; 
    331331 
Note: See TracChangeset for help on using the changeset viewer.