1. drmaa2_jsession_get_jobs(3)
  2. DRMAA2
  3. drmaa2_jsession_get_jobs(3)


drmaa2_jsession_get_jobs - drmaa2_jsession_get_jobs(3), Returns a list of all jobs of the job session.


#include "drmaa2.h"

drmaa2_j_list drmaa2_jsession_get_jobs(const drmaa2_jsession jsession, const drmaa2_jinfo filter);


Returns a list of jobs in a drmaa2_j_list which belong to the given job session. The job list contains only jobs which are submitted in the same job session. If the application was restarted between job submission with drmaa2_jsession_run_job(3) and the drmaa2_jession_get_jobs(3) call the list contains only jobs which are still in Univa(R) Grid Engine(TM) (meaning jobs finshed in between are not part of the job list). When a job finishes while the job session is open, the finished job is stored together with its usage in the drmaa2_jsession until the session is closed by drmaa2_close_jsession(3). Depending on the job state the drmaa2_j objects have varying information available. Freshly submitted jobs might have just a few of the fields set, while finsihed jobs have full usage information available. Array jobs are returned as single, separated jobs.

The second argument is a filter for the job list. If the filter is set to NULL all availble jobs are returned. If the filter has some UNSET entries only jobs matching the filter are returned. The filter works in the same way than for drmaa2_msession_get_all_jobs(3). For more details about job filtering please consider the drmaa2_msession_get_all_jobs(3) man page.


Returns a newly allocated list of jobs which belong to the DRMAA2 job session. The list has 0 or more entries. In case of an failure NULL is returned and the error id and error string is set for the calling thread. An appropriate callback function was set so that drmaa2_list_free(3) removes all allocated memory.


/* expecting that the session was created before and some jobs are submitted */
drmaa2_jsession js = drmaa2_open_jsession("mysession");

if (js == NULL) {
   drmaa2_string error = drmaa2_lasterror_text();
   fprintf(stderr, "Error during opening of job session with the name %s: %s\n", 
              "mysession", error);
} else {
   drmaa2_j_list jobs = drmaa2_jsession_get_jobs(js, NULL);

   if (jobs == NULL) {
      drmaa2_string error = drmaa2_lasterror_text();
      fprintf(stderr, "Error during getting job session job list: %s\n", error);
   } else {
      long size, i;

      size = drmaa2_list_size(jobs);
      for (i = 0; i < size; i++) {
         /* do something with the jobs...here we just terminate all jobs */
         drmaa2_j job = (drmaa2_j) drmaa2_list_get(jobs, i);

   /* close jsession */
   /* free jsession */


drmaa2_jtemplate_create(3), drmaa2_jsession_get_session_names(3), drmaa2_jsession_get_session_name(3), drmaa2_jsession_get_contact(3), drmaa2_jsession_get_job_array(3), drmaa2_jsession_run_job(3), drmaa2_jsession_run_bulk_jobs(3), drmaa2_jsession_wait_any_started(3), drmaa2_jsession_wait_any_terminated(3), drmaa2_open_jsession(3), drmaa2_list_get(3), drmaa2_list_size(3), drmaa2_list_free(3), drmaa2_j_terminate(3)


Copyright Univa Corporation 2013

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