extern uint16_t job_preempt_mode(struct job_record *job_ptr) { uint16_t mode; if (job_ptr->qos_ptr && ((slurmdb_qos_rec_t *)job_ptr->qos_ptr)->preempt_mode) { mode = ((slurmdb_qos_rec_t *)job_ptr->qos_ptr)->preempt_mode; if (slurm_get_debug_flags() & DEBUG_FLAG_PRIO) { info("%s: in job_preempt_mode return = %s", plugin_type, preempt_mode_string(mode)); } return mode; } mode = slurm_get_preempt_mode() & (~PREEMPT_MODE_GANG); if (slurm_get_debug_flags() & DEBUG_FLAG_PRIO) { info("%s: in job_preempt_mode return = %s", plugin_type, preempt_mode_string(mode)); } return mode; }
int _print_preempt_mode(sinfo_data_t * sinfo_data, int width, bool right_justify, char *suffix) { if (sinfo_data) { uint16_t preempt_mode = sinfo_data->part_info->preempt_mode; if (preempt_mode == (uint16_t) NO_VAL) preempt_mode = slurm_get_preempt_mode(); _print_str(preempt_mode_string(preempt_mode), width, right_justify, true); } else _print_str("PREEMPT_MODE", width, right_justify, true); if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
/* * update_part - create or update a partition's configuration data * IN part_desc - description of partition changes * IN create_flag - create a new partition * RET 0 or an error code * global: part_list - list of partition entries * last_part_update - update time of partition records */ extern int update_part (update_part_msg_t * part_desc, bool create_flag) { int error_code; struct part_record *part_ptr; if (part_desc->name == NULL) { info("update_part: invalid partition name, NULL"); return ESLURM_INVALID_PARTITION_NAME; } error_code = SLURM_SUCCESS; part_ptr = list_find_first(part_list, &list_find_part, part_desc->name); if (create_flag) { if (part_ptr) { verbose("Duplicate partition name for create (%s)", part_desc->name); return ESLURM_INVALID_PARTITION_NAME; } info("update_part: partition %s being created", part_desc->name); part_ptr = create_part_record(); xfree(part_ptr->name); part_ptr->name = xstrdup(part_desc->name); } else { if (!part_ptr) { verbose("Update for partition not found (%s)", part_desc->name); return ESLURM_INVALID_PARTITION_NAME; } } last_part_update = time(NULL); if (part_desc->max_cpus_per_node != NO_VAL) { info("update_part: setting MaxCPUsPerNode to %u for partition %s", part_desc->max_cpus_per_node, part_desc->name); part_ptr->max_cpus_per_node = part_desc->max_cpus_per_node; } if (part_desc->max_time != NO_VAL) { info("update_part: setting max_time to %u for partition %s", part_desc->max_time, part_desc->name); part_ptr->max_time = part_desc->max_time; } if ((part_desc->default_time != NO_VAL) && (part_desc->default_time > part_ptr->max_time)) { info("update_part: DefaultTime would exceed MaxTime for " "partition %s", part_desc->name); } else if (part_desc->default_time != NO_VAL) { info("update_part: setting default_time to %u " "for partition %s", part_desc->default_time, part_desc->name); part_ptr->default_time = part_desc->default_time; } if (part_desc->max_nodes != NO_VAL) { info("update_part: setting max_nodes to %u for partition %s", part_desc->max_nodes, part_desc->name); part_ptr->max_nodes = part_desc->max_nodes; part_ptr->max_nodes_orig = part_desc->max_nodes; select_g_alter_node_cnt(SELECT_SET_MP_CNT, &part_ptr->max_nodes); } if (part_desc->min_nodes != NO_VAL) { info("update_part: setting min_nodes to %u for partition %s", part_desc->min_nodes, part_desc->name); part_ptr->min_nodes = part_desc->min_nodes; part_ptr->min_nodes_orig = part_desc->min_nodes; select_g_alter_node_cnt(SELECT_SET_MP_CNT, &part_ptr->min_nodes); } if (part_desc->grace_time != NO_VAL) { info("update_part: setting grace_time to %u for partition %s", part_desc->grace_time, part_desc->name); part_ptr->grace_time = part_desc->grace_time; } if (part_desc->flags & PART_FLAG_HIDDEN) { info("update_part: setting hidden for partition %s", part_desc->name); part_ptr->flags |= PART_FLAG_HIDDEN; } else if (part_desc->flags & PART_FLAG_HIDDEN_CLR) { info("update_part: clearing hidden for partition %s", part_desc->name); part_ptr->flags &= (~PART_FLAG_HIDDEN); } if (part_desc->flags & PART_FLAG_REQ_RESV) { info("update_part: setting req_resv for partition %s", part_desc->name); part_ptr->flags |= PART_FLAG_REQ_RESV; } else if (part_desc->flags & PART_FLAG_REQ_RESV_CLR) { info("update_part: clearing req_resv for partition %s", part_desc->name); part_ptr->flags &= (~PART_FLAG_REQ_RESV); } if (part_desc->flags & PART_FLAG_ROOT_ONLY) { info("update_part: setting root_only for partition %s", part_desc->name); part_ptr->flags |= PART_FLAG_ROOT_ONLY; } else if (part_desc->flags & PART_FLAG_ROOT_ONLY_CLR) { info("update_part: clearing root_only for partition %s", part_desc->name); part_ptr->flags &= (~PART_FLAG_ROOT_ONLY); } if (part_desc->flags & PART_FLAG_NO_ROOT) { info("update_part: setting no_root for partition %s", part_desc->name); part_ptr->flags |= PART_FLAG_NO_ROOT; } else if (part_desc->flags & PART_FLAG_NO_ROOT_CLR) { info("update_part: clearing no_root for partition %s", part_desc->name); part_ptr->flags &= (~PART_FLAG_NO_ROOT); } if (part_desc->flags & PART_FLAG_DEFAULT) { if (default_part_name == NULL) { info("update_part: setting default partition to %s", part_desc->name); } else if (strcmp(default_part_name, part_desc->name) != 0) { info("update_part: changing default " "partition from %s to %s", default_part_name, part_desc->name); } xfree(default_part_name); default_part_name = xstrdup(part_desc->name); default_part_loc = part_ptr; part_ptr->flags |= PART_FLAG_DEFAULT; } else if ((part_desc->flags & PART_FLAG_DEFAULT_CLR) && (default_part_loc == part_ptr)) { info("update_part: clearing default partition from %s", part_desc->name); xfree(default_part_name); default_part_loc = NULL; part_ptr->flags &= (~PART_FLAG_DEFAULT); } if (part_desc->state_up != (uint16_t) NO_VAL) { info("update_part: setting state_up to %u for partition %s", part_desc->state_up, part_desc->name); part_ptr->state_up = part_desc->state_up; } if (part_desc->max_share != (uint16_t) NO_VAL) { uint16_t force = part_desc->max_share & SHARED_FORCE; uint16_t val = part_desc->max_share & (~SHARED_FORCE); char tmp_str[24]; if (val == 0) snprintf(tmp_str, sizeof(tmp_str), "EXCLUSIVE"); else if (force) snprintf(tmp_str, sizeof(tmp_str), "FORCE:%u", val); else if (val == 1) snprintf(tmp_str, sizeof(tmp_str), "NO"); else snprintf(tmp_str, sizeof(tmp_str), "YES:%u", val); info("update_part: setting share to %s for partition %s", tmp_str, part_desc->name); part_ptr->max_share = part_desc->max_share; } if (part_desc->preempt_mode != (uint16_t) NO_VAL) { uint16_t new_mode; new_mode = part_desc->preempt_mode & (~PREEMPT_MODE_GANG); if (new_mode <= PREEMPT_MODE_CANCEL) { info("update_part: setting preempt_mode to %s for " "partition %s", preempt_mode_string(new_mode), part_desc->name); part_ptr->preempt_mode = new_mode; } else { info("update_part: invalid preempt_mode %u", new_mode); } } if (part_desc->priority != (uint16_t) NO_VAL) { info("update_part: setting priority to %u for partition %s", part_desc->priority, part_desc->name); part_ptr->priority = part_desc->priority; /* If the max_priority changes we need to change all * the normalized priorities of all the other * partitions. If not then just set this partition. */ if (part_ptr->priority > part_max_priority) { ListIterator itr = list_iterator_create(part_list); struct part_record *part2 = NULL; part_max_priority = part_ptr->priority; while((part2 = list_next(itr))) { part2->norm_priority = (double)part2->priority / (double)part_max_priority; } list_iterator_destroy(itr); } else { part_ptr->norm_priority = (double)part_ptr->priority / (double)part_max_priority; } } if (part_desc->allow_groups != NULL) { xfree(part_ptr->allow_groups); xfree(part_ptr->allow_uids); if ((strcasecmp(part_desc->allow_groups, "ALL") == 0) || (part_desc->allow_groups[0] == '\0')) { info("update_part: setting allow_groups to ALL for " "partition %s", part_desc->name); } else { part_ptr->allow_groups = part_desc->allow_groups; part_desc->allow_groups = NULL; info("update_part: setting allow_groups to %s for " "partition %s", part_ptr->allow_groups, part_desc->name); part_ptr->allow_uids = _get_groups_members(part_ptr->allow_groups); clear_group_cache(); } } if (part_desc->allow_alloc_nodes != NULL) { xfree(part_ptr->allow_alloc_nodes); if ((part_desc->allow_alloc_nodes[0] == '\0') || (strcasecmp(part_desc->allow_alloc_nodes, "ALL") == 0)) { part_ptr->allow_alloc_nodes = NULL; info("update_part: setting allow_alloc_nodes to ALL" " for partition %s",part_desc->name); } else { part_ptr->allow_alloc_nodes = part_desc-> allow_alloc_nodes; part_desc->allow_alloc_nodes = NULL; info("update_part: setting allow_alloc_nodes to %s for " "partition %s", part_ptr->allow_alloc_nodes, part_desc->name); } } if (part_desc->alternate != NULL) { xfree(part_ptr->alternate); if ((strcasecmp(part_desc->alternate, "NONE") == 0) || (part_desc->alternate[0] == '\0')) part_ptr->alternate = NULL; else part_ptr->alternate = xstrdup(part_desc->alternate); part_desc->alternate = NULL; info("update_part: setting alternate to %s for " "partition %s", part_ptr->alternate, part_desc->name); } if (part_desc->def_mem_per_cpu != NO_VAL) { char *key; uint32_t value; if (part_desc->def_mem_per_cpu & MEM_PER_CPU) { key = "DefMemPerCpu"; value = part_desc->def_mem_per_cpu & (~MEM_PER_CPU); } else { key = "DefMemPerNode"; value = part_desc->def_mem_per_cpu; } info("update_part: setting %s to %u for partition %s", key, value, part_desc->name); part_ptr->def_mem_per_cpu = part_desc->def_mem_per_cpu; } if (part_desc->max_mem_per_cpu != NO_VAL) { char *key; uint32_t value; if (part_desc->max_mem_per_cpu & MEM_PER_CPU) { key = "MaxMemPerCpu"; value = part_desc->max_mem_per_cpu & (~MEM_PER_CPU); } else { key = "MaxMemPerNode"; value = part_desc->max_mem_per_cpu; } info("update_part: setting %s to %u for partition %s", key, value, part_desc->name); part_ptr->max_mem_per_cpu = part_desc->max_mem_per_cpu; } if (part_desc->nodes != NULL) { char *backup_node_list = part_ptr->nodes; if (part_desc->nodes[0] == '\0') part_ptr->nodes = NULL; /* avoid empty string */ else { int i; part_ptr->nodes = xstrdup(part_desc->nodes); for (i=0; part_ptr->nodes[i]; i++) { if (isspace(part_ptr->nodes[i])) part_ptr->nodes[i] = ','; } } error_code = _build_part_bitmap(part_ptr); if (error_code) { xfree(part_ptr->nodes); part_ptr->nodes = backup_node_list; } else { info("update_part: setting nodes to %s " "for partition %s", part_ptr->nodes, part_desc->name); xfree(backup_node_list); } update_part_nodes_in_resv(part_ptr); } else if (part_ptr->node_bitmap == NULL) { /* Newly created partition needs a bitmap, even if empty */ part_ptr->node_bitmap = bit_alloc(node_record_count); } if (error_code == SLURM_SUCCESS) { slurm_sched_partition_change(); /* notify sched plugin */ select_g_reconfigure(); /* notify select plugin too */ } return error_code; }
/* * slurm_sprint_partition_info - output information about a specific Slurm * partition based upon message as loaded using slurm_load_partitions * IN part_ptr - an individual partition information record pointer * IN one_liner - print as a single line if true * RET out - char * containing formatted output (must be freed after call) * NULL is returned on failure. */ char *slurm_sprint_partition_info ( partition_info_t * part_ptr, int one_liner ) { char tmp[16]; char *out = NULL; char *allow_deny, *value; uint16_t force, preempt_mode, val; uint32_t cluster_flags = slurmdb_setup_cluster_flags(); char *line_end = (one_liner) ? " " : "\n "; /****** Line 1 ******/ xstrfmtcat(out, "PartitionName=%s", part_ptr->name); xstrcat(out, line_end); /****** Line 2 ******/ if ((part_ptr->allow_groups == NULL) || (part_ptr->allow_groups[0] == '\0')) xstrcat(out, "AllowGroups=ALL"); else { xstrfmtcat(out, "AllowGroups=%s", part_ptr->allow_groups); } if (part_ptr->allow_accounts || !part_ptr->deny_accounts) { allow_deny = "Allow"; if ((part_ptr->allow_accounts == NULL) || (part_ptr->allow_accounts[0] == '\0')) value = "ALL"; else value = part_ptr->allow_accounts; } else { allow_deny = "Deny"; value = part_ptr->deny_accounts; } xstrfmtcat(out, " %sAccounts=%s", allow_deny, value); if (part_ptr->allow_qos || !part_ptr->deny_qos) { allow_deny = "Allow"; if ((part_ptr->allow_qos == NULL) || (part_ptr->allow_qos[0] == '\0')) value = "ALL"; else value = part_ptr->allow_qos; } else { allow_deny = "Deny"; value = part_ptr->deny_qos; } xstrfmtcat(out, " %sQos=%s", allow_deny, value); xstrcat(out, line_end); /****** Line 3 ******/ if (part_ptr->allow_alloc_nodes == NULL) xstrcat(out, "AllocNodes=ALL"); else xstrfmtcat(out, "AllocNodes=%s", part_ptr->allow_alloc_nodes); if (part_ptr->alternate != NULL) { xstrfmtcat(out, " Alternate=%s", part_ptr->alternate); } if (part_ptr->flags & PART_FLAG_DEFAULT) xstrcat(out, " Default=YES"); else xstrcat(out, " Default=NO"); if (part_ptr->qos_char) xstrfmtcat(out, " QoS=%s", part_ptr->qos_char); else xstrcat(out, " QoS=N/A"); xstrcat(out, line_end); /****** Line 4 added here for BG partitions only ****** to maintain alphabetized output ******/ if (cluster_flags & CLUSTER_FLAG_BG) { xstrfmtcat(out, "Midplanes=%s", part_ptr->nodes); xstrcat(out, line_end); } /****** Line 5 ******/ if (part_ptr->default_time == INFINITE) xstrcat(out, "DefaultTime=UNLIMITED"); else if (part_ptr->default_time == NO_VAL) xstrcat(out, "DefaultTime=NONE"); else { char time_line[32]; secs2time_str(part_ptr->default_time * 60, time_line, sizeof(time_line)); xstrfmtcat(out, "DefaultTime=%s", time_line); } if (part_ptr->flags & PART_FLAG_NO_ROOT) xstrcat(out, " DisableRootJobs=YES"); else xstrcat(out, " DisableRootJobs=NO"); if (part_ptr->flags & PART_FLAG_EXCLUSIVE_USER) xstrcat(out, " ExclusiveUser=YES"); else xstrcat(out, " ExclusiveUser=NO"); xstrfmtcat(out, " GraceTime=%u", part_ptr->grace_time); if (part_ptr->flags & PART_FLAG_HIDDEN) xstrcat(out, " Hidden=YES"); else xstrcat(out, " Hidden=NO"); xstrcat(out, line_end); /****** Line 6 ******/ if (part_ptr->max_nodes == INFINITE) xstrcat(out, "MaxNodes=UNLIMITED"); else { if (cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit((float)part_ptr->max_nodes, tmp, sizeof(tmp), UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT); xstrfmtcat(out, "MaxNodes=%s", tmp); } else xstrfmtcat(out, "MaxNodes=%u", part_ptr->max_nodes); } if (part_ptr->max_time == INFINITE) xstrcat(out, " MaxTime=UNLIMITED"); else { char time_line[32]; secs2time_str(part_ptr->max_time * 60, time_line, sizeof(time_line)); xstrfmtcat(out, " MaxTime=%s", time_line); } if (cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit((float)part_ptr->min_nodes, tmp, sizeof(tmp), UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT); xstrfmtcat(out, " MinNodes=%s", tmp); } else xstrfmtcat(out, " MinNodes=%u", part_ptr->min_nodes); if (part_ptr->flags & PART_FLAG_LLN) xstrcat(out, " LLN=YES"); else xstrcat(out, " LLN=NO"); if (part_ptr->max_cpus_per_node == INFINITE) xstrcat(out, " MaxCPUsPerNode=UNLIMITED"); else { xstrfmtcat(out, " MaxCPUsPerNode=%u", part_ptr->max_cpus_per_node); } xstrcat(out, line_end); /****** Line added here for non BG nodes to keep with alphabetized output******/ if (!(cluster_flags & CLUSTER_FLAG_BG)) { xstrfmtcat(out, "Nodes=%s", part_ptr->nodes); xstrcat(out, line_end); } /****** Line 7 ******/ xstrfmtcat(out, "PriorityJobFactor=%u", part_ptr->priority_job_factor); xstrfmtcat(out, " PriorityTier=%u", part_ptr->priority_tier); if (part_ptr->flags & PART_FLAG_ROOT_ONLY) xstrcat(out, " RootOnly=YES"); else xstrcat(out, " RootOnly=NO"); if (part_ptr->flags & PART_FLAG_REQ_RESV) xstrcat(out, " ReqResv=YES"); else xstrcat(out, " ReqResv=NO"); force = part_ptr->max_share & SHARED_FORCE; val = part_ptr->max_share & (~SHARED_FORCE); if (val == 0) xstrcat(out, " OverSubscribe=EXCLUSIVE"); else if (force) xstrfmtcat(out, " OverSubscribe=FORCE:%u", val); else if (val == 1) xstrcat(out, " OverSubscribe=NO"); else xstrfmtcat(out, " OverSubscribe=YES:%u", val); xstrcat(out, line_end); /****** Line ******/ if (part_ptr->over_time_limit == NO_VAL16) xstrfmtcat(out, "OverTimeLimit=NONE"); else if (part_ptr->over_time_limit == (uint16_t) INFINITE) xstrfmtcat(out, "OverTimeLimit=UNLIMITED"); else xstrfmtcat(out, "OverTimeLimit=%u", part_ptr->over_time_limit); preempt_mode = part_ptr->preempt_mode; if (preempt_mode == NO_VAL16) preempt_mode = slurm_get_preempt_mode(); /* use cluster param */ xstrfmtcat(out, " PreemptMode=%s", preempt_mode_string(preempt_mode)); xstrcat(out, line_end); /****** Line ******/ if (part_ptr->state_up == PARTITION_UP) xstrcat(out, "State=UP"); else if (part_ptr->state_up == PARTITION_DOWN) xstrcat(out, "State=DOWN"); else if (part_ptr->state_up == PARTITION_INACTIVE) xstrcat(out, "State=INACTIVE"); else if (part_ptr->state_up == PARTITION_DRAIN) xstrcat(out, "State=DRAIN"); else xstrcat(out, "State=UNKNOWN"); if (cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit((float)part_ptr->total_cpus, tmp, sizeof(tmp), UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT); xstrfmtcat(out, " TotalCPUs=%s", tmp); } else xstrfmtcat(out, " TotalCPUs=%u", part_ptr->total_cpus); if (cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit((float)part_ptr->total_nodes, tmp, sizeof(tmp), UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT); xstrfmtcat(out, " TotalNodes=%s", tmp); } else xstrfmtcat(out, " TotalNodes=%u", part_ptr->total_nodes); xstrfmtcat(out, " SelectTypeParameters=%s", select_type_param_string(part_ptr->cr_type)); xstrcat(out, line_end); /****** Line 9 ******/ if (part_ptr->def_mem_per_cpu & MEM_PER_CPU) { if (part_ptr->def_mem_per_cpu == MEM_PER_CPU) { xstrcat(out, "DefMemPerCPU=UNLIMITED"); } else { xstrfmtcat(out, "DefMemPerCPU=%"PRIu64"", part_ptr->def_mem_per_cpu & (~MEM_PER_CPU)); } } else if (part_ptr->def_mem_per_cpu == 0) { xstrcat(out, "DefMemPerNode=UNLIMITED"); } else { xstrfmtcat(out, "DefMemPerNode=%"PRIu64"", part_ptr->def_mem_per_cpu); } if (part_ptr->max_mem_per_cpu & MEM_PER_CPU) { if (part_ptr->max_mem_per_cpu == MEM_PER_CPU) { xstrcat(out, " MaxMemPerCPU=UNLIMITED"); } else { xstrfmtcat(out, " MaxMemPerCPU=%"PRIu64"", part_ptr->max_mem_per_cpu & (~MEM_PER_CPU)); } } else if (part_ptr->max_mem_per_cpu == 0) { xstrcat(out, " MaxMemPerNode=UNLIMITED"); } else { xstrfmtcat(out, " MaxMemPerNode=%"PRIu64"", part_ptr->max_mem_per_cpu); } /****** Line 10 ******/ if (part_ptr->billing_weights_str) { xstrcat(out, line_end); xstrfmtcat(out, "TRESBillingWeights=%s", part_ptr->billing_weights_str); } if (one_liner) xstrcat(out, "\n"); else xstrcat(out, "\n\n"); return out; }
extern void *slurm_ctl_conf_2_key_pairs (slurm_ctl_conf_t* slurm_ctl_conf_ptr) { List ret_list = NULL; config_key_pair_t *key_pair; char tmp_str[128]; uint32_t cluster_flags = slurmdb_setup_cluster_flags(); if ( slurm_ctl_conf_ptr == NULL ) return NULL; ret_list = list_create(destroy_config_key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("AccountingStorageBackupHost"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->accounting_storage_backup_host); list_append(ret_list, key_pair); accounting_enforce_string(slurm_ctl_conf_ptr-> accounting_storage_enforce, tmp_str, sizeof(tmp_str)); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("AccountingStorageEnforce"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("AccountingStorageHost"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->accounting_storage_host); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("AccountingStorageLoc"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->accounting_storage_loc); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->accounting_storage_port); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("AccountingStoragePort"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("AccountingStorageType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->accounting_storage_type); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("AccountingStorageUser"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->accounting_storage_user); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("AccountingStoreJobComment"); if (slurm_ctl_conf_ptr->acctng_store_job_comment) key_pair->value = xstrdup("YES"); else key_pair->value = xstrdup("NO"); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("AcctGatherEnergyType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->acct_gather_energy_type); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("AcctGatherFilesystemType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->acct_gather_filesystem_type); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("AcctGatherInfinibandType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->acct_gather_infiniband_type); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->acct_gather_node_freq); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("AcctGatherNodeFreq"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("AcctGatherProfileType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->acct_gather_profile_type); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("AuthInfo"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->authinfo); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("AuthType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->authtype); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("BackupAddr"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->backup_addr); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("BackupController"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->backup_controller); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->batch_start_timeout); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("BatchStartTimeout"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); slurm_make_time_str((time_t *)&slurm_ctl_conf_ptr->boot_time, tmp_str, sizeof(tmp_str)); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("BOOT_TIME"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("CacheGroups"); if (slurm_ctl_conf_ptr->group_info & GROUP_CACHE) key_pair->value = xstrdup("1"); else key_pair->value = xstrdup("0"); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("CheckpointType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->checkpoint_type); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("ClusterName"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->cluster_name); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->complete_wait); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("CompleteWait"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("ControlAddr"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->control_addr); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("ControlMachine"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->control_machine); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("CryptoType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->crypto_type); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("DebugFlags"); key_pair->value = debug_flags2str(slurm_ctl_conf_ptr->debug_flags); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); list_append(ret_list, key_pair); if (slurm_ctl_conf_ptr->def_mem_per_cpu & MEM_PER_CPU) { key_pair->name = xstrdup("DefMemPerCPU"); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->def_mem_per_cpu & (~MEM_PER_CPU)); key_pair->value = xstrdup(tmp_str); } else if (slurm_ctl_conf_ptr->def_mem_per_cpu) { key_pair->name = xstrdup("DefMemPerNode"); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->def_mem_per_cpu); key_pair->value = xstrdup(tmp_str); } else { key_pair->name = xstrdup("DefMemPerNode"); key_pair->value = xstrdup("UNLIMITED"); } key_pair = xmalloc(sizeof(config_key_pair_t)); list_append(ret_list, key_pair); key_pair->name = xstrdup("DisableRootJobs"); if (slurm_ctl_conf_ptr->disable_root_jobs) key_pair->value = xstrdup("YES"); else key_pair->value = xstrdup("NO"); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->dynalloc_port); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("DynAllocPort"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); list_append(ret_list, key_pair); key_pair->name = xstrdup("EnforcePartLimits"); if (slurm_ctl_conf_ptr->enforce_part_limits) key_pair->value = xstrdup("YES"); else key_pair->value = xstrdup("NO"); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("Epilog"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->epilog); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u usec", slurm_ctl_conf_ptr->epilog_msg_time); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("EpilogMsgTime"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("EpilogSlurmctld"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->epilog_slurmctld); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("ExtSensorsType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->ext_sensors_type); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->ext_sensors_freq); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("ExtSensorsFreq"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); if (strcmp(slurm_ctl_conf_ptr->priority_type, "priority/basic")) { snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->fs_dampening_factor); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("FairShareDampeningFactor"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); } snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->fast_schedule); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("FastSchedule"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->first_job_id); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("FirstJobId"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->get_env_timeout); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("GetEnvTimeout"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("GresTypes"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->gres_plugins); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("GroupUpdateForce"); if (slurm_ctl_conf_ptr->group_info & GROUP_FORCE) key_pair->value = xstrdup("1"); else key_pair->value = xstrdup("0"); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->group_info & GROUP_TIME_MASK); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("GroupUpdateTime"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); if (slurm_ctl_conf_ptr->hash_val != NO_VAL) { if (slurm_ctl_conf_ptr->hash_val == slurm_get_hash_val()) snprintf(tmp_str, sizeof(tmp_str), "Match"); else { snprintf(tmp_str, sizeof(tmp_str), "Different Ours=0x%x Slurmctld=0x%x", slurm_get_hash_val(), slurm_ctl_conf_ptr->hash_val); } key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("HASH_VAL"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); } snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->health_check_interval); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("HealthCheckInterval"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("HealthCheckNodeState"); key_pair->value = health_check_node_state_str(slurm_ctl_conf_ptr-> health_check_node_state); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("HealthCheckProgram"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->health_check_program); list_append(ret_list, key_pair); if (cluster_flags & CLUSTER_FLAG_XCPU) { key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("HAVE_XCPU"); key_pair->value = xstrdup("1"); list_append(ret_list, key_pair); } snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->inactive_limit); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("InactiveLimit"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("JobAcctGatherFrequency"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->job_acct_gather_freq); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("JobAcctGatherType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->job_acct_gather_type); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("JobAcctGatherParams"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->job_acct_gather_params); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("JobCheckpointDir"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->job_ckpt_dir); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("JobCompHost"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->job_comp_host); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("JobCompLoc"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->job_comp_loc); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->job_comp_port); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("JobCompPort"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("JobCompType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->job_comp_type); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("JobCompUser"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->job_comp_user); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("JobContainerPlugin"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->job_container_plugin); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("JobCredentialPrivateKey"); key_pair->value = xstrdup(slurm_ctl_conf_ptr-> job_credential_private_key); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("JobCredentialPublicCertificate"); key_pair->value = xstrdup( slurm_ctl_conf_ptr->job_credential_public_certificate); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->job_file_append); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("JobFileAppend"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->job_requeue); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("JobRequeue"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("JobSubmitPlugins"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->job_submit_plugins); list_append(ret_list, key_pair); if (slurm_ctl_conf_ptr->keep_alive_time == (uint16_t) NO_VAL) snprintf(tmp_str, sizeof(tmp_str), "SYSTEM_DEFAULT"); else { snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->keep_alive_time); } key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("KeepAliveTime"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->kill_on_bad_exit); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("KillOnBadExit"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->kill_wait); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("KillWait"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("LaunchType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->launch_type); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("Licenses"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->licenses); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("LicensesUsed"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->licenses_used); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("MailProg"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->mail_prog); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->max_array_sz); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("MaxArraySize"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->max_job_cnt); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("MaxJobCount"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->max_job_id); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("MaxJobId"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); list_append(ret_list, key_pair); if (slurm_ctl_conf_ptr->max_mem_per_cpu & MEM_PER_CPU) { key_pair->name = xstrdup("MaxMemPerCPU"); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->max_mem_per_cpu & (~MEM_PER_CPU)); key_pair->value = xstrdup(tmp_str); } else if (slurm_ctl_conf_ptr->max_mem_per_cpu) { key_pair->name = xstrdup("MaxMemPerNode"); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->max_mem_per_cpu); key_pair->value = xstrdup(tmp_str); } else { key_pair->name = xstrdup("MaxMemPerNode"); key_pair->value = xstrdup("UNLIMITED"); } snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->max_step_cnt); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("MaxStepCount"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->max_tasks_per_node); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("MaxTasksPerNode"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->msg_timeout); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("MessageTimeout"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->min_job_age); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("MinJobAge"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("MpiDefault"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->mpi_default); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("MpiParams"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->mpi_params); list_append(ret_list, key_pair); if (cluster_flags & CLUSTER_FLAG_MULTSD) { key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("MULTIPLE_SLURMD"); key_pair->value = xstrdup("1"); list_append(ret_list, key_pair); } snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->next_job_id); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("NEXT_JOB_ID"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); if (slurm_ctl_conf_ptr->over_time_limit == (uint16_t) INFINITE) snprintf(tmp_str, sizeof(tmp_str), "UNLIMITED"); else snprintf(tmp_str, sizeof(tmp_str), "%u min", slurm_ctl_conf_ptr->over_time_limit); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("OverTimeLimit"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PluginDir"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->plugindir); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PlugStackConfig"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->plugstack); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PreemptMode"); key_pair->value = xstrdup(preempt_mode_string(slurm_ctl_conf_ptr-> preempt_mode)); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PreemptType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->preempt_type); list_append(ret_list, key_pair); if (strcmp(slurm_ctl_conf_ptr->priority_type, "priority/basic") == 0) { key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PriorityType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->priority_type); list_append(ret_list, key_pair); } else { secs2time_str((time_t) slurm_ctl_conf_ptr->priority_decay_hl, tmp_str, sizeof(tmp_str)); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PriorityDecayHalfLife"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); secs2time_str((time_t)slurm_ctl_conf_ptr->priority_calc_period, tmp_str, sizeof(tmp_str)); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PriorityCalcPeriod"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->priority_favor_small); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PriorityFavorSmall"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->priority_flags); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PriorityFlags"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); secs2time_str((time_t) slurm_ctl_conf_ptr->priority_max_age, tmp_str, sizeof(tmp_str)); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PriorityMaxAge"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PriorityUsageResetPeriod"); key_pair->value = xstrdup(_reset_period_str( slurm_ctl_conf_ptr-> priority_reset_period)); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PriorityType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->priority_type); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->priority_weight_age); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PriorityWeightAge"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->priority_weight_fs); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PriorityWeightFairShare"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->priority_weight_js); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PriorityWeightJobSize"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->priority_weight_part); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PriorityWeightPartition"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->priority_weight_qos); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PriorityWeightQOS"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); } private_data_string(slurm_ctl_conf_ptr->private_data, tmp_str, sizeof(tmp_str)); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PrivateData"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("ProctrackType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->proctrack_type); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("Prolog"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->prolog); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PrologSlurmctld"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->prolog_slurmctld); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->propagate_prio_process); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PropagatePrioProcess"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PropagateResourceLimits"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->propagate_rlimits); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("PropagateResourceLimitsExcept"); key_pair->value = xstrdup(slurm_ctl_conf_ptr-> propagate_rlimits_except); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("RebootProgram"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->reboot_program); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("ReconfigFlags"); key_pair->value = reconfig_flags2str(slurm_ctl_conf_ptr->reconfig_flags); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("ResumeProgram"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->resume_program); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u nodes/min", slurm_ctl_conf_ptr->resume_rate); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("ResumeRate"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->resume_timeout); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("ResumeTimeout"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("ResvEpilog"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->resv_epilog); list_append(ret_list, key_pair); if (slurm_ctl_conf_ptr->resv_over_run == (uint16_t) INFINITE) snprintf(tmp_str, sizeof(tmp_str), "UNLIMITED"); else snprintf(tmp_str, sizeof(tmp_str), "%u min", slurm_ctl_conf_ptr->resv_over_run); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("ResvOverRun"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("ResvProlog"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->resv_prolog); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->ret2service); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("ReturnToService"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SallocDefaultCommand"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->salloc_default_command); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SchedulerParameters"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->sched_params); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->schedport); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SchedulerPort"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->schedrootfltr); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SchedulerRootFilter"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->sched_time_slice); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SchedulerTimeSlice"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SchedulerType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->schedtype); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SelectType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->select_type); list_append(ret_list, key_pair); if (slurm_ctl_conf_ptr->select_type_param) { key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SelectTypeParameters"); key_pair->value = xstrdup( select_type_param_string(slurm_ctl_conf_ptr-> select_type_param)); list_append(ret_list, key_pair); } snprintf(tmp_str, sizeof(tmp_str), "%s(%u)", slurm_ctl_conf_ptr->slurm_user_name, slurm_ctl_conf_ptr->slurm_user_id); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmUser"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%s", log_num2string(slurm_ctl_conf_ptr->slurmctld_debug)); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmctldDebug"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmctldLogFile"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->slurmctld_logfile); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmSchedLogFile"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->sched_logfile); list_append(ret_list, key_pair); if (slurm_ctl_conf_ptr->slurmctld_port_count > 1) { uint32_t high_port = slurm_ctl_conf_ptr->slurmctld_port; high_port += (slurm_ctl_conf_ptr->slurmctld_port_count - 1); snprintf(tmp_str, sizeof(tmp_str), "%u-%u", slurm_ctl_conf_ptr->slurmctld_port, high_port); } else { snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->slurmctld_port); } key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmctldPort"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->slurmctld_timeout); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmctldTimeout"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%s", log_num2string(slurm_ctl_conf_ptr->slurmd_debug)); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmdDebug"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmdLogFile"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->slurmd_logfile); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmdPidFile"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->slurmd_pidfile); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmdPlugstack"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->slurmd_plugstack); list_append(ret_list, key_pair); #ifndef MULTIPLE_SLURMD snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->slurmd_port); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmdPort"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); #endif key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmdSpoolDir"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->slurmd_spooldir); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->slurmd_timeout); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmdTimeout"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%s(%u)", slurm_ctl_conf_ptr->slurmd_user_name, slurm_ctl_conf_ptr->slurmd_user_id); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmdUser"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->sched_log_level); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmSchedLogLevel"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmctldPidFile"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->slurmctld_pidfile); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SlurmctldPlugstack"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->slurmctld_plugstack); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SLURM_CONF"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->slurm_conf); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SLURM_VERSION"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->version); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SrunEpilog"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->srun_epilog); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SrunProlog"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->srun_prolog); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("StateSaveLocation"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->state_save_location); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SuspendExcNodes"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->suspend_exc_nodes); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SuspendExcParts"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->suspend_exc_parts); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SuspendProgram"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->suspend_program); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u nodes/min", slurm_ctl_conf_ptr->suspend_rate); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SuspendRate"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); if (!slurm_ctl_conf_ptr->suspend_time) snprintf(tmp_str, sizeof(tmp_str), "NONE"); else snprintf(tmp_str, sizeof(tmp_str), "%d sec", ((int)slurm_ctl_conf_ptr->suspend_time - 1)); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SuspendTime"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->suspend_timeout); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SuspendTimeout"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("SwitchType"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->switch_type); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("TaskEpilog"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->task_epilog); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("TaskPlugin"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->task_plugin); list_append(ret_list, key_pair); slurm_sprint_cpu_bind_type(tmp_str, slurm_ctl_conf_ptr->task_plugin_param); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("TaskPluginParam"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("TaskProlog"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->task_prolog); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("TmpFS"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->tmp_fs); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("TopologyPlugin"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->topology_plugin); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->track_wckey); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("TrackWCKey"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->tree_width); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("TreeWidth"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u", slurm_ctl_conf_ptr->use_pam); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("UsePam"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("UnkillableStepProgram"); key_pair->value = xstrdup(slurm_ctl_conf_ptr->unkillable_program); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->unkillable_timeout); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("UnkillableStepTimeout"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u percent", slurm_ctl_conf_ptr->vsize_factor); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("VSizeFactor"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); snprintf(tmp_str, sizeof(tmp_str), "%u sec", slurm_ctl_conf_ptr->wait_time); key_pair = xmalloc(sizeof(config_key_pair_t)); key_pair->name = xstrdup("WaitTime"); key_pair->value = xstrdup(tmp_str); list_append(ret_list, key_pair); return (void *)ret_list; }
extern int sacctmgr_list_qos(int argc, char *argv[]) { int rc = SLURM_SUCCESS; slurmdb_qos_cond_t *qos_cond = xmalloc(sizeof(slurmdb_qos_cond_t)); int i=0; ListIterator itr = NULL; ListIterator itr2 = NULL; slurmdb_qos_rec_t *qos = NULL; List qos_list = NULL; int field_count = 0; print_field_t *field = NULL; List format_list = list_create(slurm_destroy_char); List print_fields_list; /* types are of print_field_t */ for (i=0; i<argc; i++) { int command_len = strlen(argv[i]); if (!strncasecmp (argv[i], "Where", MAX(command_len, 5)) || !strncasecmp (argv[i], "Set", MAX(command_len, 3))) i++; _set_cond(&i, argc, argv, qos_cond, format_list); } if(exit_code) { slurmdb_destroy_qos_cond(qos_cond); list_destroy(format_list); return SLURM_ERROR; } else if(!list_count(format_list)) { slurm_addto_char_list(format_list, "Name,Prio,GraceT,Preempt,PreemptM," "Flags%40,UsageThres,UsageFactor," "GrpCPUs,GrpCPUMins,GrpCPURunMins," "GrpJ,GrpMEM,GrpN,GrpS,GrpW," "MaxCPUs,MaxCPUMins,MaxN,MaxW," "MaxCPUsPerUser," "MaxJobsPerUser,MaxNodesPerUser," "MaxSubmitJobsPerUser"); } print_fields_list = sacctmgr_process_format_list(format_list); list_destroy(format_list); if(exit_code) { list_destroy(print_fields_list); return SLURM_ERROR; } qos_list = acct_storage_g_get_qos(db_conn, my_uid, qos_cond); slurmdb_destroy_qos_cond(qos_cond); if(!qos_list) { exit_code=1; fprintf(stderr, " Problem with query.\n"); list_destroy(print_fields_list); return SLURM_ERROR; } itr = list_iterator_create(qos_list); itr2 = list_iterator_create(print_fields_list); print_fields_header(print_fields_list); field_count = list_count(print_fields_list); while((qos = list_next(itr))) { int curr_inx = 1; while((field = list_next(itr2))) { switch(field->type) { case PRINT_DESC: field->print_routine( field, qos->description, (curr_inx == field_count)); break; case PRINT_FLAGS: { char *tmp_char = slurmdb_qos_flags_str( qos->flags); field->print_routine( field, tmp_char, (curr_inx == field_count)); xfree(tmp_char); break; } case PRINT_UT: field->print_routine( field, qos->usage_thres, (curr_inx == field_count)); break; case PRINT_GRACE: field->print_routine( field, (uint64_t)qos->grace_time, (curr_inx == field_count)); break; case PRINT_GRPCM: field->print_routine( field, qos->grp_cpu_mins, (curr_inx == field_count)); break; case PRINT_GRPCRM: field->print_routine( field, qos->grp_cpu_run_mins, (curr_inx == field_count)); break; case PRINT_GRPC: field->print_routine(field, qos->grp_cpus, (curr_inx == field_count)); break; case PRINT_GRPJ: field->print_routine(field, qos->grp_jobs, (curr_inx == field_count)); break; case PRINT_GRPMEM: field->print_routine(field, qos->grp_mem, (curr_inx == field_count)); break; case PRINT_GRPN: field->print_routine(field, qos->grp_nodes, (curr_inx == field_count)); break; case PRINT_GRPS: field->print_routine(field, qos->grp_submit_jobs, (curr_inx == field_count)); break; case PRINT_GRPW: field->print_routine( field, qos->grp_wall, (curr_inx == field_count)); break; case PRINT_ID: field->print_routine( field, qos->id, (curr_inx == field_count)); break; case PRINT_MAXCM: field->print_routine( field, qos->max_cpu_mins_pj, (curr_inx == field_count)); break; case PRINT_MAXCRM: field->print_routine( field, qos->max_cpu_run_mins_pu, (curr_inx == field_count)); break; case PRINT_MAXC: field->print_routine(field, qos->max_cpus_pj, (curr_inx == field_count)); break; case PRINT_MAXCU: field->print_routine(field, qos->max_cpus_pu, (curr_inx == field_count)); break; case PRINT_MAXJ: field->print_routine(field, qos->max_jobs_pu, (curr_inx == field_count)); break; case PRINT_MAXN: field->print_routine(field, qos->max_nodes_pj, (curr_inx == field_count)); break; case PRINT_MAXNU: field->print_routine(field, qos->max_nodes_pu, (curr_inx == field_count)); break; case PRINT_MAXS: field->print_routine(field, qos->max_submit_jobs_pu, (curr_inx == field_count)); break; case PRINT_MAXW: field->print_routine( field, qos->max_wall_pj, (curr_inx == field_count)); break; case PRINT_NAME: field->print_routine( field, qos->name, (curr_inx == field_count)); break; case PRINT_PREE: if(!g_qos_list) g_qos_list = acct_storage_g_get_qos( db_conn, my_uid, NULL); field->print_routine( field, g_qos_list, qos->preempt_bitstr, (curr_inx == field_count)); break; case PRINT_PREEM: { char *tmp_char = "cluster"; if(qos->preempt_mode) tmp_char = xstrtolower( preempt_mode_string( qos->preempt_mode)); field->print_routine( field, tmp_char, (curr_inx == field_count)); break; } case PRINT_PRIO: field->print_routine( field, qos->priority, (curr_inx == field_count)); break; case PRINT_UF: field->print_routine( field, qos->usage_factor, (curr_inx == field_count)); break; default: field->print_routine( field, NULL, (curr_inx == field_count)); break; } curr_inx++; } list_iterator_reset(itr2); printf("\n"); } list_iterator_destroy(itr2); list_iterator_destroy(itr); list_destroy(qos_list); list_destroy(print_fields_list); return rc; }
/* * slurm_sprint_partition_info - output information about a specific Slurm * partition based upon message as loaded using slurm_load_partitions * IN part_ptr - an individual partition information record pointer * IN one_liner - print as a single line if true * RET out - char * containing formatted output (must be freed after call) * NULL is returned on failure. */ char *slurm_sprint_partition_info ( partition_info_t * part_ptr, int one_liner ) { char tmp1[16], tmp2[16]; char tmp_line[MAXHOSTRANGELEN]; char *out = NULL; char *allow_deny, *value; uint16_t force, preempt_mode, val; uint32_t cluster_flags = slurmdb_setup_cluster_flags(); /****** Line 1 ******/ snprintf(tmp_line, sizeof(tmp_line), "PartitionName=%s", part_ptr->name); xstrcat(out, tmp_line); if (one_liner) xstrcat(out, " "); else xstrcat(out, "\n "); /****** Line 2 ******/ if ((part_ptr->allow_groups == NULL) || (part_ptr->allow_groups[0] == '\0')) sprintf(tmp_line, "AllowGroups=ALL"); else { snprintf(tmp_line, sizeof(tmp_line), "AllowGroups=%s", part_ptr->allow_groups); } xstrcat(out, tmp_line); if (part_ptr->allow_accounts || !part_ptr->deny_accounts) { allow_deny = "Allow"; if ((part_ptr->allow_accounts == NULL) || (part_ptr->allow_accounts[0] == '\0')) value = "ALL"; else value = part_ptr->allow_accounts; } else { allow_deny = "Deny"; value = part_ptr->deny_accounts; } snprintf(tmp_line, sizeof(tmp_line), " %sAccounts=%s", allow_deny, value); xstrcat(out, tmp_line); if (part_ptr->allow_qos || !part_ptr->deny_qos) { allow_deny = "Allow"; if ((part_ptr->allow_qos == NULL) || (part_ptr->allow_qos[0] == '\0')) value = "ALL"; else value = part_ptr->allow_qos; } else { allow_deny = "Deny"; value = part_ptr->deny_qos; } snprintf(tmp_line, sizeof(tmp_line), " %sQos=%s", allow_deny, value); xstrcat(out, tmp_line); if (one_liner) xstrcat(out, " "); else xstrcat(out, "\n "); /****** Line 3 ******/ if (part_ptr->allow_alloc_nodes == NULL) snprintf(tmp_line, sizeof(tmp_line), "AllocNodes=%s","ALL"); else snprintf(tmp_line, sizeof(tmp_line), "AllocNodes=%s", part_ptr->allow_alloc_nodes); xstrcat(out, tmp_line); if (part_ptr->alternate != NULL) { snprintf(tmp_line, sizeof(tmp_line), " Alternate=%s", part_ptr->alternate); xstrcat(out, tmp_line); } if (part_ptr->flags & PART_FLAG_DEFAULT) sprintf(tmp_line, " Default=YES"); else sprintf(tmp_line, " Default=NO"); xstrcat(out, tmp_line); if (one_liner) xstrcat(out, " "); else xstrcat(out, "\n "); /****** Line 4 added here for BG partitions only ****** to maintain alphabetized output ******/ if (cluster_flags & CLUSTER_FLAG_BG) { snprintf(tmp_line, sizeof(tmp_line), "BasePartitions=%s", part_ptr->nodes); xstrcat(out, tmp_line); if (one_liner) xstrcat(out, " "); else xstrcat(out, "\n "); } /****** Line 5 ******/ if (part_ptr->default_time == INFINITE) sprintf(tmp_line, "DefaultTime=UNLIMITED"); else if (part_ptr->default_time == NO_VAL) sprintf(tmp_line, "DefaultTime=NONE"); else { char time_line[32]; secs2time_str(part_ptr->default_time * 60, time_line, sizeof(time_line)); sprintf(tmp_line, "DefaultTime=%s", time_line); } xstrcat(out, tmp_line); if (part_ptr->flags & PART_FLAG_NO_ROOT) sprintf(tmp_line, " DisableRootJobs=YES"); else sprintf(tmp_line, " DisableRootJobs=NO"); xstrcat(out, tmp_line); sprintf(tmp_line, " GraceTime=%u", part_ptr->grace_time); xstrcat(out, tmp_line); if (part_ptr->flags & PART_FLAG_HIDDEN) sprintf(tmp_line, " Hidden=YES"); else sprintf(tmp_line, " Hidden=NO"); xstrcat(out, tmp_line); if (one_liner) xstrcat(out, " "); else xstrcat(out, "\n "); /****** Line 6 ******/ if (part_ptr->max_nodes == INFINITE) sprintf(tmp_line, "MaxNodes=UNLIMITED"); else { if (cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)part_ptr->max_nodes, tmp1, sizeof(tmp1), UNIT_NONE); else snprintf(tmp1, sizeof(tmp1),"%u", part_ptr->max_nodes); sprintf(tmp_line, "MaxNodes=%s", tmp1); } xstrcat(out, tmp_line); if (part_ptr->max_time == INFINITE) sprintf(tmp_line, " MaxTime=UNLIMITED"); else { char time_line[32]; secs2time_str(part_ptr->max_time * 60, time_line, sizeof(time_line)); sprintf(tmp_line, " MaxTime=%s", time_line); } xstrcat(out, tmp_line); if (cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)part_ptr->min_nodes, tmp1, sizeof(tmp1), UNIT_NONE); else snprintf(tmp1, sizeof(tmp1), "%u", part_ptr->min_nodes); sprintf(tmp_line, " MinNodes=%s", tmp1); xstrcat(out, tmp_line); if (part_ptr->max_cpus_per_node == INFINITE) sprintf(tmp_line, " MaxCPUsPerNode=UNLIMITED"); else { sprintf(tmp_line, " MaxCPUsPerNode=%u", part_ptr->max_cpus_per_node); } xstrcat(out, tmp_line); if (one_liner) xstrcat(out, " "); else xstrcat(out, "\n "); /****** Line added here for non BG nodes to keep with alphabetized output******/ if (!(cluster_flags & CLUSTER_FLAG_BG)) { snprintf(tmp_line, sizeof(tmp_line), "Nodes=%s", part_ptr->nodes); xstrcat(out, tmp_line); if (one_liner) xstrcat(out, " "); else xstrcat(out, "\n "); } /****** Line 7 ******/ sprintf(tmp_line, "Priority=%u", part_ptr->priority); xstrcat(out, tmp_line); if (part_ptr->flags & PART_FLAG_ROOT_ONLY) sprintf(tmp_line, " RootOnly=YES"); else sprintf(tmp_line, " RootOnly=NO"); xstrcat(out, tmp_line); if (part_ptr->flags & PART_FLAG_REQ_RESV) sprintf(tmp_line, " ReqResv=YES"); else sprintf(tmp_line, " ReqResv=NO"); xstrcat(out, tmp_line); force = part_ptr->max_share & SHARED_FORCE; val = part_ptr->max_share & (~SHARED_FORCE); if (val == 0) xstrcat(out, " Shared=EXCLUSIVE"); else if (force) { sprintf(tmp_line, " Shared=FORCE:%u", val); xstrcat(out, tmp_line); } else if (val == 1) xstrcat(out, " Shared=NO"); else { sprintf(tmp_line, " Shared=YES:%u", val); xstrcat(out, tmp_line); } preempt_mode = part_ptr->preempt_mode; if (preempt_mode == (uint16_t) NO_VAL) preempt_mode = slurm_get_preempt_mode(); /* use cluster param */ snprintf(tmp_line, sizeof(tmp_line), " PreemptMode=%s", preempt_mode_string(preempt_mode)); xstrcat(out, tmp_line); if (one_liner) xstrcat(out, " "); else xstrcat(out, "\n "); /****** Line 8 ******/ if (part_ptr->state_up == PARTITION_UP) sprintf(tmp_line, "State=UP"); else if (part_ptr->state_up == PARTITION_DOWN) sprintf(tmp_line, "State=DOWN"); else if (part_ptr->state_up == PARTITION_INACTIVE) sprintf(tmp_line, "State=INACTIVE"); else if (part_ptr->state_up == PARTITION_DRAIN) sprintf(tmp_line, "State=DRAIN"); else sprintf(tmp_line, "State=UNKNOWN"); xstrcat(out, tmp_line); if (cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)part_ptr->total_cpus, tmp1, sizeof(tmp1), UNIT_NONE); else snprintf(tmp1, sizeof(tmp1), "%u", part_ptr->total_cpus); sprintf(tmp_line, " TotalCPUs=%s", tmp1); xstrcat(out, tmp_line); if (cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)part_ptr->total_nodes, tmp2, sizeof(tmp2), UNIT_NONE); else snprintf(tmp2, sizeof(tmp2), "%u", part_ptr->total_nodes); sprintf(tmp_line, " TotalNodes=%s", tmp2); xstrcat(out, tmp_line); if (part_ptr->cr_type & CR_CORE) sprintf(tmp_line, " SelectTypeParameters=CR_CORE"); else if (part_ptr->cr_type & CR_SOCKET) sprintf(tmp_line, " SelectTypeParameters=CR_SOCKET"); else sprintf(tmp_line, " SelectTypeParameters=N/A"); xstrcat(out, tmp_line); if (one_liner) xstrcat(out, " "); else xstrcat(out, "\n "); /****** Line 9 ******/ if (part_ptr->def_mem_per_cpu & MEM_PER_CPU) { snprintf(tmp_line, sizeof(tmp_line), "DefMemPerCPU=%u", part_ptr->def_mem_per_cpu & (~MEM_PER_CPU)); xstrcat(out, tmp_line); } else if (part_ptr->def_mem_per_cpu == 0) { xstrcat(out, "DefMemPerNode=UNLIMITED"); } else { snprintf(tmp_line, sizeof(tmp_line), "DefMemPerNode=%u", part_ptr->def_mem_per_cpu); xstrcat(out, tmp_line); } if (part_ptr->max_mem_per_cpu & MEM_PER_CPU) { snprintf(tmp_line, sizeof(tmp_line), " MaxMemPerCPU=%u", part_ptr->max_mem_per_cpu & (~MEM_PER_CPU)); xstrcat(out, tmp_line); } else if (part_ptr->max_mem_per_cpu == 0) { xstrcat(out, " MaxMemPerNode=UNLIMITED"); } else { snprintf(tmp_line, sizeof(tmp_line), " MaxMemPerNode=%u", part_ptr->max_mem_per_cpu); xstrcat(out, tmp_line); } if (one_liner) xstrcat(out, "\n"); else xstrcat(out, "\n\n"); return out; }
static void _print_assoc_mgr_info(assoc_mgr_info_msg_t *msg) { ListIterator itr; slurmdb_user_rec_t *user_rec; slurmdb_assoc_rec_t *assoc_rec; slurmdb_qos_rec_t *qos_rec; uint64_t tmp64_array[msg->tres_cnt]; char *new_line_char = one_liner ? " " : "\n "; int i; printf("Current Association Manager state\n"); tres_cnt = msg->tres_cnt; tres_names = msg->tres_names; if (!msg->user_list || !list_count(msg->user_list)) { if (req_flags & ASSOC_MGR_INFO_FLAG_USERS) printf("\nNo users currently cached in Slurm.\n\n"); } else { printf("\nUser Records\n\n"); itr = list_iterator_create(msg->user_list); while ((user_rec = list_next(itr))) { printf("UserName=%s(%u) DefAccount=%s " "DefWckey=%s AdminLevel=%s\n", user_rec->name, user_rec->uid, user_rec->default_acct, user_rec->default_wckey, slurmdb_admin_level_str(user_rec->admin_level)); } list_iterator_destroy(itr); } if (!msg->assoc_list || !list_count(msg->assoc_list)) { if (req_flags & ASSOC_MGR_INFO_FLAG_ASSOC) printf("\nNo associations currently " "cached in Slurm.\n\n"); } else { printf("\nAssociation Records\n\n"); itr = list_iterator_create(msg->assoc_list); while ((assoc_rec = list_next(itr))) { if (!assoc_rec->usage) continue; printf("ClusterName=%s Account=%s ", assoc_rec->cluster, assoc_rec->acct); if (assoc_rec->user) printf("UserName=%s(%u) ", assoc_rec->user, assoc_rec->uid); else printf("UserName= "******"Partition=%s ID=%u%s", assoc_rec->partition ? assoc_rec->partition : "", assoc_rec->id, new_line_char); printf("SharesRaw/Norm/Level/Factor=" "%u/%.2f/%u/%.2f%s", assoc_rec->shares_raw, assoc_rec->usage->shares_norm, (assoc_rec->usage->level_shares == NO_VAL) ? 1 : assoc_rec->usage->level_shares, assoc_rec->usage->fs_factor, new_line_char); printf("UsageRaw/Norm/Efctv=%.2Lf/%.2Lf/%.2Lf%s", assoc_rec->usage->usage_raw, (assoc_rec->usage->usage_norm == (long double)NO_VAL) ? 1 : assoc_rec->usage->usage_norm, (assoc_rec->usage->usage_efctv == (long double)NO_VAL) ? 1 : assoc_rec->usage->usage_efctv, new_line_char); if (assoc_rec->parent_acct) printf("ParentAccount=%s(%u) ", assoc_rec->parent_acct, assoc_rec->parent_id); else printf("ParentAccount= "); /* rgt isn't always valid coming from the * association manager (so don't print it). */ printf("Lft=%u DefAssoc=%s%s", assoc_rec->lft, assoc_rec->is_def ? "Yes" : "No", new_line_char); if (assoc_rec->grp_jobs != INFINITE) printf("GrpJobs=%u(%u)", assoc_rec->grp_jobs, assoc_rec->usage->used_jobs); else printf("GrpJobs=N(%u)", assoc_rec->usage->used_jobs); /* NEW LINE */ printf("%s", new_line_char); if (assoc_rec->grp_submit_jobs != INFINITE) printf("GrpSubmitJobs=%u(%u) ", assoc_rec->grp_submit_jobs, assoc_rec->usage->used_submit_jobs); else printf("GrpSubmitJobs=N(%u) ", assoc_rec->usage->used_submit_jobs); if (assoc_rec->grp_wall != INFINITE) printf("GrpWall=%u(%.2f)", assoc_rec->grp_wall, assoc_rec->usage->grp_used_wall/60); else printf("GrpWall=N(%.2f)", assoc_rec->usage->grp_used_wall/60); /* NEW LINE */ printf("%s", new_line_char); _print_tres_line("GrpTRES", assoc_rec->grp_tres_ctld, assoc_rec->usage->grp_used_tres, 0, 0); if (assoc_rec->usage->usage_tres_raw) for (i=0; i<tres_cnt; i++) tmp64_array[i] = (uint64_t) assoc_rec->usage-> usage_tres_raw[i]; else memset(tmp64_array, 0, sizeof(tmp64_array)); _print_tres_line("GrpTRESMins", assoc_rec->grp_tres_mins_ctld, tmp64_array, 60, 0); _print_tres_line("GrpTRESRunMins", assoc_rec->grp_tres_run_mins_ctld, assoc_rec->usage-> grp_used_tres_run_secs, 60, 0); if (assoc_rec->max_jobs != INFINITE) printf("MaxJobs=%u(%u) ", assoc_rec->max_jobs, assoc_rec->usage->used_jobs); else printf("MaxJobs= "); if (assoc_rec->max_submit_jobs != INFINITE) printf("MaxSubmitJobs=%u(%u) ", assoc_rec->max_submit_jobs, assoc_rec->usage->used_submit_jobs); else printf("MaxSubmitJobs= "); if (assoc_rec->max_wall_pj != INFINITE) printf("MaxWallPJ=%u", assoc_rec->max_wall_pj); else printf("MaxWallPJ="); /* NEW LINE */ printf("%s", new_line_char); _print_tres_line("MaxTRESPJ", assoc_rec->max_tres_ctld, NULL, 0, 0); _print_tres_line("MaxTRESPN", assoc_rec->max_tres_pn_ctld, NULL, 0, 0); _print_tres_line("MaxTRESMinsPJ", assoc_rec->max_tres_mins_ctld, NULL, 0, 1); /* Doesn't do anything yet */ /* _print_tres_line("MaxTRESRunMins", */ /* assoc_rec->max_tres_mins_ctld, */ /* NULL, 0, 1); */ } } if (!msg->qos_list || !list_count(msg->qos_list)) { if (req_flags & ASSOC_MGR_INFO_FLAG_QOS) printf("\nNo QOS currently cached in Slurm.\n\n"); } else { printf("\nQOS Records\n\n"); itr = list_iterator_create(msg->qos_list); while ((qos_rec = list_next(itr))) { if (!qos_rec->usage) continue; printf("QOS=%s(%u)%s", qos_rec->name, qos_rec->id, new_line_char); printf("UsageRaw=%Lf%s", qos_rec->usage->usage_raw, new_line_char); if (qos_rec->grp_jobs != INFINITE) printf("GrpJobs=%u(%u) ", qos_rec->grp_jobs, qos_rec->usage->grp_used_jobs); else printf("GrpJobs=N(%u) ", qos_rec->usage->grp_used_jobs); if (qos_rec->grp_submit_jobs != INFINITE) printf("GrpSubmitJobs=%u(%u) ", qos_rec->grp_submit_jobs, qos_rec->usage->grp_used_submit_jobs); else printf("GrpSubmitJobs=N(%u) ", qos_rec->usage->grp_used_submit_jobs); if (qos_rec->grp_wall != INFINITE) printf("GrpWall=%u(%.2f)", qos_rec->grp_wall, qos_rec->usage->grp_used_wall/60); else printf("GrpWall=N(%.2f)", qos_rec->usage->grp_used_wall/60); /* NEW LINE */ printf("%s", new_line_char); _print_tres_line("GrpTRES", qos_rec->grp_tres_ctld, qos_rec->usage->grp_used_tres, 0, 0); if (qos_rec->usage->usage_tres_raw) for (i=0; i<tres_cnt; i++) tmp64_array[i] = (uint64_t) qos_rec->usage-> usage_tres_raw[i]; else memset(tmp64_array, 0, sizeof(tmp64_array)); _print_tres_line("GrpTRESMins", qos_rec->grp_tres_mins_ctld, tmp64_array, 60, 0); _print_tres_line("GrpTRESRunMins", qos_rec->grp_tres_run_mins_ctld, qos_rec->usage-> grp_used_tres_run_secs, 60, 0); if (qos_rec->max_wall_pj != INFINITE) printf("MaxWallPJ=%u", qos_rec->max_wall_pj); else printf("MaxWallPJ="); /* NEW LINE */ printf("%s", new_line_char); _print_tres_line("MaxTRESPJ", qos_rec->max_tres_pj_ctld, NULL, 0, 0); _print_tres_line("MaxTRESPN", qos_rec->max_tres_pn_ctld, NULL, 0, 0); _print_tres_line("MaxTRESMinsPJ", qos_rec->max_tres_mins_pj_ctld, NULL, 0, 0); /* Doesn't do anything yet */ /* _print_tres_line("MaxTRESRunMinsPA", */ /* qos_rec->max_tres_mins_pa_ctld, */ /* NULL, 0); */ /* _print_tres_line("MaxTRESRunMinsPU", */ /* qos_rec->max_tres_mins_pu_ctld, */ /* NULL, 0); */ _print_tres_line("MinTRESPJ", qos_rec->min_tres_pj_ctld, NULL, 0, 1); printf("%sPreemptMode=%s%s", one_liner ? "" : " ", preempt_mode_string( qos_rec->preempt_mode), one_liner ? "" : "\n"); if (qos_rec->priority == INFINITE || qos_rec->priority == NO_VAL) printf("%sPriority=NONE\n", one_liner ? "" : " "); else printf("%sPriority=%u\n", one_liner ? "" : " ", qos_rec->priority); printf("%sAccount Limits%s", one_liner ? "" : " ", one_liner ? "" : "\n"); if (qos_rec->usage->acct_limit_list) { list_for_each(qos_rec->usage->acct_limit_list, (ListForF)_print_used_acct_limit, qos_rec); } else printf("%sNo Accounts%s", one_liner ? "" : " ", one_liner ? "" : "\n"); printf("%sUser Limits%s", one_liner ? "" : " ", one_liner ? "" : "\n"); if (qos_rec->usage->user_limit_list) { list_for_each(qos_rec->usage->user_limit_list, (ListForF)_print_used_user_limit, qos_rec); } else printf("%sNo Users%s", one_liner ? "" : " ", one_liner ? "" : "\n"); } } }