Home About Software Documentation Support Outreach Ecosystem Dev Awards Team & Sponsors

DRMAA bindings for scripting languages 5.5

Most functions in DRMAA C library use reference parameters to get results when calling them. Using scripting languages makes this way of getting information unfeasible. For example python strings are immutable so it is not possible to fill an empty string with the information needed from the extension. The way the functions are called are the same as Perl and Python SGE DRMAA bindings, reference variables are omitted and what functions return is an array of result code, reference variables and error string. For example in C this call:

result=drmaa_version(&major,&minor,error,DRMAA_ERROR_STRING_BUFFER-1);

is translated to ruby as:

(result, major, minor, error)=drmaa_version

Table 1. Translation from C to Scripting language

C Scripting Language
result=drmaa_get_next_attr_name(values, &value, value_len) (result, value)=drmaa_get_next_attr_name(values)
result=drmaa_get_next_attr_value(values, &value, value_len) (result, value)=drmaa_get_next_attr_value(values)
result=drmaa_get_next_job_id(values, &value, value_len) (result, value)=drmaa_get_next_job_id(values)
result=drmaa_get_num_attr_names(values, &size) (result, size)=drmaa_get_num_attr_names(values)
result=drmaa_get_num_attr_values(values, &size) (result, size)=drmaa_get_num_attr_values(values)
result=drmaa_get_num_job_ids(values, &size) (result, size)=drmaa_get_num_job_ids(values)
drmaa_release_attr_names(values) drmaa_release_attr_names(values)
drmaa_release_attr_values(values) drmaa_release_attr_values(values)
drmaa_release_job_ids(values) drmaa_release_job_ids(values)
result=drmaa_init(contact, error, error_len) (result, error)=drmaa_init(nil)
result=drmaa_exit(error, error_len) (result, error)=drmaa_exit()
result=drmaa_allocate_job_template(&jt, error, error_len) (result, jt, error)=drmaa_allocate_job_template()
result=drmaa_delete_job_template(jt, error, error_len) (result, error)=drmaa_delete_job_template(jt)
result=drmaa_set_attribute(jt, name, value, error, error_len) (result, error)=drmaa_set_attribute(jt, name, value)
result=drmaa_get_attribute(jt, name, &value, error, error_len) (result, value, error)=drmaa_get_attribute(jt, name)
result=drmaa_set_vector_attribute(jt, name, value, error, error_len) (result, error)=drmaa_set_vector_attribute(jt, name, value)
result=drmaa_get_vector_attribute(jt, name, &values, error, error_len) (result, values, error)=drmaa_get_vector_attribute(jt, name)
result=drmaa_get_attribute_names(&values, error, error_len) (result, values, error)=drmaa_get_attribute_names()
result=drmaa_get_vector_attribute_names(&values, error, error_len) (result, values, error)=drmaa_get_vector_attribute_names()
result=drmaa_run_job(job_id, job_id_len, jt, error, error_len) (result, job_id, error)=drmaa_run_job(jt)
result=drmaa_run_bulk_jobs(&jobids, jt, start, end, incr, error, error_len) (result, jobids, error)=drmaa_run_bulk_jobs(jt, start, end, incr)
result=drmaa_control(jobid, action, error, error_len) (result, error)=drmaa_control(jobid, action)
result=drmaa_job_ps(job_id, &remote_ps, error, error_len) (result, remote_ps, error)=drmaa_job_ps(job_id)
result=drmaa_synchronize(job_ids, timeout, dispose, error, error_len) (result, error)=drmaa_synchronize(job_ids, timeout, dispose)
result=drmaa_wait(job_id, job_id_out, job_id_out_len, &stat, timeout, &rusage, error, error_len) (result, job_id_out, stat, rusage, error)=drmaa_wait(job_id, timeout)
result=drmaa_wifexited(&exited, stat, error, error_len) (result, exited, error)=drmaa_wifexited(stat)
result=drmaa_wexitstatus(&exit_status, stat, error, error_len) (result, exit_status, error)=drmaa_wexitstatus(stat)
result=drmaa_wifsignaled(&signaled, stat, error, error_len) (result, signaled, error)=drmaa_wifsignaled(stat)
result=drmaa_wtermsig(signal, signal_len, stat, error, error_len) (result, signal, error)=drmaa_wtermsig(stat)
result=drmaa_wcoredump(&core_dumped, stat, error, error_len) (result, core_dumped, error)=drmaa_wcoredump(stat)
result=drmaa_wifaborted(&aborted, stat, error, error_len) (result, aborted, error)=drmaa_wifaborted(stat)
error_string=drmaa_strerror(drmaa_errno) error_string=drmaa_strerror(drmaa_errno)
result=drmaa_get_contact(contact, contact_len, error, error_len) (result, contact, error)=drmaa_get_contact()
result=drmaa_version(&major, &minor, error, error_len) (result, major, minor, error)=drmaa_version()
result=drmaa_get_DRM_system(drm_system, drm_system_len, error, error_len) (result, drm_system, error)=drmaa_get_DRM_system()
result=drmaa_get_DRMAA_implementation(drmaa_impl, drmaa_impl_len, error, error_len) (result, drmaa_impl, error)=drmaa_get_DRMAA_implementation()
str_status=drmaa_gw_strstatus(drmaa_state) str_status=drmaa_gw_strstatus(drmaa_state)


Note
In drmaa_init call we have to pass a NULL argument as GridWay DRMAA library requires it. Here as an example I used nil as it is the ruby object describing NULL but in perl you have to use undef and in python None.
Admin · Log In