Skip to content

Instantly share code, notes, and snippets.

@dgruber
Last active December 24, 2015 17: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/6837266 to your computer and use it in GitHub Desktop.
Save dgruber/6837266 to your computer and use it in GitHub Desktop.
DRMAA2 C open existing job session
long i, available = 0;
/* get a copy of the jsession names list */
drmaa2_string_list sessions = drmaa2_get_jsession_names();
drmaa2_jsession jsession;
for (i = 0; i < drmaa2_list_size(sessions); i++) {
const char* session = drmaa2_list_get(sessions, i);
if (strncmp(session, "mySession", sizeof("mySession")) == 0) {
available = 1;
break;
}
}
/* frees all entries since the list was initialized internally with
drmaa2_string_free() as callback function */
drmaa2_list_free(&sessions);
if (available) {
jsession = drmaa2_open_jsession("mySession");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment