本文整理汇总了C++中slurm_send_recv_controller_msg函数的典型用法代码示例。如果您正苦于以下问题:C++ slurm_send_recv_controller_msg函数的具体用法?C++ slurm_send_recv_controller_msg怎么用?C++ slurm_send_recv_controller_msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了slurm_send_recv_controller_msg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slurm_allocate_resources
/*
* slurm_allocate_resources - allocate resources for a job request
* IN job_desc_msg - description of resource allocation request
* OUT slurm_alloc_msg - response to request
* RET 0 on success, otherwise return -1 and set errno to indicate the error
* NOTE: free the response using slurm_free_resource_allocation_response_msg()
*/
int
slurm_allocate_resources (job_desc_msg_t *req,
resource_allocation_response_msg_t **resp)
{
int rc;
slurm_msg_t req_msg;
slurm_msg_t resp_msg;
bool host_set = false;
char host[64];
slurm_msg_t_init(&req_msg);
slurm_msg_t_init(&resp_msg);
/*
* set Node and session id for this request
*/
if (req->alloc_sid == NO_VAL)
req->alloc_sid = getsid(0);
if ( (req->alloc_node == NULL)
&& (gethostname_short(host, sizeof(host)) == 0) ) {
req->alloc_node = host;
host_set = true;
}
req_msg.msg_type = REQUEST_RESOURCE_ALLOCATION;
req_msg.data = req;
rc = slurm_send_recv_controller_msg(&req_msg, &resp_msg);
/*
* Clear this hostname if set internally to this function
* (memory is on the stack)
*/
if (host_set)
req->alloc_node = NULL;
if (rc == SLURM_SOCKET_ERROR)
return SLURM_SOCKET_ERROR;
switch (resp_msg.msg_type) {
case RESPONSE_SLURM_RC:
if (_handle_rc_msg(&resp_msg) < 0)
return SLURM_PROTOCOL_ERROR;
*resp = NULL;
break;
case RESPONSE_RESOURCE_ALLOCATION:
*resp = (resource_allocation_response_msg_t *) resp_msg.data;
break;
default:
slurm_seterrno_ret(SLURM_UNEXPECTED_MSG_ERROR);
}
return SLURM_PROTOCOL_SUCCESS;
}
示例2: slurm_update_job2
/*
* slurm_update_job2 - issue RPC to a job's configuration per request,
* only usable by user root or (for some parameters) the job's owner
* IN job_msg - description of job updates
* OUT resp - per task response to the request,
* free using slurm_free_job_array_resp()
* RET SLURM_SUCCESS on success, otherwise return SLURM_ERROR with errno set
*/
extern int
slurm_update_job2 (job_desc_msg_t * job_msg, job_array_resp_msg_t **resp)
{
int rc = SLURM_SUCCESS;
slurm_msg_t req_msg, resp_msg;
slurmdb_cluster_rec_t *save_working_cluster_rec = working_cluster_rec;
slurm_msg_t_init(&req_msg);
req_msg.msg_type = REQUEST_UPDATE_JOB;
req_msg.data = job_msg;
tryagain:
slurm_msg_t_init(&resp_msg);
rc = slurm_send_recv_controller_msg(&req_msg, &resp_msg,
working_cluster_rec);
switch (resp_msg.msg_type) {
case RESPONSE_SLURM_REROUTE_MSG:
{
reroute_msg_t *rr_msg = (reroute_msg_t *)resp_msg.data;
/* Don't expect mutliple hops but in the case it does
* happen, free the previous rr cluster_rec. */
if (working_cluster_rec &&
working_cluster_rec != save_working_cluster_rec)
slurmdb_destroy_cluster_rec(
working_cluster_rec);
working_cluster_rec = rr_msg->working_cluster_rec;
slurmdb_setup_cluster_rec(working_cluster_rec);
rr_msg->working_cluster_rec = NULL;
goto tryagain;
}
case RESPONSE_JOB_ARRAY_ERRORS:
*resp = (job_array_resp_msg_t *) resp_msg.data;
break;
case RESPONSE_SLURM_RC:
rc = ((return_code_msg_t *) resp_msg.data)->return_code;
if (rc)
slurm_seterrno(rc);
break;
default:
slurm_seterrno(SLURM_UNEXPECTED_MSG_ERROR);
}
if (working_cluster_rec != save_working_cluster_rec) {
slurmdb_destroy_cluster_rec(working_cluster_rec);
working_cluster_rec = save_working_cluster_rec;
}
return rc;
}
示例3: slurm_checkpoint_error
/*
* slurm_checkpoint_error - gather error information for the last checkpoint
* operation for some job step
* IN job_id - job on which to perform operation
* IN step_id - job step on which to perform operation
* OUT error_code - error number associated with the last checkpoint operation,
* this value is dependent upon the checkpoint plugin used and may be
* completely unrelated to slurm error codes, the highest value for all
* complete calls is preserved
* OUT error_msg - error message, preserved for highest error_code, value
* must be freed by the caller to prevent memory leak
* RET 0 or a slurm error code
*/
extern int slurm_checkpoint_error (uint32_t job_id, uint32_t step_id,
uint32_t *error_code, char **error_msg)
{
int rc;
slurm_msg_t msg;
checkpoint_msg_t req;
slurm_msg_t resp_msg;
checkpoint_resp_msg_t *ckpt_resp;
if ((error_code == NULL) || (error_msg == NULL))
return EINVAL;
/*
* Request message:
*/
req.op = CHECK_ERROR;
req.job_id = job_id;
req.step_id = step_id;
req.image_dir = NULL;
slurm_msg_t_init(&msg);
slurm_msg_t_init(&resp_msg);
msg.msg_type = REQUEST_CHECKPOINT;
msg.data = &req;
rc = slurm_send_recv_controller_msg(&msg, &resp_msg,
working_cluster_rec);
if (rc == SLURM_SOCKET_ERROR)
return rc;
switch (resp_msg.msg_type) {
case RESPONSE_SLURM_RC:
*error_code = 0;
*error_msg = strdup("");
rc = _handle_rc_msg(&resp_msg);
break;
case RESPONSE_CHECKPOINT:
ckpt_resp = (checkpoint_resp_msg_t *) resp_msg.data;
*error_code = ckpt_resp->error_code;
if (ckpt_resp->error_msg)
*error_msg = strdup(ckpt_resp->error_msg);
else
*error_msg = strdup("");
slurm_free_checkpoint_resp_msg(ckpt_resp);
rc = SLURM_SUCCESS;
break;
default:
rc = SLURM_UNEXPECTED_MSG_ERROR;
}
return rc;
}
示例4: slurm_submit_batch_pack_job
/*
* slurm_submit_batch_pack_job - issue RPC to submit a heterogeneous job for
* later execution
* NOTE: free the response using slurm_free_submit_response_response_msg
* IN job_req_list - List of resource allocation requests, type job_desc_msg_t
* OUT resp - response to request
* RET SLURM_SUCCESS on success, otherwise return SLURM_ERROR with errno set
*/
extern int slurm_submit_batch_pack_job(List job_req_list,
submit_response_msg_t **resp)
{
int rc;
job_desc_msg_t *req;
slurm_msg_t req_msg;
slurm_msg_t resp_msg;
char *local_hostname = NULL;
ListIterator iter;
slurm_msg_t_init(&req_msg);
slurm_msg_t_init(&resp_msg);
/*
* set Node and session id for this request
*/
local_hostname = xshort_hostname();
iter = list_iterator_create(job_req_list);
while ((req = (job_desc_msg_t *) list_next(iter))) {
if (req->alloc_sid == NO_VAL)
req->alloc_sid = getsid(0);
if (!req->alloc_node)
req->alloc_node = local_hostname;
}
list_iterator_destroy(iter);
req_msg.msg_type = REQUEST_SUBMIT_BATCH_JOB_PACK;
req_msg.data = job_req_list;
rc = slurm_send_recv_controller_msg(&req_msg, &resp_msg,
working_cluster_rec);
xfree(local_hostname);
if (rc == SLURM_ERROR)
return SLURM_ERROR;
switch (resp_msg.msg_type) {
case RESPONSE_SLURM_RC:
rc = ((return_code_msg_t *) resp_msg.data)->return_code;
if (rc)
slurm_seterrno_ret(rc);
*resp = NULL;
break;
case RESPONSE_SUBMIT_BATCH_JOB:
*resp = (submit_response_msg_t *) resp_msg.data;
break;
default:
slurm_seterrno_ret(SLURM_UNEXPECTED_MSG_ERROR);
}
return SLURM_SUCCESS;
}
示例5: slurm_submit_batch_job
/*
* slurm_submit_batch_job - issue RPC to submit a job for later execution
* NOTE: free the response using slurm_free_submit_response_response_msg
* IN job_desc_msg - description of batch job request
* OUT resp - response to request
* RET SLURM_SUCCESS on success, otherwise return SLURM_ERROR with errno set
*/
extern int slurm_submit_batch_job(job_desc_msg_t *req,
submit_response_msg_t **resp)
{
int rc;
slurm_msg_t req_msg;
slurm_msg_t resp_msg;
char *local_hostname = NULL;
slurm_msg_t_init(&req_msg);
slurm_msg_t_init(&resp_msg);
/*
* set Node and session id for this request
*/
if (req->alloc_sid == NO_VAL)
req->alloc_sid = getsid(0);
if (req->alloc_node == NULL) {
local_hostname = xshort_hostname();
req->alloc_node = local_hostname;
}
req_msg.msg_type = REQUEST_SUBMIT_BATCH_JOB;
req_msg.data = req;
rc = slurm_send_recv_controller_msg(&req_msg, &resp_msg,
working_cluster_rec);
xfree(local_hostname);
if (rc == SLURM_ERROR)
return SLURM_ERROR;
switch (resp_msg.msg_type) {
case RESPONSE_SLURM_RC:
rc = ((return_code_msg_t *) resp_msg.data)->return_code;
if (rc)
slurm_seterrno_ret(rc);
*resp = NULL;
break;
case RESPONSE_SUBMIT_BATCH_JOB:
*resp = (submit_response_msg_t *) resp_msg.data;
break;
default:
slurm_seterrno_ret(SLURM_UNEXPECTED_MSG_ERROR);
}
return SLURM_SUCCESS;
}
示例6: slurm_load_licenses
/* slurm_load_licenses()
*
* Load requested licenses from the controller.
*
*/
extern int
slurm_load_licenses(time_t t,
license_info_msg_t **lic_info,
uint16_t show_flags)
{
int cc;
slurm_msg_t msg_request;
slurm_msg_t msg_reply;
struct license_info_request_msg req;
memset(&req, 0, sizeof(struct license_info_request_msg));
slurm_msg_t_init(&msg_request);
slurm_msg_t_init(&msg_reply);
msg_request.msg_type = REQUEST_LICENSE_INFO;
req.last_update = t;
req.show_flags = show_flags;
msg_request.data = &req;
cc = slurm_send_recv_controller_msg(&msg_request, &msg_reply,
working_cluster_rec);
if (cc < 0)
return SLURM_ERROR;
switch (msg_reply.msg_type) {
case RESPONSE_LICENSE_INFO:
*lic_info = msg_reply.data;
break;
case RESPONSE_SLURM_RC:
cc = ((return_code_msg_t *)msg_reply.data)->return_code;
slurm_free_return_code_msg(msg_reply.data);
if (cc) /* slurm_seterrno_ret() is a macro ... sigh */
slurm_seterrno(cc);
*lic_info = NULL;
return -1;
default:
slurm_seterrno_ret(SLURM_UNEXPECTED_MSG_ERROR);
break;
}
return SLURM_PROTOCOL_SUCCESS;
}
示例7: slurm_job_step_create
/*
* slurm_job_step_create - create a job step for a given job id
* IN slurm_step_alloc_req_msg - description of job step request
* OUT slurm_step_alloc_resp_msg - response to request
* RET 0 on success, otherwise return -1 and set errno to indicate the error
* NOTE: free the response using slurm_free_job_step_create_response_msg
*/
int
slurm_job_step_create (job_step_create_request_msg_t *req,
job_step_create_response_msg_t **resp)
{
slurm_msg_t req_msg, resp_msg;
int delay, rc, retry = 0;
slurm_msg_t_init(&req_msg);
slurm_msg_t_init(&resp_msg);
req_msg.msg_type = REQUEST_JOB_STEP_CREATE;
req_msg.data = req;
re_send:
if (slurm_send_recv_controller_msg(&req_msg, &resp_msg,
working_cluster_rec) < 0)
return SLURM_ERROR;
switch (resp_msg.msg_type) {
case RESPONSE_SLURM_RC:
rc = _handle_rc_msg(&resp_msg);
if ((rc < 0) && (errno == EAGAIN)) {
if (retry++ == 0) {
verbose("Slurm is busy, step creation delayed");
delay = (getpid() % 10) + 10; /* 10-19 secs */
}
sleep(delay);
goto re_send;
}
if (rc < 0)
return SLURM_PROTOCOL_ERROR;
*resp = NULL;
break;
case RESPONSE_JOB_STEP_CREATE:
*resp = (job_step_create_response_msg_t *) resp_msg.data;
break;
default:
slurm_seterrno_ret(SLURM_UNEXPECTED_MSG_ERROR);
break;
}
return SLURM_PROTOCOL_SUCCESS ;
}
示例8: slurm_load_block_info
/*
* slurm_load_block_info - issue RPC to get slurm all node select plugin
* information if changed since update_time
* IN update_time - time of current configuration data
* IN block_info_msg_pptr - place to store a node select configuration
* pointer
* IN show_flags - controls output form or filtering, see SHOW_FLAGS in slurm.h
* RET 0 or a slurm error code
* NOTE: free the response using slurm_free_block_info_msg
*/
extern int slurm_load_block_info (time_t update_time,
block_info_msg_t **block_info_msg_pptr,
uint16_t show_flags)
{
int rc;
slurm_msg_t req_msg;
slurm_msg_t resp_msg;
block_info_request_msg_t req;
slurm_msg_t_init(&req_msg);
slurm_msg_t_init(&resp_msg);
req.last_update = update_time;
req.show_flags = show_flags;
req_msg.msg_type = REQUEST_BLOCK_INFO;
req_msg.data = &req;
if (slurm_send_recv_controller_msg(&req_msg, &resp_msg,
working_cluster_rec) < 0)
return SLURM_ERROR;
switch (resp_msg.msg_type) {
case RESPONSE_BLOCK_INFO:
*block_info_msg_pptr = (block_info_msg_t *)
resp_msg.data;
break;
case RESPONSE_SLURM_RC:
rc = ((return_code_msg_t *) resp_msg.data)->return_code;
slurm_free_return_code_msg(resp_msg.data);
if (rc)
slurm_seterrno_ret(rc);
*block_info_msg_pptr = NULL;
break;
default:
*block_info_msg_pptr = NULL;
slurm_seterrno_ret(SLURM_UNEXPECTED_MSG_ERROR);
break;
}
return SLURM_SUCCESS;
}
示例9: slurm_allocate_resources
/*
* slurm_allocate_resources - allocate resources for a job request
* IN job_desc_msg - description of resource allocation request
* OUT slurm_alloc_msg - response to request
* RET SLURM_SUCCESS on success, otherwise return SLURM_ERROR with errno set
* NOTE: free the response using slurm_free_resource_allocation_response_msg()
*/
int
slurm_allocate_resources (job_desc_msg_t *req,
resource_allocation_response_msg_t **resp)
{
int rc;
slurm_msg_t req_msg;
slurm_msg_t resp_msg;
slurm_msg_t_init(&req_msg);
slurm_msg_t_init(&resp_msg);
/*
* set Node and session id for this request
*/
if (req->alloc_sid == NO_VAL)
req->alloc_sid = getsid(0);
req_msg.msg_type = REQUEST_RESOURCE_ALLOCATION;
req_msg.data = req;
rc = slurm_send_recv_controller_msg(&req_msg, &resp_msg,
working_cluster_rec);
if (rc == SLURM_ERROR)
return SLURM_ERROR;
switch (resp_msg.msg_type) {
case RESPONSE_SLURM_RC:
if (_handle_rc_msg(&resp_msg) < 0)
return SLURM_ERROR;
*resp = NULL;
break;
case RESPONSE_RESOURCE_ALLOCATION:
*resp = (resource_allocation_response_msg_t *) resp_msg.data;
break;
default:
slurm_seterrno_ret(SLURM_UNEXPECTED_MSG_ERROR);
}
return SLURM_SUCCESS;
}
示例10: slurm_get_job_steps
/*
* slurm_get_job_steps - issue RPC to get specific slurm job step
* configuration information if changed since update_time.
* a job_id value of NO_VAL implies all jobs, a step_id value of
* NO_VAL implies all steps
* IN update_time - time of current configuration data
* IN job_id - get information for specific job id, NO_VAL for all jobs
* IN step_id - get information for specific job step id, NO_VAL for all
* job steps
* IN job_info_msg_pptr - place to store a job configuration pointer
* IN show_flags - job step filtering options
* RET 0 on success, otherwise return -1 and set errno to indicate the error
* NOTE: free the response using slurm_free_job_step_info_response_msg
*/
int
slurm_get_job_steps (time_t update_time, uint32_t job_id, uint32_t step_id,
job_step_info_response_msg_t **resp, uint16_t show_flags)
{
int rc;
slurm_msg_t req_msg;
slurm_msg_t resp_msg;
job_step_info_request_msg_t req;
slurm_msg_t_init(&req_msg);
slurm_msg_t_init(&resp_msg);
req.last_update = update_time;
req.job_id = job_id;
req.step_id = step_id;
req.show_flags = show_flags;
req_msg.msg_type = REQUEST_JOB_STEP_INFO;
req_msg.data = &req;
if (slurm_send_recv_controller_msg(&req_msg, &resp_msg) < 0)
return SLURM_ERROR;
switch (resp_msg.msg_type) {
case RESPONSE_JOB_STEP_INFO:
*resp = (job_step_info_response_msg_t *) resp_msg.data;
break;
case RESPONSE_SLURM_RC:
rc = ((return_code_msg_t *) resp_msg.data)->return_code;
slurm_free_return_code_msg(resp_msg.data);
if (rc)
slurm_seterrno_ret(rc);
*resp = NULL;
break;
default:
slurm_seterrno_ret(SLURM_UNEXPECTED_MSG_ERROR);
break;
}
return SLURM_PROTOCOL_SUCCESS;
}
示例11: slurm_load_partitions
/*
* slurm_load_partitions - issue RPC to get slurm all partition configuration
* information if changed since update_time
* IN update_time - time of current configuration data
* IN partition_info_msg_pptr - place to store a partition configuration
* pointer
* IN show_flags - partition filtering options
* RET 0 or a slurm error code
* NOTE: free the response using slurm_free_partition_info_msg
*/
extern int slurm_load_partitions (time_t update_time,
partition_info_msg_t **resp,
uint16_t show_flags)
{
int rc;
slurm_msg_t req_msg;
slurm_msg_t resp_msg;
part_info_request_msg_t req;
slurm_msg_t_init(&req_msg);
slurm_msg_t_init(&resp_msg);
req.last_update = update_time;
req.show_flags = show_flags;
req_msg.msg_type = REQUEST_PARTITION_INFO;
req_msg.data = &req;
if (slurm_send_recv_controller_msg(&req_msg, &resp_msg) < 0)
return SLURM_ERROR;
switch (resp_msg.msg_type) {
case RESPONSE_PARTITION_INFO:
*resp = (partition_info_msg_t *) resp_msg.data;
break;
case RESPONSE_SLURM_RC:
rc = ((return_code_msg_t *) resp_msg.data)->return_code;
slurm_free_return_code_msg(resp_msg.data);
if (rc)
slurm_seterrno_ret(rc);
*resp = NULL;
break;
default:
slurm_seterrno_ret(SLURM_UNEXPECTED_MSG_ERROR);
break;
}
return SLURM_PROTOCOL_SUCCESS;
}
示例12: slurm_load_node_single
/*
* slurm_load_node_single - issue RPC to get slurm configuration information
* for a specific node
* OUT resp - place to store a node configuration pointer
* IN node_name - name of the node for which information is requested
* IN show_flags - node filtering options
* RET 0 or a slurm error code
* NOTE: free the response using slurm_free_node_info_msg
*/
extern int slurm_load_node_single (node_info_msg_t **resp,
char *node_name, uint16_t show_flags)
{
int rc;
slurm_msg_t req_msg;
slurm_msg_t resp_msg;
node_info_single_msg_t req;
slurm_msg_t_init(&req_msg);
slurm_msg_t_init(&resp_msg);
req.node_name = node_name;
req.show_flags = show_flags;
req_msg.msg_type = REQUEST_NODE_INFO_SINGLE;
req_msg.data = &req;
if (slurm_send_recv_controller_msg(&req_msg, &resp_msg) < 0)
return SLURM_ERROR;
switch (resp_msg.msg_type) {
case RESPONSE_NODE_INFO:
*resp = (node_info_msg_t *) resp_msg.data;
if (show_flags & SHOW_MIXED)
_set_node_mixed(*resp);
break;
case RESPONSE_SLURM_RC:
rc = ((return_code_msg_t *) resp_msg.data)->return_code;
slurm_free_return_code_msg(resp_msg.data);
if (rc)
slurm_seterrno_ret(rc);
*resp = NULL;
break;
default:
slurm_seterrno_ret(SLURM_UNEXPECTED_MSG_ERROR);
break;
}
return SLURM_PROTOCOL_SUCCESS;
}
示例13: slurm_allocation_lookup
/*
* slurm_allocation_lookup - retrieve info for an existing resource allocation
* without the addrs and such
* IN jobid - job allocation identifier
* OUT info - job allocation information
* RET 0 on success, otherwise return -1 and set errno to indicate the error
* NOTE: free the response using slurm_free_resource_allocation_response_msg()
*/
extern int slurm_allocation_lookup(uint32_t jobid,
resource_allocation_response_msg_t **info)
{
job_alloc_info_msg_t req = {0};
slurm_msg_t req_msg;
slurm_msg_t resp_msg;
req.job_id = jobid;
req.req_cluster = slurmctld_conf.cluster_name;
slurm_msg_t_init(&req_msg);
slurm_msg_t_init(&resp_msg);
req_msg.msg_type = REQUEST_JOB_ALLOCATION_INFO;
req_msg.data = &req;
if (slurm_send_recv_controller_msg(&req_msg, &resp_msg,
working_cluster_rec) < 0)
return SLURM_ERROR;
req.req_cluster = NULL;
switch (resp_msg.msg_type) {
case RESPONSE_SLURM_RC:
if (_handle_rc_msg(&resp_msg) < 0)
return SLURM_ERROR;
*info = NULL;
break;
case RESPONSE_JOB_ALLOCATION_INFO:
*info = (resource_allocation_response_msg_t *) resp_msg.data;
return SLURM_PROTOCOL_SUCCESS;
break;
default:
slurm_seterrno_ret(SLURM_UNEXPECTED_MSG_ERROR);
break;
}
return SLURM_PROTOCOL_SUCCESS;
}
示例14: slurm_checkpoint_able
/*
* slurm_checkpoint_able - determine if the specified job step can presently
* be checkpointed
* IN job_id - job on which to perform operation
* IN step_id - job step on which to perform operation
* OUT start_time - time at which checkpoint request was issued
* RET 0 (can be checkpoined) or a slurm error code
*/
extern int slurm_checkpoint_able (uint32_t job_id, uint32_t step_id,
time_t *start_time)
{
int rc;
slurm_msg_t req_msg, resp_msg;
checkpoint_msg_t ckp_req;
checkpoint_resp_msg_t *resp;
ckp_req.op = CHECK_ABLE;
ckp_req.job_id = job_id;
ckp_req.step_id = step_id;
ckp_req.image_dir = NULL;
slurm_msg_t_init(&req_msg);
slurm_msg_t_init(&resp_msg);
req_msg.msg_type = REQUEST_CHECKPOINT;
req_msg.data = &ckp_req;
if (slurm_send_recv_controller_msg(&req_msg, &resp_msg,
working_cluster_rec) < 0)
return SLURM_ERROR;
switch (resp_msg.msg_type) {
case RESPONSE_CHECKPOINT:
resp = (checkpoint_resp_msg_t *) resp_msg.data;
*start_time = resp->event_time;
slurm_free_checkpoint_resp_msg(resp_msg.data);
rc = SLURM_SUCCESS;
break;
case RESPONSE_SLURM_RC:
rc = _handle_rc_msg(&resp_msg);
break;
default:
*start_time = (time_t) NULL;
rc = SLURM_ERROR;
}
return rc;
}
示例15: slurm_job_node_ready
/*
* slurm_job_node_ready - report if nodes are ready for job to execute now
* IN job_id - slurm job id
* RET: READY_* values as defined in slurm.h
*/
extern int slurm_job_node_ready(uint32_t job_id)
{
slurm_msg_t req, resp;
job_id_msg_t msg;
int rc;
slurm_msg_t_init(&req);
slurm_msg_t_init(&resp);
bzero(&msg, sizeof(job_id_msg_t));
msg.job_id = job_id;
req.msg_type = REQUEST_JOB_READY;
req.data = &msg;
if (slurm_send_recv_controller_msg(&req, &resp) < 0)
return READY_JOB_ERROR;
if (resp.msg_type == RESPONSE_JOB_READY) {
rc = ((return_code_msg_t *) resp.data)->return_code;
slurm_free_return_code_msg(resp.data);
} else if (resp.msg_type == RESPONSE_SLURM_RC) {
int job_rc = ((return_code_msg_t *) resp.data) ->
return_code;
if ((job_rc == ESLURM_INVALID_PARTITION_NAME) ||
(job_rc == ESLURM_INVALID_JOB_ID))
rc = READY_JOB_FATAL;
else /* EAGAIN */
rc = READY_JOB_ERROR;
slurm_free_return_code_msg(resp.data);
} else if (resp.msg_type == RESPONSE_PROLOG_EXECUTING) {
rc = READY_JOB_ERROR;
} else {
rc = READY_JOB_ERROR;
}
return rc;
}