Logo Search packages:      
Sourcecode: pbs-drmaa version File versions

int drmaa_wait ( const char *  job_id,
char *  job_id_out,
size_t  job_id_out_len,
int *  stat,
signed long  timeout,
drmaa_attr_values_t **  rusage,
char *  error_diagnosis,
size_t  error_diag_len 

The drmaa_wait() function SHALL wait for a job identified by job_id to finish execution or fail. If the special string, JOB_IDS_SESSION_ANY, is provided as the job_id, this function will wait for any job from the session to finish execution or fail. In this case, any job for which exit status information is available will satisfy the requirement, including jobs which preivously finished but have never been the subject of a drmaa_wait() call. This routine is modeled on the wait3 POSIX routine.

The timeout parameter value indicates how many seconds to remain blocked in this call waiting for a result, before returning with a DRMAA_ERRNO_EXIT_TIMEOUT error code. The value, DRMAA_TIMEOUT_WAIT_FOREVER, MAY be specified to wait indefinitely for a result. The value, DRMAA_TIMEOUT_NO_WAIT, MAY be specified to return immediately with a DRMAA_ERRNO_EXIT_TIMEOUT error code if no result is available. If the call exits before the timeout has elapsed, the job has been successfully waited on or there was an interrupt. The caller should check system time before and after this call in order to be sure of how much time has passed.

Upon success, drmaa_wait() fills job_id_out with up to job_id_out_len characters of the waited job's id, stat with the a code that includes information about the conditions under which the job terminated, and rusage with an array of <name>=

strings that describe the amount of resources consumed by the job and are implementation defined. The stat parameter is further described below. The rusage parameter's values may be accessed via drmaa_get_next_attr_value().

The drmaa_wait() function reaps job data records on a successful call, so any subsequent calls to drmaa_wait() will fail, returning a DRMAA_ERRNO_INVALID_JOB error code, meaning that the job's data record has already been reaped. This error code is the same as if the job were unknown. If drmaa_wait() exists due to a timeout, DRMAA_ERRNO_EXIT_TIMEOUT is returned and no rusage information is reaped. (The only case where drmaa_wait() can be successfully called on a single job more than once is when the previous call(s) to drmaa_wait() returned DRMAA_ERRNO_EXIT_TIMEOUT.)

The stat parameter, set by a successful call to drmaa_wait(), is used to retrieve further input about the exit condition of the waited job, identified by job_id_out, through the following functions: drmaa_wifexited(), drmaa_wexitstatus(), drmaa_wifsignaled(), drmaa_wtermsig(),drmaa_wcoredump() and drmaa_wifaborted().

Definition at line 498 of file drmaa_base.c.

References fsd_drmaa_session_get(), and fsd_free().

      fsd_drmaa_session_t *volatile session = NULL;
      struct timespec ts;
      char *result_job_id = NULL;

      fsd_log_enter(( "(job_id=%s, timeout=%ld)", job_id, timeout ));

            session = fsd_drmaa_session_get();
            result_job_id = session->wait(
                        session, job_id, drmaa_timeout_time(timeout, &ts),
                        stat, (fsd_iter_t**)rusage
            strlcpy( job_id_out, result_job_id, job_id_out_len );
            fsd_free( result_job_id );
            if( session )
                  session->release( session );

      fsd_log_return(( " =0: job_id=%s", job_id_out ));

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index