本文整理汇总了C++中slurm_msg_t_init函数的典型用法代码示例。如果您正苦于以下问题:C++ slurm_msg_t_init函数的具体用法?C++ slurm_msg_t_init怎么用?C++ slurm_msg_t_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了slurm_msg_t_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slurm_load_node
/*
* slurm_load_node - issue RPC to get slurm all node configuration information
* if changed since update_time
* IN update_time - time of current configuration data
* OUT resp - place to store a node configuration pointer
* 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 (time_t update_time,
node_info_msg_t **resp, uint16_t show_flags)
{
int rc;
slurm_msg_t req_msg;
slurm_msg_t resp_msg;
node_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_NODE_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_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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: slurm_load_job_user
/*
* slurm_load_job_user - issue RPC to get slurm information about all jobs
* to be run as the specified user
* IN/OUT job_info_msg_pptr - place to store a job configuration pointer
* IN user_id - ID of user we want information for
* IN show_flags - job filtering options
* RET 0 or -1 on error
* NOTE: free the response using slurm_free_job_info_msg
*/
extern int slurm_load_job_user (job_info_msg_t **job_info_msg_pptr,
uint32_t user_id,
uint16_t show_flags)
{
int rc;
slurm_msg_t resp_msg;
slurm_msg_t req_msg;
job_user_id_msg_t req;
slurm_msg_t_init(&req_msg);
slurm_msg_t_init(&resp_msg);
req.show_flags = show_flags;
req.user_id = user_id;
req_msg.msg_type = REQUEST_JOB_USER_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_INFO:
*job_info_msg_pptr = (job_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);
break;
default:
slurm_seterrno_ret(SLURM_UNEXPECTED_MSG_ERROR);
break;
}
return SLURM_PROTOCOL_SUCCESS;
}
示例6: 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;
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;
}
示例7: slurm_sbcast_lookup
/*
* slurm_sbcast_lookup - retrieve info for an existing resource allocation
* including a credential needed for sbcast
* IN job_id - job allocation identifier (or pack job ID)
* IN pack_job_offset - pack job index (or NO_VAL if not pack job)
* IN step_id - step allocation identifier (or NO_VAL for entire job)
* OUT info - job allocation information including a credential for sbcast
* RET SLURM_SUCCESS on success, otherwise return SLURM_ERROR with errno set
* NOTE: free the "resp" using slurm_free_sbcast_cred_msg
*/
extern int slurm_sbcast_lookup(uint32_t job_id, uint32_t pack_job_offset,
uint32_t step_id, job_sbcast_cred_msg_t **info)
{
step_alloc_info_msg_t req;
slurm_msg_t req_msg;
slurm_msg_t resp_msg;
req.job_id = job_id;
req.pack_job_offset = pack_job_offset;
req.step_id = step_id;
slurm_msg_t_init(&req_msg);
slurm_msg_t_init(&resp_msg);
req_msg.msg_type = REQUEST_JOB_SBCAST_CRED;
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_SLURM_RC:
if (_handle_rc_msg(&resp_msg) < 0)
return SLURM_ERROR;
*info = NULL;
break;
case RESPONSE_JOB_SBCAST_CRED:
*info = (job_sbcast_cred_msg_t *)resp_msg.data;
return SLURM_SUCCESS;
break;
default:
slurm_seterrno_ret(SLURM_UNEXPECTED_MSG_ERROR);
break;
}
return SLURM_SUCCESS;
}
示例8: slurm_load_reservations
/*
* slurm_load_reservations - issue RPC to get all slurm reservation
* configuration information if changed since update_time
* IN update_time - time of current configuration data
* IN reserve_info_msg_pptr - place to store a reservation configuration
* pointer
* RET 0 or a slurm error code
* NOTE: free the response using slurm_free_reservation_info_msg
*/
extern int slurm_load_reservations (time_t update_time,
reserve_info_msg_t **resp)
{
int rc;
slurm_msg_t req_msg;
slurm_msg_t resp_msg;
resv_info_request_msg_t req;
slurm_msg_t_init(&req_msg);
slurm_msg_t_init(&resp_msg);
req.last_update = update_time;
req_msg.msg_type = REQUEST_RESERVATION_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_RESERVATION_INFO:
*resp = (reserve_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;
}
示例9: slurm_load_node2
/*
* slurm_load_node2 - equivalent to slurm_load_node() with addition
* of cluster record for communications in a federation
*/
extern int slurm_load_node2(time_t update_time, node_info_msg_t **resp,
uint16_t show_flags, slurmdb_cluster_rec_t *cluster)
{
slurm_msg_t req_msg;
node_info_request_msg_t req;
slurm_msg_t_init(&req_msg);
memset(&req, 0, sizeof(req));
req.last_update = update_time;
req.show_flags = show_flags;
req_msg.msg_type = REQUEST_NODE_INFO;
req_msg.data = &req;
return _load_cluster_nodes(&req_msg, resp, cluster, show_flags);
}
示例10: slurm_load_node
/*
* slurm_load_node - issue RPC to get slurm all node configuration information
* if changed since update_time
* IN update_time - time of current configuration data
* OUT resp - place to store a node configuration pointer
* 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(time_t update_time, node_info_msg_t **resp,
uint16_t show_flags)
{
slurm_msg_t req_msg;
node_info_request_msg_t req;
char *cluster_name = NULL;
void *ptr = NULL;
slurmdb_federation_rec_t *fed;
int rc;
if (working_cluster_rec)
cluster_name = xstrdup(working_cluster_rec->name);
else
cluster_name = slurm_get_cluster_name();
if ((show_flags & SHOW_FEDERATION) && !(show_flags & SHOW_LOCAL) &&
(slurm_load_federation(&ptr) == SLURM_SUCCESS) &&
cluster_in_federation(ptr, cluster_name)) {
/* In federation. Need full info from all clusters */
update_time = (time_t) 0;
show_flags &= (~SHOW_LOCAL);
} else {
/* Report local cluster info only */
show_flags |= SHOW_LOCAL;
show_flags &= (~SHOW_FEDERATION);
}
slurm_msg_t_init(&req_msg);
memset(&req, 0, sizeof(req));
req.last_update = update_time;
req.show_flags = show_flags;
req_msg.msg_type = REQUEST_NODE_INFO;
req_msg.data = &req;
if ((show_flags & SHOW_FEDERATION) && ptr) { /* "ptr" check for CLANG */
fed = (slurmdb_federation_rec_t *) ptr;
rc = _load_fed_nodes(&req_msg, resp, show_flags, cluster_name,
fed);
} else {
rc = _load_cluster_nodes(&req_msg, resp, working_cluster_rec,
show_flags);
}
if (ptr)
slurm_destroy_federation_rec(ptr);
xfree(cluster_name);
return rc;
}
示例11: slurm_load_node_single2
/*
* slurm_load_node_single2 - equivalent to slurm_load_node_single() with
* addition of cluster record for communications in a federation
*/
extern int slurm_load_node_single2(node_info_msg_t **resp, char *node_name,
uint16_t show_flags,
slurmdb_cluster_rec_t *cluster)
{
slurm_msg_t req_msg;
node_info_single_msg_t req;
slurm_msg_t_init(&req_msg);
memset(&req, 0, sizeof(req));
req.node_name = node_name;
req.show_flags = show_flags;
req_msg.msg_type = REQUEST_NODE_INFO_SINGLE;
req_msg.data = &req;
return _load_cluster_nodes(&req_msg, resp, cluster, show_flags);
}
示例12: slurm_send_kvs_comm_set
/* Transmit PMI Keyval space data */
int slurm_send_kvs_comm_set(struct kvs_comm_set *kvs_set_ptr,
int pmi_rank, int pmi_size)
{
slurm_msg_t msg_send;
int rc, retries = 0, timeout = 0;
if (kvs_set_ptr == NULL)
return EINVAL;
if ((rc = _get_addr()) != SLURM_SUCCESS)
return rc;
_set_pmi_time();
slurm_msg_t_init(&msg_send);
msg_send.address = srun_addr;
msg_send.msg_type = PMI_KVS_PUT_REQ;
msg_send.data = (void *) kvs_set_ptr;
/* Send the RPC to the local srun communcation manager.
* Since the srun can be sent thousands of messages at
* the same time and refuse some connections, retry as
* needed. Spread out messages by task's rank. Also
* increase the timeout if many tasks since the srun
* command is very overloaded.
* We also increase the timeout (default timeout is
* 10 secs). */
_delay_rpc(pmi_rank, pmi_size);
if (pmi_size > 4000) /* 240 secs */
timeout = slurm_get_msg_timeout() * 24000;
else if (pmi_size > 1000) /* 120 secs */
timeout = slurm_get_msg_timeout() * 12000;
else if (pmi_size > 100) /* 50 secs */
timeout = slurm_get_msg_timeout() * 5000;
else if (pmi_size > 10) /* 20 secs */
timeout = slurm_get_msg_timeout() * 2000;
while (slurm_send_recv_rc_msg_only_one(&msg_send, &rc, timeout) < 0) {
if (retries++ > MAX_RETRIES) {
error("slurm_send_kvs_comm_set: %m");
return SLURM_ERROR;
} else
debug("send_kvs retry %d", retries);
_delay_rpc(pmi_rank, pmi_size);
}
return rc;
}
示例13: slurm_requeue
/*
* slurm_requeue - re-queue a batch job, if already running
* then terminate it first
* IN job_id - job on which to perform operation
* RET 0 or a slurm error code
*/
extern int slurm_requeue (uint32_t job_id)
{
int rc;
job_id_msg_t requeue_req;
slurm_msg_t req_msg;
slurm_msg_t_init(&req_msg);
requeue_req.job_id = job_id;
req_msg.msg_type = REQUEST_JOB_REQUEUE;
req_msg.data = &requeue_req;
if (slurm_send_recv_controller_rc_msg(&req_msg, &rc) < 0)
return SLURM_ERROR;
slurm_seterrno(rc);
return rc;
}
示例14: slurm_load_partitions2
/*
* slurm_load_partitions2 - equivalent to slurm_load_partitions() with addition
* of cluster record for communications in a federation
*/
extern int slurm_load_partitions2(time_t update_time,
partition_info_msg_t **resp,
uint16_t show_flags,
slurmdb_cluster_rec_t *cluster)
{
slurm_msg_t req_msg;
part_info_request_msg_t req;
slurm_msg_t_init(&req_msg);
req.last_update = update_time;
req.show_flags = show_flags;
req_msg.msg_type = REQUEST_PARTITION_INFO;
req_msg.data = &req;
return _load_cluster_parts(&req_msg, resp, cluster);
}
示例15: _acct_kill_step
/* _acct_kill_step() issue RPC to kill a slurm job step */
static void _acct_kill_step(void)
{
slurm_msg_t msg;
job_step_kill_msg_t req;
slurm_msg_t_init(&msg);
/*
* Request message:
*/
req.job_id = jobacct_job_id;
req.job_step_id = jobacct_step_id;
req.signal = SIGKILL;
req.batch_flag = 0;
msg.msg_type = REQUEST_CANCEL_JOB_STEP;
msg.data = &req;
slurm_send_only_controller_msg(&msg);
}