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 the drmaa_exit() function completes will return a DRMAA_ERRNO_NO_ACTIVE_SESSION error. 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):
    1. The name of the cell specified in the environment variable SGE_CELL, if it is set.
    2. The name of the default cell, i.e. default.
  • SGE_DEBUG_LEVEL β€” 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. Turn it up if you want the tea. πŸ“
  • SGE_QMASTER_PORT β€” If set, specifies the tcp port on which the sge_qmaster is 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. πŸ’œ