本文整理汇总了C++中slurm_perror函数的典型用法代码示例。如果您正苦于以下问题:C++ slurm_perror函数的具体用法?C++ slurm_perror怎么用?C++ slurm_perror使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了slurm_perror函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
int rc = 0;
slurm_conf_init(NULL);
parse_command_line(argc, argv);
if (sdiag_param == STAT_COMMAND_RESET) {
req.command_id = STAT_COMMAND_RESET;
rc = slurm_reset_statistics((stats_info_request_msg_t *)&req);
if (rc == SLURM_SUCCESS)
printf("Reset scheduling statistics\n");
else
slurm_perror("slurm_reset_statistics");
} else {
req.command_id = STAT_COMMAND_GET;
rc = slurm_get_statistics(&buf,
(stats_info_request_msg_t *)&req);
if (rc == SLURM_SUCCESS) {
_sort_rpc();
rc = _print_stats();
#ifdef MEMORY_LEAK_DEBUG
uid_cache_clear();
slurm_free_stats_response_msg(buf);
xfree(rpc_type_ave_time);
xfree(rpc_user_ave_time);
#endif
} else
slurm_perror("slurm_get_statistics");
}
exit(rc);
}
示例2: _get_job_size
static int _get_job_size(uint32_t job_id)
{
job_info_msg_t *job_buffer_ptr;
job_info_t * job_ptr;
int i, size = 1;
hostlist_t hl;
if (slurm_load_jobs((time_t) 0, &job_buffer_ptr, SHOW_ALL)) {
slurm_perror("slurm_load_jobs");
return 1;
}
for (i = 0; i < job_buffer_ptr->record_count; i++) {
job_ptr = &job_buffer_ptr->job_array[i];
if (job_ptr->job_id != job_id)
continue;
hl = hostlist_create(job_ptr->nodes);
if (hl) {
size = hostlist_count(hl);
hostlist_destroy(hl);
}
break;
}
slurm_free_job_info_msg (job_buffer_ptr);
#if _DEBUG
printf("Size is %d\n", size);
#endif
return size;
}
示例3: scontrol_print_licenses
/* scontrol_print_licenses()
*
* Retrieve and display the license information
* from the controller
*
*/
void
scontrol_print_licenses(const char *name)
{
int cc;
license_info_msg_t *msg;
uint16_t show_flags;
static time_t last_update;
show_flags = 0;
/* call the controller to get the meat
*/
cc = slurm_load_licenses(last_update, &msg, show_flags);
if (cc != SLURM_PROTOCOL_SUCCESS) {
/* Hosed, crap out.
*/
exit_code = 1;
if (quiet_flag != 1)
slurm_perror ("slurm_load_license error");
return;
}
last_update = time(NULL);
/* print the info
*/
_print_license_info(name, msg);
/* free at last
*/
slurm_free_license_info_msg(msg);
return;
}
示例4: _bg_report
/*
* _bg_report - download and print current bgblock state information
*/
static int _bg_report(block_info_msg_t *block_ptr)
{
int i;
if (!block_ptr) {
slurm_perror("No block_ptr given");
return SLURM_ERROR;
}
if (!params.no_header)
printf("BG_BLOCK MIDPLANES STATE CONNECTION USE\n");
/* 1234567890123456 123456789012 12345678 1234567890 12345+ */
/* RMP_22Apr1544018 bg[123x456] READY TORUS COPROCESSOR */
for (i=0; i<block_ptr->record_count; i++) {
char *conn_str = conn_type_string_full(
block_ptr->block_array[i].conn_type);
printf("%-16.16s %-15.15s %-8.8s %-10.10s %s\n",
block_ptr->block_array[i].bg_block_id,
block_ptr->block_array[i].mp_str,
bg_block_state_string(
block_ptr->block_array[i].state),
conn_str,
node_use_string(
block_ptr->block_array[i].node_use));
xfree(conn_str);
}
return SLURM_SUCCESS;
}
示例5: _clear_trigger
static int _clear_trigger(void)
{
trigger_info_t ti;
char tmp_c[128];
slurm_init_trigger_msg(&ti);
ti.trig_id = params.trigger_id;
ti.user_id = params.user_id;
if (params.job_id) {
ti.res_type = TRIGGER_RES_TYPE_JOB;
snprintf(tmp_c, sizeof(tmp_c), "%u", params.job_id);
ti.res_id = tmp_c;
}
if (slurm_clear_trigger(&ti)) {
if (!params.quiet) {
slurm_perror("slurm_clear_trigger");
return 1;
}
return 0;
}
if (params.job_id)
verbose("triggers for job %s cleared", ti.res_id);
else if (params.user_id != NO_VAL)
verbose("triggers for user %u cleared", ti.user_id);
else
verbose("trigger %u cleared", ti.trig_id);
return 0;
}
示例6: scontrol_print_cache
void
scontrol_print_cache(const char *name)
{
int cc;
cache_info_msg_t *msg;
uint16_t show_flags;
show_flags = 0;
/* call the controller to get the meat
*/
cc = slurm_load_cache(&msg, show_flags);
if (cc != SLURM_PROTOCOL_SUCCESS) {
/* Hosed, crap out.
*/
exit_code = 1;
if (quiet_flag != 1)
slurm_perror ("slurm_load_cache error");
return;
}
/* print the info
*/
_print_cache_info(name, msg);
/* free at last
*/
slurm_free_cache_info_msg(msg);
return;
}
示例7: state_control_configured_tres
extern int state_control_configured_tres(char *type)
{
int i, cc;
int rc = SLURM_ERROR;
assoc_mgr_info_request_msg_t req;
assoc_mgr_info_msg_t *msg = NULL;
memset(&req, 0, sizeof(assoc_mgr_info_request_msg_t));
cc = slurm_load_assoc_mgr_info(&req, &msg);
if (cc != SLURM_PROTOCOL_SUCCESS) {
slurm_perror("slurm_load_assoc_mgr_info error");
goto cleanup;
}
for (i = 0; i < msg->tres_cnt; ++i) {
if (!xstrcasecmp(msg->tres_names[i], type)) {
rc = SLURM_SUCCESS;
goto cleanup;
}
}
cleanup:
slurm_free_assoc_mgr_info_msg(msg);
return rc;
}
示例8: _is_configured_tres
/* -1 = error, 0 = is configured, 1 = isn't configured */
static int _is_configured_tres(char *type)
{
int i, cc;
assoc_mgr_info_request_msg_t req;
assoc_mgr_info_msg_t *msg = NULL;
memset(&req, 0, sizeof(assoc_mgr_info_request_msg_t));
cc = slurm_load_assoc_mgr_info(&req, &msg);
if (cc != SLURM_PROTOCOL_SUCCESS) {
slurm_perror("slurm_load_assoc_mgr_info error");
slurm_free_assoc_mgr_info_msg(msg);
return SLURM_ERROR;
}
for (i = 0; i < msg->tres_cnt; ++i) {
if (!strcasecmp(msg->tres_names[i], type)) {
slurm_free_assoc_mgr_info_msg(msg);
return SLURM_SUCCESS;
}
}
error("'%s' is not a configured TRES", type);
slurm_free_assoc_mgr_info_msg(msg);
return SLURM_ERROR;
}
示例9: scontrol_create_part
/*
* scontrol_create_part - create a slurm partition configuration per the
* supplied arguments
* IN argc - count of arguments
* IN argv - list of arguments
* RET 0 if no slurm error, errno otherwise. parsing error prints
* error message and returns 0
*/
extern int
scontrol_create_part (int argc, char *argv[])
{
int update_cnt = 0;
update_part_msg_t part_msg;
slurm_init_part_desc_msg ( &part_msg );
scontrol_parse_part_options (argc, argv, &update_cnt, &part_msg);
if (part_msg.name == NULL) {
exit_code = 1;
error("PartitionName must be given.");
return 0;
} else if (xstrcasecmp(part_msg.name, "default") == 0) {
exit_code = 1;
error("PartitionName cannot be \"DEFAULT\".");
return 0;
}
if (update_cnt == 0) {
exit_code = 1;
error("No parameters specified");
return 0;
}
if (slurm_create_partition(&part_msg)) {
exit_code = 1;
slurm_perror("Error creating the partition");
return slurm_get_errno ();
} else
return 0;
}
示例10: scontrol_print_node_list
/*
* scontrol_print_node_list - print information about the supplied node list
* (or regular expression)
* IN node_list - print information about the supplied node list
* (or regular expression)
*/
extern void
scontrol_print_node_list (char *node_list)
{
node_info_msg_t *node_info_ptr = NULL;
hostlist_t host_list;
int error_code;
uint16_t show_flags = 0;
char *this_node_name;
if (all_flag)
show_flags |= SHOW_ALL;
if (detail_flag)
show_flags |= SHOW_DETAIL;
error_code = scontrol_load_nodes(&node_info_ptr, show_flags);
if (error_code) {
exit_code = 1;
if (quiet_flag != 1)
slurm_perror ("slurm_load_node error");
return;
}
if (quiet_flag == -1) {
char time_str[32];
slurm_make_time_str ((time_t *)&node_info_ptr->last_update,
time_str, sizeof(time_str));
printf ("last_update_time=%s, records=%d\n",
time_str, node_info_ptr->record_count);
}
if (node_list == NULL) {
scontrol_print_node (NULL, node_info_ptr);
} else {
if ((host_list = hostlist_create (node_list))) {
while ((this_node_name = hostlist_shift (host_list))) {
scontrol_print_node(this_node_name,
node_info_ptr);
free(this_node_name);
}
hostlist_destroy(host_list);
} else {
exit_code = 1;
if (quiet_flag != 1) {
if (errno == EINVAL) {
fprintf(stderr,
"unable to parse node list %s\n",
node_list);
} else if (errno == ERANGE) {
fprintf(stderr,
"too many nodes in supplied range %s\n",
node_list);
} else
perror("error parsing node list");
}
}
}
return;
}
示例11: _print_job_steps
/* _print_job_step - print the specified job step's information */
static int
_print_job_steps( bool clear_old )
{
int error_code;
static job_step_info_response_msg_t * old_step_ptr = NULL;
static job_step_info_response_msg_t * new_step_ptr;
uint16_t show_flags = 0;
if (params.all_flag)
show_flags |= SHOW_ALL;
if (old_step_ptr) {
if (clear_old)
old_step_ptr->last_update = 0;
/* Use a last_update time of 0 so that we can get an updated
* run_time for jobs rather than just its start_time */
error_code = slurm_get_job_steps((time_t) 0, NO_VAL, NO_VAL,
&new_step_ptr, show_flags);
if (error_code == SLURM_SUCCESS)
slurm_free_job_step_info_response_msg( old_step_ptr );
else if (slurm_get_errno () == SLURM_NO_CHANGE_IN_DATA) {
error_code = SLURM_SUCCESS;
new_step_ptr = old_step_ptr;
}
} else {
error_code = slurm_get_job_steps((time_t) 0, NO_VAL, NO_VAL,
&new_step_ptr, show_flags);
}
if (error_code) {
slurm_perror ("slurm_get_job_steps error");
return SLURM_ERROR;
}
old_step_ptr = new_step_ptr;
if (params.verbose) {
printf ("last_update_time=%ld records=%u\n",
(long) new_step_ptr->last_update,
new_step_ptr->job_step_count);
}
if (!params.format && !params.format_long)
params.format = "%.15i %.8j %.9P %.8u %.9M %N";
if (!params.format_list) {
if (params.format)
parse_format(params.format);
else if (params.format_long)
parse_long_format(params.format_long);
}
print_steps_array( new_step_ptr->job_steps,
new_step_ptr->job_step_count,
params.format_list );
return SLURM_SUCCESS;
}
示例12: _get_info
static int _get_info(void)
{
int rc;
req.command_id = STAT_COMMAND_GET;
rc = slurm_get_statistics(&buf, (stats_info_request_msg_t *)&req);
if (rc != SLURM_SUCCESS)
slurm_perror("slurm_get_statistics");
return rc;
}
示例13: scontrol_print_completing
/*
* scontrol_print_completing - print jobs in completing state and
* associated nodes in COMPLETING or DOWN state
*/
extern void
scontrol_print_completing (void)
{
int error_code, i;
job_info_msg_t *job_info_msg;
job_info_t *job_info;
node_info_msg_t *node_info_msg;
uint16_t show_flags = 0;
error_code = scontrol_load_job (&job_info_msg, 0);
if (error_code) {
exit_code = 1;
if (quiet_flag != 1)
slurm_perror ("slurm_load_jobs error");
return;
}
/* Must load all nodes including hidden for cross-index
* from job's node_inx to node table to work */
/*if (all_flag) Always set this flag */
show_flags |= SHOW_ALL;
if (federation_flag)
show_flags |= SHOW_FEDERATION;
if (local_flag)
show_flags |= SHOW_LOCAL;
error_code = scontrol_load_nodes(&node_info_msg, show_flags);
if (error_code) {
exit_code = 1;
if (quiet_flag != 1)
slurm_perror ("slurm_load_nodes error");
return;
}
/* Scan the jobs for completing state */
job_info = job_info_msg->job_array;
for (i = 0; i < job_info_msg->record_count; i++) {
if (job_info[i].job_state & JOB_COMPLETING)
scontrol_print_completing_job(&job_info[i],
node_info_msg);
}
slurm_free_node_info_msg(node_info_msg);
}
示例14: _reservation_report
/*
* _reservation_report - print current reservation information
*/
static int _reservation_report(reserve_info_msg_t *resv_ptr)
{
if (!resv_ptr) {
slurm_perror("No resv_ptr given\n");
return SLURM_ERROR;
}
if (resv_ptr->record_count != 0) {
print_sinfo_reservation(resv_ptr);
} else
printf ("No reservations in the system\n");
return SLURM_SUCCESS;
}
示例15: main
/* DO NOT RUN AGAINST PRODUCTION NODES, IT CAN MESS UP STATE */
int
main (int argc, char *argv[]) {
int error_code;
update_part_msg_t part_update1 ;
update_part_msg_t part_update2 ;
update_node_msg_t node_update1 ;
update_node_msg_t node_update2 ;
char node_name[NAME_LEN];
slurm_init_part_desc_msg ( &part_update1 );
slurm_init_part_desc_msg ( &part_update2 );
part_update1 . name = "batch" ;
part_update2 . name = "batch" ;
part_update1 . state_up = false ;
part_update2 . state_up = true ;
_getnodename(node_name, NAME_LEN);
node_update1 . node_names = node_name ;
node_update2 . node_names = node_name ;
node_update1 . node_state = NODE_STATE_DRAIN ;
node_update2 . node_state = NODE_RESUME ;
error_code = slurm_update_partition ( &part_update1);
if (error_code)
slurm_perror ("slurm_update_partition #1");
error_code = slurm_update_partition ( &part_update2);
if (error_code)
slurm_perror ("slurm_update_partition #2");
error_code = slurm_update_node ( &node_update1);
if (error_code)
slurm_perror ("slurm_update_node #1");
error_code = slurm_update_node ( &node_update2);
if (error_code)
slurm_perror ("slurm_update_node #2");
return (errno);
}