Skip to content

Instantly share code, notes, and snippets.

@dgruber
Last active December 24, 2015 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgruber/6830157 to your computer and use it in GitHub Desktop.
Save dgruber/6830157 to your computer and use it in GitHub Desktop.
DRMAA2 job session creation and destruction in C
/* creates and implicitly opens the newly created job session */
drmaa2_jsession js = drmaa2_create_jsession("user123_job_session", NULL);
/* if the return value is NULL an error happend */
if (js == NULL) {
/* the error text is stored in the threads context, for reading
it out the following function can be used */
drmaa2_string error = drmaa2_lasterror_text();
printf("Could not create jsession. %s\n", error);
/* the newly allocated string must be freed by the caller */
drmaa2_string_free(&error);
return 1;
}
/* TODO here jobs can be submitted, controlled and monitored
using the js object */
...
/* finally the job session needs to be closed, i.e. the connection
to the qmaster is disengaged */
drmaa2_close_jsession(js);
/* the job session object needs to be freed - it will be set to NULL as well */
drmaa2_jsession_free(&js);
/* finally the job session needs to be destroyed on the qmaster */
drmaa2_destroy_jsession("user123_job_session");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment