1. drmaa2_msession_get_all_jobs(3)
  2. DRMAA2
  3. drmaa2_msession_get_all_jobs(3)


drmaa2_msession_get_all_jobs - drmaa2_msession_get_all_jobs, Returns all visible jobs in the system


#include "drmaa2.h"

drmaa2_j_list drmaa2_msession_get_all_jobs(const drmaa2_msession monitoring_session, const drmaa2_jinfo filter);


Returns a list of all jobs of the user currently stored in Grid Engine. The job list contains also jobs not submitted in Grid Engine. Calling this function does not necessarly trigger communication with Grid Engine master since all job related information is sent from Grid Engine master process to the DRMAA2 client as soon as there are job changes in the system. Hence it is safe to call drmaa2_msession_get_all_jobs(3) in short intervalls. The monitoring session given as argument must be valid, i.e. it must be opened with drmaa2_open_mession(3) before.

The second argument defines a filter for the jobs to be returned. If NULL is used as filter, all available jobs are returned otherwise only jobs which match the given filter. The filter is based on a drmaa2_jinfo object. After allocation with drmaa2_jinfo_create(3) all fields are UNSET, i.e. no filtering is applied. When setting fields with different values than UNSET the semantic for filtering is defined as follows:


Returns a newly allocated list of jobs in a drmaa2_j_list structure or NULL in case of an error. The job list was initialized with an appropriate callback function so that drmaa2_list_free(3) frees the complete list with all job objects inside. In case of an error the error number and error message can be fetched with drmaa2_lasterror(3) and drmaa2_lasterror_text(3).


drmaa2_jinfo filter = drmaa2_jinfo_create(); 
drmaa2_msession monitoring_session = drmaa2_open_msession(NULL);

/* filter only for jobs which consume one slot */
filter->slots = 1;

if (ms != NULL) {       
   drmaa2_j_list job_list = drmaa2_msession_get_all_jobs(monitoring_session, filter);

   if (job_list == NULL) {
      /* handle error */
      drmaa2_string error = drmaa2_lasterror_text();
      fprintf(stderr, "Error during fetching the job list from the monitoring session: %s\n", error);
   } else {
      int i;
      size_t size = drmaa2_list_size(job_list);

      fprintf(stdout, "There are %lld jobs in the system with 1 slot:\n", size); 
      for (i = 0; i < size; i++) {
          drmaa2_j job = (drmaa2_j) drmaa2_list_get(job_list, i);
          if (drmaa2_j_get_id(job) != NULL) {
             fprintf(stdout, "Job with id %s.\n", (char *) drmaa2_j_get_id(job));
          } else {
             fprintf(stdout, "Job has unknown id.\n");




drmaa2_open_msession(3), drmaa2_close_msession(3), drmaa2_msession_free(3), drmaa2_msession_get_all_jobs(3), drmaa2_msession_get_all_queues(3), drmaa2_msession_get_all_machines(3), drmaa2_list_free(3), drmaa2_jinfo_create(3), drmaa2_jinfo_free(3), drmaa2_j_get_id(3) )


Copyright Univa Corporation 2013

  1. Univa Corporation
  2. October 2013
  3. drmaa2_msession_get_all_jobs(3)