status                  package:nws                  R Documentation

_s_l_e_i_g_h _C_l_a_s_s _M_e_t_h_o_d

_D_e_s_c_r_i_p_t_i_o_n:

     Check status of sleigh workers and return a list that contains two
     values: numWorkers and closed. If status is zero, then some
     workers failed to start. If status is one, then either all workers
     have started or  closeGroup is set to TRUE. numWorkers indicates
     the number of workers started.

_U_s_a_g_e:

     ## S4 method for signature 'sleigh':
     status(.Object, closeGroup=FALSE, timeout=0)

_A_r_g_u_m_e_n_t_s:

 .Object: a sleigh class object

closeGroup: a boolean value indicating whether to close the worker
          group

 timeout: timeout value measure in seconds

_D_e_t_a_i_l_s:

     closeGroup is set to FALSE by default. If closeGroup is set to
     FALSE, then all workers must wait for each other to start before
     they can start working on tasks. If closeGroup is set to TRUE, no
     new workers may join the group after timeout value has expired.
     Once the group is closed, all launched workers can start working
     on tasks. 

     timeout indicates how long to wait and check on the status of
     workers.

_E_x_a_m_p_l_e_s:

     ## Not run: 
     # example 1
     # one available machine and one non-existent machine
     s <- sleigh(c('localhost', 'noname'))
     slist <- status(s)
     # slist$numWorkers = the number of worker started
     # slist$closed = whether the worker group is closed or not. 

     # example 2
     # check the status of worker group after 20 seconds
     slist <- status(s, timeout=20)

     # example 3
     # close the group after 10 seconds, regardless of whether
     # all workers have started up successfully.
     slist <- status(s, closeGroup=TRUE, timeout=10)
     ## End(Not run)

