...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
... ... ... drmaa2_jtemplate jt = drmaa2_jtemplate_create(); /* job template object */ drmaa2_rtemplate rt = drmaa2_rtemplate_create(); /* reservation template object */ drmaa2_string_list cl = drmaa2_list_create(DRMAA2_STRINGLIST, NULL); / *create list of strings */ drmaa2_dict env = drmaa2_dict_create(NULL); /* create a dictionary */ drmaa2_jsession js = drmaa2_create_jsession("myjsession", NULL); /* open sessions to DRM system */ if (js == NULL) { ... ... return; } drmaa2_rsession rs = drmaa2_create_rsession("myrsession", NULL); /* create a reservation session */ if (rs == NULL) { ... ... return; } drmaa2_msession ms = drmaa2_open_msession(NULL); /*create and open monitoring session */ ml = drmaa2_msession_get_all_machines(ms, DRMAA2_UNSET_LIST); /* determine name of first machine */ if (drmaa2_list_size(ml) < 1) { ... return; } m = (drmaa2_machineinfo)drmaa2_list_get(ml, 0); drmaa2_list_add(cl, m->name); rt->maxSlots = 4; /* perform advance reservation */ if (DRMAA2_TRUE == drmaa2_supports(DRMAA2_RT_MACHINEOS)) ... rt->machineOS=DRMAA2_LINUX; rt->candidateMachines = cl; r = drmaa2_rsession_request_reservation(rs, rt); jt->remoteCommand = strdup("/bin/date"); /* submit job */ jt->reservationId = drmaa2_r_get_id(r); drmaa2_dict_set(env, "PBS_SCP", "/usr/bin/scp"); jt->jobEnvironment = env; j = drmaa2_jsession_run_job(js, jt); drmaa2_j_wait_terminated(j, DRMAA2_INFINITE_TIME); /* Wait for termination and print exit status */ ji = drmaa2_j_get_info(j); ... ... ... /* close sessions, cleanup */ drmaa2_jtemplate_free(&jt); drmaa2_rtemplate_free(&rt); drmaa2_jinfo_free(&ji); drmaa2_j_free(&j); drmaa2_r_free(&r); drmaa2_close_msession(ms); drmaa2_close_rsession(rs); drmaa2_close_jsession(js); drmaa2_msession_free(&ms); drmaa2_rsession_free(&rs); drmaa2_jsession_free(&js); ... ... |
...