sge_get_qtask_args() -- get args for a qtask entry
char** sge_get_qtask_args(void *ctx, char *taskname, lList **answer_list)
This function reads the qtask files and returns an array of args for the given qtask entry. Calling this function will initialize the qtask framework, if it has not already been initialized.
void *ctx - the communication context (sge_gdi_ctx_class_t *) char *taskname - The name of the entry for which to look in the qtask files lList **answer_list - For returning error information
char ** A NULL-terminated array of args for the given qtask entry
MT-NOTE: sge_get_qtask_args() is MT safe with respect to itself, but it is not thread safe to use this function in conjuction with the init_qtask_config() or sge_init() functions or accessing the task_config global variable.
gdi_mt_init() -- Initialize GDI state for multi threading use.
void gdi_mt_init(void)
Set up GDI. This function must be called at least once before any of the GDI functions is used. This function is idempotent, i.e. it is safe to call it multiple times. Thread local storage for the GDI state information is reserved.
void - NONE
void - NONE
MT-NOTE: gdi_mt_init() is MT safe
gdi_state_get_????() - read access to gdilib global variables
Provides access to either global variable or per thread global variable.
sge_daemonize() -- Daemonize the current application
int sge_daemonize(fd_set *keep_open)
Daemonize the current application. Throws ourself into the background and dissassociates from any controlling ttys. Don't close filedescriptors mentioned in 'keep_open'.
fd_set *keep_open - bitmask args optional args
int - Successfull? 1 - Yes 0 - No
MT-NOTES: sge_daemonize() is not MT safe
sge_daemonize_finalize() -- finalize daemonize process
int sge_daemonize_finalize(fd_set *keep_open)
report successful daemonizing to the parent process and close all file descriptors. Set file descirptors 0, 1 and 2 to /dev/null sge_daemonize_prepare() and sge_daemonize_finalize() will replace sge_daemonize() for multithreades applications. sge_daemonize_finalize() must be called by the thread who have called sge_daemonize_prepare().
fd_set *keep_open - file descriptor set to keep open
int - true on success
sge_daemonize_prepare() -- prepare daemonize of process
int sge_daemonize_prepare(void)
The parent process will wait for the child's successful daemonizing. The client process will report successful daemonizing by a call to sge_daemonize_finalize(). The parent process will exit with one of the following exit states: typedef enum uti_deamonize_state_type { SGE_DEAMONIZE_OK = 0, ok SGE_DAEMONIZE_DEAD_CHILD = 1, child exited before sending state SGE_DAEMONIZE_TIMEOUT = 2 timeout whild waiting for state } uti_deamonize_state_t; Daemonize the current application. Throws ourself into the background and dissassociates from any controlling ttys. Don't close filedescriptors mentioned in 'keep_open'. sge_daemonize_prepare() and sge_daemonize_finalize() will replace sge_daemonize() for multithreaded applications. sge_daemonize_prepare() must be called before starting any thread.
void - none
int - true on success, false on error
get_cl_ping_value() -- get commlib parameter list value "cl_ping"
static bool get_cl_ping_value(void)
Returns the value of the "cl_ping" commlib parameter. The value is true or false and specifies if gdi should send a SIM message to qmaster which should be used for desiction making if qmaster is still working or unreachable.
void - none
static bool - true or false (enabled or disabled)
get_gdi_retries_value() -- get commlib parameter list value "gdi_retries"
static int get_gdi_retries_value(void)
Returns the nr of retries on synchron receive retries when getting a GDI response message.
void - none
static int - configured "gdi_retries" value (set by qmaster_params)
sge_gdi2_is_done() -- check if GDI request is finished
bool sge_gdi2_is_done(sge_gdi_ctx_class_t* ctx, lList **alpp, state_gdi_multi *state)
This function returns true if the GDI request which was previously been created via sge_gdi2_multi() is finished or if it is will waiting to be executed. A return value of "true" means that a call of sge_gdi2_wait() will return immediatly because the request has been handled and an answer is available. "false" means that a call of sge_gdi2_wait() would block because the GDI request is not done till now. Input parameters for this function are the GDI context "ctx" and the "state" structure which has to be initialized by calling sge_gdi2_multi(... mode=SGE_GDI_RECORED...) zero or multiple times and sge_gdi2_multi(... mode=SGE_GDI_SEND...) once.
sge_gdi_ctx_class_t* ctx - context object lList **alpp - answer list for this function state_gdi_multi *state - gdi state variable
bool - is request already done? true - yes false - no
MT-NOTE: sge_gdi2_is_done() is MT safe
sge_gdi2_wait() -- wait till a GDI request is finished
bool sge_gdi2_wait(sge_gdi_ctx_class_t* ctx, lList **alpp, lList **malpp, state_gdi_multi *state)
This functions waits until a GDI multi request is handled by a qmaster "worker" thread. This means that the thread executing this function will block till either the GDI request is done successfully or till a detailed list of error messages, describing the reason why the request could not be executed, is available. Input parameters for this function are the GDI context "ctx" and the "state" structure which has to be initialized by calling sge_gdi2_multi(... mode=SGE_GDI_RECORED...) zero or multiple times and sge_gdi2_multi(... mode=SGE_GDI_SEND...) once. If the function itself fails it will append answer list messages to "alpp" and return this "false" as return value". Otherwise the multi answer list "malpp" will be initialized, which can later on be evaluated with sge_gdi_extract_answer(), and the function will return with "true".
sge_gdi_ctx_class_t* ctx - context object lList **alpp - answer list for this function lList **malpp - multi answer list state_gdi_multi *state - gdi state variable
bool - error state true - success false - error
{ state_gdi_multi state = STATE_GDI_MULTI_INIT; lEnumeration *what_cqueue = lWhat("%T(ALL)", CQ_Type); lCondition *where_cqueue = NULL; lEnumeration *what_job = lWhat("%T(ALL)", JB_Type); lCondition *where_job = NULL; lList *local_answer_list = NULL; int cqueue_request_id; int job_request_id; cqueue_request_id = ctx->gdi_multi(ctx, &local_answer_list, SGE_GDI_RECORD, SGE_CQ_LIST, SGE_GDI_GET, NULL, where_cqueue, what_cqueue, &state, true); job_request_id = ctx->gdi_multi(ctx, &local_answer_list, SGE_GDI_SEND, SGE_JB_LIST, SGE_GDI_GET, NULL, where_job, what_job, &state, true); if (cqueue_request_id != -1 && job_request_id != -1 && answer_list_has_error(&local_answer_list) == false) { lList *multi_answer_list = NULL; lList *list_cqueue = NULL; lList *list_job = NULL; lList *answer_cqueue = NULL; lList *answer_job = NULL; bool local_ret; local_ret = ctx->gdi_wait(ctx, &local_answer_list, &multi_answer_list, &state); sge_gdi_extract_answer(&answer_cqueue, SGE_GDI_GET, SGE_CQ_LIST, cqueue_request_id, multi_answer_list, &list_cqueue); sge_gdi_extract_answer(&answer_job, SGE_GDI_GET, SGE_CQ_LIST, job_request_id, multi_answer_list, &list_job); if (local_ret == false || answer_list_has_error(&answer_cqueue) || answer_list_has_error(&answer_job) || answer_list_has_error(&local_answer_list)) { ERROR((SGE_EVENT, "GDI multi request failed")); } else { INFO((SGE_EVENT, "GDI multi request was successfull")); INFO((SGE_EVENT, "got cqueue list with "sge_U32CFormat" and cqueue answer " "list with "sge_U32CFormat" elements.", sge_u32c(lGetNumberOfElem(list_cqueue)), sge_u32c(lGetNumberOfElem(answer_cqueue)))); INFO((SGE_EVENT, "got job list with "sge_U32CFormat" and job answer " "list with "sge_U32CFormat" elements.", sge_u32c(lGetNumberOfElem(list_job)), sge_u32c(lGetNumberOfElem(answer_job)))); } lFreeList(&multi_answer_list); lFreeList(&answer_cqueue); lFreeList(&answer_job); lFreeList(&list_cqueue); lFreeList(&list_job); } else { ERROR((SGE_EVENT, "QMASTER INTERNAL MULTI GDI TEST FAILED")); ERROR((SGE_EVENT, "unable to send intern gdi request (cqueue_request_id=%d, " "job_request_id=%d", cqueue_request_id, job_request_id)); } lFreeList(&local_answer_list); }
MT-NOTE: sge_gdi2_wait() is MT safe
sge_gdi_extract_answer() -- exctact answers of a multi request.
lList* sge_gdi_extract_answer(u_long32 cmd, u_long32 target, int id, lList* mal, lList** olpp)
This function extracts the answer for each invidual request on previous sge_gdi_multi() calls.
lList** alpp - List for answers if an error occurs in sge_gdi_extract_answer This list gets allocated by GDI. The caller is responsible for freeing. A response is a list element containing a field with a status value (AN_status). The value STATUS_OK is used in case of success. STATUS_OK and other values are defined in sge_answerL.h. The second field (AN_text) in a response list element is a string that describes the performed operation or a description of an error. u_long32 cmd - bitmask which decribes the operation (see sge_gdi_multi) u_long32 target - unique id to identify masters list (see sge_gdi_multi) int id - unique id returned by a previous sge_gdi_multi() call. lList* mal - List of answer/response lists returned from sge_gdi_multi(mode=SGE_GDI_SEND) lList** olpp - This parameter is used to get a list in case of SGE_GDI_GET command.
true in case of success false in case of error
MT-NOTE: sge_gdi_extract_answer() is MT safe
Packets_and_Tasks -- Functions and structures behind GDI
Packets and tasks are structures which are used in the methods implementing GDI. The real C structure names are "sge_gdi_packet_class_t" and "sge_gdi_task_class_t". An instance of the packet structure represents a GDI request. Each packet has assigned at least one task. But it may have multiple tasks. A Packet with one task represents a singe GDI request and that one with multiple task represents a multi GDI request. GDI requests are created by function calls sge_gdi() and sge_gdi_multi(). Internally the packet and task data structures are used to represent that request information. Within the client side code (sge_gdi(), sge_gdi_multi(), sge_gdi_wait(), sge_extract_answer() ... ) there are multiple functions used to create and verify packets and tasks: sge_gdi_packet_append_task() sge_gdi_packet_create() sge_gdi_packet_create_base() sge_gdi_packet_create_multi_answer() sge_gdi_packet_free() sge_gdi_packet_get_last_task_id() sge_gdi_packet_initialize_auth_info() sge_gdi_task_create() sge_gdi_task_free() Following functions are used to handle data transfer from external GDI clients (qstat, qconf, ...) or internal GDI clients (scheduler, JVM, ...) sge_gdi_packet_execute_internal() sge_gdi_packet_execute_external() sge_gdi_packet_wait_for_result_internal() sge_gdi_packet_wait_for_result_external() Data transfer of packets transfered between external GDI clients is prepared with following functions process: sge_gdi_packet_get_pb_size() sge_gdi_packet_initialize_auth_info() sge_gdi_packet_pack() sge_gdi_packet_pack_task() sge_gdi_packet_parse_auth_info() sge_gdi_packet_unpack() Within the master process special syncronisation for the thread accessing packet and task datastructures is required because the data structures are not thread safe per default. Only one thread is allowed to access a packet or task structure at the same time. To synchronize their activities between "listener" and "worker" threads a queue of packet elements is used. This "Master_Packet_Queue" is guarded by the function calls sge_gdi_packet_queue_wait_for_new_packet() sge_gdi_packet_queue_store_notify() sge_gdi_packet_queue_wakeup_all_waiting() Additional synchronisation functions are sge_gdi_packet_wait_till_handled() sge_gdi_packet_broadcast_that_handled()
sge_gdi_packet_append_task() -- append an additional GDI task
bool sge_gdi_packet_append_task(sge_gdi_packet_class_t *packet, lList **answer_list, u_long32 target, u_long32 command, lList **lp, lList **a_list, lCondition **condition, lEnumeration **enumeration, bool do_copy, bool do_verify)
This function creates a new GDI task representing one request of a multi GDI request. The task will be appended to the list of tasks part of "packet". It will be initialized with the values given by "target" and "command". Pointer parameters like "lp", "a_list", "condition", and "enumeration" will either be copied ("do_copy" == true) or they will just be used as they are. In that case they will direct to NULL after the function returns. The memory allocated by the provided pointer parameters will be released when the task is destroyed they are part of. In case of any error the function will return "false" and the "answer_list" will be filled with a message. Causes for errors are: - malloc failure - verification failure (sge_gdi_task_verify)
sge_gdi_packet_class_t *packet - packet lList **answer_list - answer list used by this function u_long32 target - GDI target value u_long32 command - GDI command lList **lp - list pointer lList **a_list - answer list pointer lCondition **condition - CULL condition lEnumeration **enumeration - CULL enumeration bool do_copy - do copy all elements passed to this structure
bool - error state true - success false - error (answer_list will be filled with detailed information)
MT-NOTE: sge_gdi_packet_append_task() is MT safe
sge_gdi_packet_broadcast_that_handled() -- broadcast to waiting threads
void sge_gdi_packet_broadcast_that_handled(sge_gdi_packet_class_t *packet)
This functions wakes up all threads waiting in sge_gdi_packet_wait_till_handled(). This function is used to synchronize packet producers (listerner, scheduler, jvm thread ...) with packet consumers (worker threads) which all use a packet queue to synchronize the access to packet elements. Packet producers store packets in the packet queue and then they call sge_gdi_packet_wait_till_handled(). Packet consumers fetch a packet from the queue. After they have finished using the packet structure they call this function to notify the waiting threads that the packet is not accessed anymore.
sge_gdi_packet_class_t *packet - packet element
void - NONE
MT-NOTE: sge_gdi_packet_broadcast_that_handled() is MT safe
sge_gdi_packet_create() -- create a new GDI packet and initialize it
sge_gdi_packet_class_t * sge_gdi_packet_create(sge_gdi_ctx_class_t *ctx, lList **answer_list)
Creates a new GDI packet element and initializes all members of the structure.
sge_gdi_ctx_class_t *ctx - GDI context lList **answer_list - answer list
sge_gdi_packet_class_t * - new packet element or NULL in case of errors
MT-NOTE: sge_gdi_packet_create() is MT safe
sge_gdi_packet_create_base() -- ???
sge_gdi_packet_class_t * sge_gdi_packet_create_base(lList **answer_list)
Creates a new GDI packet and initializes all base structure members where necessary information is available. "uid", "gid", "user" and "group" members part of sge_gdi_packet_class_t will not be initialized with this function. Instead sge_gdi_packet_create() can be used or the function sge_gdi_packet_initialize_auth_info() can be called afterwards.
lList **answer_list - answer list in case of error
sge_gdi_packet_class_t * - new GDI packet
MT-NOTE: sge_gdi_packet_create_base() is MT safe
sge_gdi_packet_create_multi_answer() -- create multi answer
static bool sge_gdi_packet_create_multi_answer(sge_gdi_ctx_class_t* ctx, lList **answer_list, sge_gdi_packet_class_t **packet, lList **malpp)
Creates a multi answer element ("malpp") from the given "packet". The lists and answer lists for the (multi) GDI request will be moved from the task structures conteined in the packet, into the multi answer list. After all information has been moved the packet and all subelement will be freed so that the *packet will be NULL when the function returns. Threre are no errors expected from this function. So the return value "false" or a filled "answer_list" will never bee seen after return.
sge_gdi_ctx_class_t* ctx - context (not used) lList **answer_list - answer_list (not used) sge_gdi_packet_class_t **packet - packet lList **malpp - multi answer
static bool - error state true - always
MT-NOTE: sge_gdi_packet_create_multi_answer() is MT safe
sge_gdi_packet_execute_external() -- execute a GDI packet
bool sge_gdi_packet_execute_external(sge_gdi_ctx_class_t* ctx, lList **answer_list, sge_gdi_packet_class_t *packet)
This functions sends a GDI "packet" from an external client to the qmaster process. If the packet is handled on master side the response is send back to the client which then will fill "packet" with the received information. To send packets from internal clients (threads) the function sge_gdi_packet_execute_internal() has to be used. Please note that in contrast to sge_gdi_packet_execute_internal() this function assures that the GDI request contained in the "packet" is completely executed (either successfull or with errors) after this function returns. a GDI multi answer lists structure from the information contained in the packet after this function has been called.
sge_gdi_ctx_class_t* ctx - context handle lList **answer_list - answer list sge_gdi_packet_class_t *packet - packet
bool - error state true - success false - error (answer_lists will contain details)
MT-NOTE: sge_gdi_packet_execute_extern() is MT safe
sge_gdi_packet_execute_internal() -- execute a GDI packet
bool sge_gdi_packet_execute_internal(sge_gdi_ctx_class_t* ctx, lList **answer_list, sge_gdi_packet_class_t *packet)
This functions stores a GDI "packet" in the "Master_Packet_Queue" so that it will be executed in future. This function can only be used in the context of an internal GDI client (thread in qmaster). To send packets from external clients the function sge_gdi_packet_execute_external() has to be used. Please note that in contrast to sge_gdi_packet_execute_external() this function does not assures that the GDI request contained in the "packet" is already executed after this function returns. sge_gdi_packet_wait_for_result_internal() has to be called to assure this. This function will also creates a GDI multi answer lists structure from the information contained in the handled packet after this function has been called.
sge_gdi_ctx_class_t* ctx - context handle lList **answer_list - answer list sge_gdi_packet_class_t *packet - packet
bool - error state true - success false - error (answer_lists will contain details)
MT-NOTE: sge_gdi_packet_execute_extern() is MT safe
sge_gdi_packet_free() -- free memory allocated by packet
bool sge_gdi_packet_free(sge_gdi_packet_class_t **packet)
Releases the memory allocated by all members of the "packet" structure including the list of tasks and sublists part of the tasks. The caller has to take care that the packet is not part of a packet queue when this function is called!
sge_gdi_packet_class_t **packet - packet
bool - error state true - success false - error
MT-NOTE: sge_gdi_packet_free() is not MT safe
sge_gdi_packet_get_last_task_id() -- returns the last used task id
u_long32 sge_gdi_packet_get_last_task_id(sge_gdi_packet_class_t *packet)
Returns the last used task id in a package or 0 if there is no task. Can be used to get the id of the last task created with sge_gdi_packet_append_task()
sge_gdi_packet_class_t *packet - packet pointer
u_long32 - task id in the range [1, ULONG32_MAX] or 0
MT-NOTE: sge_gdi_packet_get_last_task_id() is not MT safe
sge_gdi_packet_get_pb_size() -- returns the needed puckbuffer size
u_long32 sge_gdi_packet_get_pb_size(sge_gdi_packet_class_t *packet)
This function checks how lage a packbuffer needs to be so that the given "packet" can be packed completely. This operation is needed to avoid continuous reallocation when the real buffer should be allocated.
sge_gdi_packet_class_t *packet - packet pointer
u_long32 - size in byte
MT-NOTE: sge_gdi_packet_get_pb_size() is MT safe
sge_gdi_packet_initialize_auth_info() -- initialize auth_info string
bool sge_gdi_packet_initialize_auth_info(sge_gdi_ctx_class_t *ctx, sge_gdi_packet_class_t *packet_handle, bool use_euid_egid)
Initialize the "auth_info" substring part of the "packet_handle". To initialize these values the functions get_uid(), get_gid(), get_username() and get_groupname() part of the ctx structure. will be used.
sge_gdi_ctx_class_t *ctx - context sge_gdi_packet_class_t *packet_handle - context use_euid_egid - use effective uid, gid
bool - error state true - success false - error
MT-NOTE: sge_gdi_packet_initialize_auth_info() is MT safe
sge_gdi_packet_is_handled() -- returns if packet was handled by worker
void sge_gdi_packet_is_handled(sge_gdi_packet_class_t *packet)
Returns if the given packet was already handled by a worker thread. "true" means that the packet is completely done so that a call to sge_gdi_packet_wait_till_handled() will return immediately. If "false" is returned the the packet is not finished so a call to sge_gdi_packet_wait_till_handled() might block when it is called afterwards.
sge_gdi_packet_class_t *packet - packet element
bool - true packet was already handled by a worker false packet is not done.
MT-NOTE: sge_gdi_packet_is_handled() is MT safe
sge_gdi_packet_pack() -- pack a GDI packet
bool sge_gdi_packet_pack(sge_gdi_packet_class_t * packet, lList**answer_list, sge_pack_buffer *pb)
This functions packs all data representing a multi GDI request into "pb". Errors will be reported with a corresponding "answer_list" message and a negative return value. "pb" has to be initialized before this function is called. init_packbuffer() or a similar function has do be used to initialize this "pb". The function sge_gdi_packet_get_pb_size() might be used to calculate the maximum size as if the buffer would be needed to pack all tasks of a multi GDI request. Using this size as initial size for the "pb" will prevent continuous reallocation of memory in this function.
sge_gdi_packet_class_t * packet - GDI packet lList **answer_list - answer list sge_pack_buffer *pb - backbuffer
bool - error state true - success false - error
MT-NOTE: sge_gdi_packet_pack() is MT safe
sge_gdi_packet_pack_task() -- pack a single GDI task
bool sge_gdi_packet_pack_task(sge_gdi_packet_class_t * packet, sge_gdi_task_class_t * task, lList **answer_list, sge_pack_buffer *pb)
This functions packs all data representing one GDI request of a mutli GDI request (represented by "packet" and "task") into "pb". Errors will be reported with a corresponding "answer_list" message and a negative return value. "pb" has to be initialized before this function is called. init_packbuffer() or a similar function has do be used to initialize this "pb". The function sge_gdi_packet_get_pb_size() might be used to calculate the maximum size as if the buffer would be needed to pack all tasks of a multi GDI request. Using this size as initial size for the "pb" will prevent continuous reallocation of memory in this function.
sge_gdi_packet_class_t * packet - GDI packet sge_gdi_task_class_t * task - GDI task lList **answer_list - answer_list sge_pack_buffer *pb - packing buffer
bool - error state true - success false - failure
MT-NOTE: sge_gdi_packet_pack_task() is MT safe
sge_gdi_packet_parse_auth_info() -- returns parsed auth_info
bool sge_gdi_packet_parse_auth_info(sge_gdi_packet_class_t *packet, lList **answer_list, uid_t *uid, char *user, size_t user_len, gid_t *gid, char *group, size_t group_len)
Decrypts and parses the "auth_info" substring part of "packet" and writes that information into the variables "uid", "gid", "user" and "group". If the buffer sizes of "user" and/or "group" are too small than the strings will be truncated. Corresponding buffer sizes have to be provided by "user_len" and "group_len". If "authinfo" does not contain useful information, then the function will return with a value of "false" and answer_list will be filled.
sge_gdi_packet_class_t *packet - GDI packet lList **answer_list - answer_list for error messages uid_t *uid - user id char *user - user name buffer size_t user_len - length of buffer "user" gid_t *gid - group id char *group - group name buffer? size_t group_len - length of group name buffer
bool - error state true - success false - error
MT-NOTE: sge_gdi_packet_parse_auth_info() is MT safe
sge_gdi_packet_unpack() -- unpacks a GDI packet
bool sge_gdi_packet_unpack(sge_gdi_packet_class_t **packet, lList **answer_list, sge_pack_buffer *pb)
This functions unpacks all data representing a single or multi GDI request. The information is parsed from the given packing buffer "pb" and ist stored into "packet". Necessary memory will be allocated.
sge_gdi_packet_class_t ** packet - new GDI packet lList **answer_list - answer_list sge_pack_buffer *pb - packing buffer
bool - error state true - success false - error
MT-NOTE: sge_gdi_packet_unpack() is MT safe
sge_gdi_packet_wait_for_result_external() -- wait for packet result
bool sge_gdi_packet_wait_for_result_external(sge_gdi_ctx_class_t* ctx, lList **answer_list, sge_gdi_packet_class_t *packet, lList **malpp)
Despite to its name this function does not wait. This is not necessary because the GDI request handled in the execution process previously is already done. A call to this function simply breates a GDI multi answer list.
sge_gdi_ctx_class_t* ctx - context handle lList **answer_list - answer list sge_gdi_packet_class_t **packet - GDI packet lList **malpp - multi answer list
bool - error state true - success false - error
MT-NOTE: sge_gdi_packet_wait_for_result_external() is MT safe
sge_gdi_packet_wait_for_result_internal() -- wait for handled packet
bool sge_gdi_packet_wait_for_result_internal(sge_gdi_ctx_class_t* ctx, lList **answer_list, sge_gdi_packet_class_t *packet, lList **malpp)
This function can only be called in a qmaster thread. Then this function blocks until the GDI packet, which has to be given to qmaster via sge_gdi_packet_execute_internal(), is executed completely (either successfull or with errors). After that it creates a multi answer list.
sge_gdi_ctx_class_t* ctx - context handle lList **answer_list - answer list sge_gdi_packet_class_t **packet - GDI packet lList **malpp - multi answer list
bool - error state true - success false - error
MT-NOTE: sge_gdi_packet_wait_for_result_internal() is MT safe
sge_gdi_packet_wait_till_handled() -- wait til packet is handled
void sge_gdi_packet_wait_till_handled(sge_gdi_packet_class_t *packet)
This function blocks the calling thread till another one executes sge_gdi_packet_broadcast_that_handled(). Mutiple threads can use this call to get response if the packet is accessed by someone else anymore. This function is used to synchronize packet producers (listerner, scheduler, jvm thread ...) with packet consumers (worker threads) which all use a packet queue to synchronize the access to packet elements. Packet producers store packets in the packet queue and then they call this function to wait that they can access the packet structure again.
sge_gdi_packet_class_t *packet - packet element
void - none
MT-NOTE: sge_gdi_packet_wait_till_handled() is MT safe
sge_gdi_task_free() -- free a gdi task structure
static bool sge_gdi_task_free(sge_gdi_task_class_t **task)
free all elements of the gdi task structure and the structure itself.
sge_gdi_task_class_t **task - pointer to the task structure pointer
static bool - true - success (always)
MT-NOTE: sge_gdi_task_free() is MT safe as long as the structure passed to this function is not accessed by more than one thread simultaneously.
sge_gdi_task_get_operation_name() -- get command name
const char * sge_gdi_task_get_operation_name(sge_gdi_task_class_t *task)
This function returns a string of representing the command type of a task part of a multi GDI request (e.g the function will return "GET" when (task->command == SGE_GDI_GET))
sge_gdi_task_class_t *task - gdi task
const char * - string
MT-NOTE: sge_gdi_task_get_operation_name() is MT safe
set_sec_cred -- get credential for security system
int set_sec_cred(lListElem *job);
Tries to get credential for a security system (DCE or KERBEROS) and sets the resulting information in the job structure. If an error occurs the return value is unequal 0 Called by submitting client
job - the job structure
0 in case of success, something different otherwise
Hope, the above description is correct - don't know the DCE/KERBEROS code.
Hope, the above description is correct - don't know the DCE/KERBEROS code.
sge_security_exit -- exit sge security
void sge_security_exit(int status);
Execute any routines that the security mechanism needs to do when the program
status - exit status value
MT-NOTE: sge_security_exit() is MT safe
sge_security_initialize -- initialize sge security
int sge_security_initialize(char *name);
Initialize sge security by initializing the underlying security mechanism and setup the corresponding data structures
name - name of enrolling program
0 in case of success, something different otherwise
MT-NOTE: sge_security_initialize() is MT safe (assumptions)
sge_gdi_shutdown() -- gdi shutdown.
int sge_gdi_shutdown()
This function has to be called before quitting the program. It cancels registration at commd.
MT-NOTES: sge_gdi_setup() is MT safe
sge_gdi_check_permission() -- check permissions of gdi request
int sge_gdi_check_permission(int option);
This function asks the qmaster for the permission (PERM_Type) list. The option flag specifies which right should be checked. It can be MANAGER_CHECK or/and OPERATOR_CHECK at this time. If the caller has access the function returns true.
int option - check flag (MANAGER_CHECK or OPERATOR_CHECK)
bool true if caller has the right, false if not (false if qmaster not reachable)
sge_gdi_get_mapping_name() -- get username for host
int sge_gdi_get_mapping_name(char* requestedHost, char* buf, int buflen)
This function sends a PERM_Type list to the qmaster. The requestedHost is stored in the PERM_req_host list entry. The qmaster will fill up the PERM_Type list. The mapped user name is stored in the PERM_req_username field. The function will strcpy the name into the "buf" char array if the name is shorter than the given "buflen". On success the function returns true.
char* requestedHost - pointer to char array; this is the name of the host were the caller wants to get his username. char* buf - char array buffer to store the username int buflen - length (sizeof) buf
int true on success, false if not
sge_qexecve() -- start a task in a tightly integrated parallel job
sge_tid_t sge_qexecve(const char *hostname, const char *queuename, const char *cwd, const lList *environment const lList *path_aliases)
Starts a task in a tightly integrated job. Builds a job object describing the task, connects to the execd on the targeted execution host, delivers the job object and waits for an answer. The answer from the execution daemon on the execution host contains a task id that is returned to the caller of the function.
const char *hostname - name of the host on which to start the task const lList *environment - list containing environment variable settings for the task that override the default environment const lList *path_aliases - optional a path alias list
sge_tid_t - the task id, if the task can be executed, a value <= 0 indicates an error.
MT-NOTE: sge_qexecve() is not MT safe
UME_LOWERBOUND -- User Mapping Entry List
#include "sge_usermapL.h" #include <gdilib/sge_usermapL.h> enum { UME_cluster_user = UME_LOWERBOUND, / username in sge/sge system / UME_mapping_list / user specific mapping list / }; LISTDEF( UME_Type ) SGE_STRING( UME_cluster_user ) SGE_LIST ( UME_mapping_list ) / UM_Type - list /
NAMEDEF( UMEN ) NAME( "UME_cluster_user" ) NAME( "UME_mapping_list" )
UME_Type list element | *---UME_cluster_user (SGE_STRING) *---UME_mapping_list (SGE_LIST) | | *----UM_mapped_user (SGE_STRING) *----UM_host_list (SGE_LIST) | | *----STR (SGE_STRING) String list (ST_Type)
no bugs known
UM_LOWERBOUND -- User Mapping List
#include "sge_usermapL.h" #include <gdilib/sge_usermapL.h> enum { UM_mapped_user = UM_LOWERBOUND, / username @foreignhost / UM_host_list / list of hosts / }; LISTDEF( UM_Type ) SGE_STRING( UM_mapped_user ) SGE_LIST ( UM_host_list ) / ST_Type - List /
NAMEDEF( UMN ) NAME( "UM_mapped_user" ) NAME( "UM_host_list" )
no bugs known
pack_job_delivery() -- pack a job to be sent to execd
int pack_job_delivery(sge_pack_buffer *pb, lListElem *jep, lList *qlp, lListElem *pep)
This function is used in qmaster and by qrsh -inherit to deliver jobs to execd's.
sge_pack_buffer *pb - packing buffer lListElem *jep - JB_Type
int - PACK_SUCCESS on success
MT-NOTE: pack_job_delivery() is MT safe
general_communication_error() -- callback for communication errors
static void general_communication_error(int cl_error, const char* error_message)
This function is used by cl_com_set_error_func() to set the default application error function for communication errors. On important communication errors the communication lib will call this function with a corresponding error number (within application context). This function should never block. Treat it as a kind of signal handler. The error_message parameter is freed by the commlib.
int cl_error - commlib error number const char* error_message - additional error text message
MT-NOTE: general_communication_error() is MT safe (static struct variable "sge_gdi_communication_error" is used)
sge_dump_message_tag() -- get tag name string
const char* sge_dump_message_tag(int tag)
This is a function used for getting a printable string output for the different message tags. (Useful for debugging)
int tag - tag value
const char* - name of tag
MT-NOTE: sge_dump_message_tag() is MT safe
sge_get_com_error_flag() -- return gdi error flag state
bool sge_get_com_error_flag(sge_gdi_stored_com_error_t error_type)
This function returns the error flag for the specified error type
sge_gdi_stored_com_error_t error_type - error type value
bool - true: error has occured, false: error never occured
MT-NOTE: sge_get_com_error_flag() is MT safe
sge_gdi_packet_verify_version() -- verify packet version
bool sge_gdi_packet_verify_version(sge_gdi_packet_class_t *packet, lList **alpp)
This function is the replacement for the function verify_request_version() which was part of the source code before the packet structure was introduced. It compares the version information of the provided "packet" with the compiled-in version number GRM_GDI_VERSION. If both versions are not the same then it tries to find if the client which provided us with this packet structure has a higher version number or the binary executing this function. In both cases the answer_list will be filled with an appropriate message.
sge_gdi_packet_class_t *packet - packet lList **alpp - answer list
bool - error state true - same version false - different version numbers
MT-NOTE: sge_gdi_packet_verify_version() is not MT safe
init_qtask_config() -- ???
static int init_qtask_config(lList **alpp, print_func_t ostream)
???
sge_gdi_ctx_class_t *ctx - ??? lList **alpp - ??? print_func_t ostream - ???
static int - 0 - success -1 - failed
???
MT-NOTES: init_qtask_config() is not MT safe as it uses global variables
???
cache_sec_cred() -- ???
bool cache_sec_cred(const char* sge_root, lListElem *jep, const char *rhost)
Called by qmaster when sending out jobs
const char* sge_root lListElem *jep - ??? const char *rhost - ???
bool - true, if jep got modified
???
MT-NOTE: cache_sec_cred() is MT safe (assumptions)
???
report_list_send() -- Send a list of reports.
int report_list_send(const lList *rlp, const char *rhost, const char *commproc, int id, int synchron, u_long32 *mid)
Send a list of reports.
const lList *rlp - REP_Type list const char *rhost - Hostname const char *commproc - Component name int id - Component id int synchron - true or false
int - error state 0 - OK -1 - Unexpected error -2 - No memory -3 - Format error other - see sge_send_any_request()
MT-NOTE: report_list_send() is not MT safe (assumptions)
--Packets_and_Taks
: gdi request_internal --Packets_and_Takscache_sec_cred
: sge_security cache_sec_credgdi_mt_init
: gdi ctx gdi_mt_initgdi_state_get_
: gdi ctx gdi_state_get_general_communication_error
: sge_any_request general_communication_errorget_cl_ping_value
: gdi request get_cl_ping_valueget_gdi_retries_value
: gdi request get_gdi_retries_valueinit_qtask_config
: sge_qtcsh init_qtask_configpack_job_delivery
: pack_job_delivery pack_job_deliveryreport_list_send
: sgeobj sge_report report_list_sendset_sec_cred
: gdi security set_sec_credsge_daemonize
: gdi ctx sge_daemonizesge_daemonize_finalize
: gdi ctx sge_daemonize_finalizesge_daemonize_prepare
: gdi ctx sge_daemonize_preparesge_dump_message_tag
: sge_any_request sge_dump_message_tagsge_gdi2_is_done
: gdi request sge_gdi2_is_donesge_gdi2_wait
: gdi request sge_gdi2_waitsge_gdi_check_permission
: gdi sge sge_gdi_check_permissionsge_gdi_extract_answer
: gdi request sge_gdi_extract_answersge_gdi_get_mapping_name
: gdi sge sge_gdi_get_mapping_namesge_gdi_packet_append_task
: gdi request_internal sge_gdi_packet_append_tasksge_gdi_packet_broadcast_that_handled
: gdi request_internal sge_gdi_packet_broadcast_that_handledsge_gdi_packet_create
: gdi request_internal sge_gdi_packet_createsge_gdi_packet_create_base
: gdi request_internal sge_gdi_packet_create_basesge_gdi_packet_create_multi_answer
: gdi request_internal sge_gdi_packet_create_multi_answersge_gdi_packet_execute_external
: gdi request_internal sge_gdi_packet_execute_externalsge_gdi_packet_execute_internal
: gdi request_internal sge_gdi_packet_execute_internalsge_gdi_packet_free
: gdi request_internal sge_gdi_packet_freesge_gdi_packet_get_last_task_id
: gdi request_internal sge_gdi_packet_get_last_task_idsge_gdi_packet_get_pb_size
: gdi request_internal sge_gdi_packet_get_pb_sizesge_gdi_packet_initialize_auth_info
: gdi request_internal sge_gdi_packet_initialize_auth_infosge_gdi_packet_is_handled
: gdi request_internal sge_gdi_packet_is_handledsge_gdi_packet_pack
: gdi request_internal sge_gdi_packet_packsge_gdi_packet_pack_task
: gdi request_internal sge_gdi_packet_pack_tasksge_gdi_packet_parse_auth_info
: gdi request_internal sge_gdi_packet_parse_auth_infosge_gdi_packet_unpack
: gdi request_internal sge_gdi_packet_unpacksge_gdi_packet_verify_version
: sge_gdi_packet sge_gdi_packet_verify_versionsge_gdi_packet_wait_for_result_external
: gdi request_internal sge_gdi_packet_wait_for_result_externalsge_gdi_packet_wait_for_result_internal
: gdi request_internal sge_gdi_packet_wait_for_result_internalsge_gdi_packet_wait_till_handled
: gdi request_internal sge_gdi_packet_wait_till_handledsge_gdi_shutdown
: gdi setup sge_gdi_shutdownsge_gdi_task_free
: gdi request_internal sge_gdi_task_freesge_gdi_task_get_operation_name
: gdi request_internal sge_gdi_task_get_operation_namesge_get_com_error_flag
: sge_any_request sge_get_com_error_flagsge_get_qtask_args
: QTCSH sge_get_qtask_argssge_qexecve
: gdi sge sge_qexecvesge_security_exit
: gdi security sge_security_exitsge_security_initialize
: gdi security sge_security_initializeUM_LOWERBOUND
: gdilib UM_LOWERBOUNDUME_LOWERBOUND
: gdilib UME_LOWERBOUND