drmaa_session (3) - Linux Manuals

drmaa_session: Start/finish xxQS_NAMExx DRMAA session


drmaa_init, drmaa_exit - Start/finish xxQS_NAMExx DRMAA session


#include drmaa.h

int drmaa_init(
const char *contact, char *error_diagnosis, size_t error_diag_len

int drmaa_exit(
char *error_diagnosis, size_t error_diag_len



The drmaa_init() function initializes the xxQS_NAMExx DRMAA API library for all threads of the process and creates a new DRMAA session. This routine must be called once before any other DRMAA call, except for and Except for the above listed functions, no DRMAA functions may be called before the drmaa_init() function completes. Any DRMAA function which is called before the drmaa_init() function completes will return a DRMAA_ERRNO_NO_ACTIVE_SESSION error. Contact is an implementation dependent string which may be used to specify which xxQS_NAMExx cell to use. If contact is NULL, the default xxQS_NAMExx cell will be used. In the 1.0 implementation contact may have the following value: session=session_id. To determine the session_id, the function should be called after the session has already been initialized. By passing the session=session_id string to the drmaa_init() function, instead of creating a new session, DRMAA will attempt to reconnect to the session indicated by the session_id. The result of reconnecting to a previous session is that all jobs previously submitted in that session that are still running will be available in the DRMAA session. Note, however, that jobs which ended before the call to drmaa_init() may not be available or may have no associated exit information or resource usage data.


The drmaa_exit() function closes the DRMAA session for all threads and must be called before process termination. The drmaa_exit() function may be called only once by a single thread in the process and may only be called after the drmaa_init() function has completed. Any DRMAA function, other than which is called after the drmaa_exit() function completes will return a DRMAA_ERRNO_NO_ACTIVE_SESSION error.

The drmaa_exit() function does necessary clean up of the DRMAA session state, including unregistering from the If the drmaa_exit() function is not called, the qmaster will store events for the DRMAA client until the connection times out, causing extra work for the qmaster and consuming system resources.

Submitted jobs are not affected by the drmaa_exit() function.


Specifies the location of the xxQS_NAMExx standard configuration files.
If set, specifies the default xxQS_NAMExx cell to be used. To address a xxQS_NAMExx cell xxQS_NAMExx uses (in the order of precedence):

The name of the cell specified in the environment variable xxQS_NAME_Sxx_CELL, if it is set.

The name of the default cell, i.e. default.

If set, specifies that debug information should be written to stderr. In addition the level of detail in which debug information is generated is defined.
If set, specifies the tcp port on which the xxqs_name_sxx_qmaster is expected to listen for communication requests. Most installations will use a services map entry instead to define that port.


Upon successful completion, drmaa_init() and drmaa_exit() return DRMAA_ERRNO_SUCCESS. Other values indicate an error. Up to error_diag_len characters of error related diagnosis information is then provided in the buffer error_diagnosis.


The drmaa_init() and drmaa_exit() functions can fail with:
Unexpected or internal DRMAA error, like system call failure, etc.
Could not contact DRM system for this request.
The specified request is not processed successfully due to authorization failure.
The input value for an argument is invalid.

The drmaa_init() function can fail with:

Initialization failed due to invalid contact string.
Could not use the default contact string to connect to DRM system.
Initialization failed due to failure to init DRM system.
Initialization failed due to existing DRMAA session.
Failed allocating memory.

The drmaa_exit() function can fail with:

Failed because there is no active session.
DRM system disengagement failed.