drmaa_session(3)
πΈ drmaa_session β start/finish a Grid Engine DRMAA session
okay bestie, sit down, we're doing drmaa_session(3) from the Grid Engine DRMAA manual, section 3. This is the get-in-and-get-out page: how you open a DRMAA session and how you close it like a responsible queen. β¨
β¨ NAME β¨
drmaa_init, drmaa_exit β start / finish a Grid Engine DRMAA session π
β¨ SYNOPSIS β¨
#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
);
β¨ DESCRIPTION β¨
π drmaa_init() π
The drmaa_init() function initializes the Grid Engine DRMAA API library for all threads of the process and creates a brand new DRMAA session. She's the main character. Nothing else happens until she does.
This routine must be called once before any other DRMAA call β with exactly three exceptions, and you better memorize them:
drmaa_version(3)drmaa_get_DRM_system(3)drmaa_get_DRMAA_implementation(3)
Those three are allowed to go first. Everybody else? No. Except for the functions listed above, no DRMAA functions may be called before drmaa_init() completes. And if you do try to call a DRMAA function before drmaa_init() completes, it will hand you back a DRMAA_ERRNO_NO_ACTIVE_SESSION error. Like, it's not mad, it's just disappointed. π
Now, contact β she's an implementation dependent string, and you can use her to specify which Grid Engine cell to use. If contact is NULL, the default Grid Engine cell is used. Simple. Clean.
In the 1.0 implementation, contact may have this value:
session=session_id
To determine the session_id, you call the drmaa_get_contact(3) function after the session has already been initialized. iykyk. π
And here's the slay part: 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. Iconic, honestly.
β οΈ But note, however: jobs which ended before the call to drmaa_init() may not be available, or may have no associated exit information or resource usage data. So don't come crying to me about your exit info, bestie. π
π drmaa_exit() π
The drmaa_exit() function closes the DRMAA session for all threads and must be called before process termination. Leaving without saying bye is a crime and I will not be defending you.
Rules of the road:
drmaa_exit()may be called only once by a single thread in the process.- It may only be called after the
drmaa_init()function has completed. - Any DRMAA function, other than
drmaa_init(3), which is called after thedrmaa_exit()function completes will return aDRMAA_ERRNO_NO_ACTIVE_SESSIONerror. Session's over. Go home.
The drmaa_exit() function does the necessary clean up of the DRMAA session state, including unregistering from the qmaster(8). And this part is important, so listen up: 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. So you're not just being rude, you're literally making qmaster do unpaid labor. Not cute.
π Submitted jobs are not affected by the drmaa_exit() function. Your jobs are fine. They're living their best life. You, however, still need to clean up.
π ENVIRONMENTAL VARIABLES π
SGE_ROOTβ Specifies the location of the Grid Engine standard configuration files. The home address of all the config, basically. πSGE_CELLβ If set, specifies the default Grid Engine cell to be used. To address a Grid Engine cell, Grid Engine uses (in the order of precedence):- The name of the cell specified in the environment variable
SGE_CELL, if it is set. - The name of the default cell, i.e.
default.
- The name of the cell specified in the environment variable
SGE_DEBUG_LEVELβ If set, specifies that debug information should be written tostderr. In addition, the level of detail in which debug information is generated is defined. Turn it up if you want the tea. πSGE_QMASTER_PORTβ If set, specifies the tcp port on which thesge_qmasteris expected to listen for communication requests. Most installations will use a services map entry instead to define that port. Fancy. β¨
β RETURN VALUES β
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. So if things go sideways, the receipts are right there. π§Ύ
π ERRORS π
The drmaa_init() and drmaa_exit() functions can fail with:
DRMAA_ERRNO_INTERNAL_ERRORβ Unexpected or internal DRMAA error, like system call failure, etc. The "idk what happened either" error. πDRMAA_ERRNO_DRM_COMMUNICATION_FAILUREβ Could not contact DRM system for this request. Left on read. π΅DRMAA_ERRNO_AUTH_FAILUREβ The specified request is not processed successfully due to authorization failure. Not your house, not your keys. πDRMAA_ERRNO_INVALID_ARGUMENTβ The input value for an argument is invalid. Check yourself before you wreck yourself. π
The drmaa_init() function can fail with:
DRMAA_ERRNO_INVALID_CONTACT_STRINGβ Initialization failed due to invalid contact string. That string was not it. πDRMAA_ERRNO_DEFAULT_CONTACT_STRING_ERRORβ Could not use the default contact string to connect to DRM system. The fallback fell. πDRMAA_ERRNO_DRMS_INIT_FAILEDβ Initialization failed due to failure to init DRM system. She simply did not start. π«DRMAA_ERRNO_ALREADY_ACTIVE_SESSIONβ Initialization failed due to existing DRMAA session. Girl, you already have one. You can't just collect sessions. π―DRMAA_ERRNO_NO_MEMORYβ Failed allocating memory. Out of RAM, out of luck. π§
The drmaa_exit() function can fail with:
DRMAA_ERRNO_NO_ACTIVE_SESSIONβ Failed because there is no active session. You can't leave a party you never showed up to. πDRMAA_ERRNO_DRMS_EXIT_ERRORβ DRM system disengagement failed. The Irish goodbye did not go through. π«
π¦ SEE ALSO π¦
drmaa_submit(3) β go submit some jobs, bestie. You got this. π«Ά
k byeeee, this was the drmaa_session(3) page from Grid Engine DRMAA, part of <b>SGE 8.1.3pre</b>, dated $Date: 2008-07-08 09:10:04 $. Go forth and clean up your sessions. periodt. π
π¦ where this page comes from
- debian bookworm: gridengine-drmaa-dev 8.1.9+dfsg-10+b1 Β· SISSL
- debian trixie: gridengine-drmaa-dev 8.1.9+dfsg-13.1 Β· SISSL
- ubuntu jammy: gridengine-drmaa-dev 8.1.9+dfsg-10build1 Β· SISSL
- ubuntu noble: gridengine-drmaa-dev 8.1.9+dfsg-11build3 Β· SISSL
- ubuntu questing: gridengine-drmaa-dev 8.1.9+dfsg-13.1
- ubuntu resolute: gridengine-drmaa-dev 8.1.9+dfsg-13.2 Β· SISSL
- ubuntu stonking: gridengine-drmaa-dev 8.1.9+dfsg-13.2ubuntu1 Β· SISSL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms