int _print_job_priority(job_info_t * job, int width, bool right, char* suffix) { char temp[FORMAT_STRING_SIZE]; if (job == NULL) /* Print the Header instead */ _print_str("PRIORITY", width, right, true); else { double prio = (double) job->priority / (double) ((uint32_t) 0xffffffff); sprintf(temp, "%16.14f", prio); _print_str(temp, width, right, true); } if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
/* Cpus, allocated/idle/other/total */ int _print_cpus_aiot(sinfo_data_t * sinfo_data, int width, bool right_justify, char *suffix) { char id[FORMAT_STRING_SIZE]; if (sinfo_data) { snprintf(id, FORMAT_STRING_SIZE, "%u/%u/%u/%u", sinfo_data->cpus_alloc, sinfo_data->cpus_idle, sinfo_data->cpus_other, sinfo_data->cpus_total); _print_str(id, width, right_justify, true); } else _print_str("CPUS(A/I/O/T)", width, right_justify, true); if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_alloc_mem(sinfo_data_t * sinfo_data, int width, bool right_justify, char *suffix) { char tmp_line[32]; if (sinfo_data) { sprintf(tmp_line, "%"PRIu64"", sinfo_data->alloc_memory); _print_str(tmp_line, width, right_justify, true); } else { _print_str("ALLOCMEM", width, right_justify, true); } if (suffix) { printf ("%s", suffix); } return SLURM_SUCCESS; }
int _print_step_partition(job_step_info_t * step, int width, bool right, char* suffix) { char id[FORMAT_STRING_SIZE]; if (step == NULL) /* Print the Header instead */ _print_str("PARTITION", width, right, true); else { snprintf(id, FORMAT_STRING_SIZE, "%s", step->partition); _print_str(id, width, right, true); } if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_job_batch_host(job_info_t * job, int width, bool right, char* suffix) { if (job == NULL) /* Print the Header instead */ _print_str("EXEC_HOST", width, right, true); else { char *eh = job->batch_flag ? job->batch_host : job->alloc_node; char id[FORMAT_STRING_SIZE]; snprintf(id, FORMAT_STRING_SIZE, "%s", eh ? eh : "n/a"); _print_str(id, width, right, true); } if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_reason(sinfo_data_t * sinfo_data, int width, bool right_justify, char *suffix) { if (sinfo_data) { char * reason = sinfo_data->reason ? sinfo_data->reason:"none"; if (strncmp(reason, "(null)", 6) == 0) reason = "none"; _print_str(reason, width, right_justify, true); } else _print_str("REASON", width, right_justify, true); if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_job_time_limit(job_info_t * job, int width, bool right, char* suffix) { if (job == NULL) /* Print the Header instead */ _print_str("TIMELIMIT", width, right, true); else if (job->time_limit == INFINITE) _print_str("UNLIMITED", width, right, true); else if (job->time_limit == NO_VAL) _print_str("NOT_SET", width, right, true); else _print_secs((job->time_limit*60), width, right, false); if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_job_user_name(priority_factors_object_t * job, int width, bool right, char* suffix) { if (job == NULL) /* Print the Header instead */ _print_str("USER", width, right, true); else if (job == (priority_factors_object_t *) -1) _print_str("", width, right, true); else { char *uname = uid_to_string_cached((uid_t) job->user_id); _print_str(uname, width, right, true); } if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_job_array_task_id(job_info_t * job, int width, bool right, char* suffix) { if (job == NULL) { /* Print the Header instead */ _print_str("ARRAY_TASK_ID", width, right, true); } else if (job->array_task_id != NO_VAL) { char id[FORMAT_STRING_SIZE]; snprintf(id, FORMAT_STRING_SIZE, "%u", job->array_task_id); _print_str(id, width, right, true); } else { _print_str("N/A", width, right, true); } if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_int(int number, int width, bool right, bool cut_output) { char buf[32]; snprintf(buf, 32, "%d", number); return _print_str(buf, width, right, cut_output); }
int _print_job_priority_weighted(priority_factors_object_t * job, int width, bool right, char* suffix) { char temp[FORMAT_STRING_SIZE]; if (job == NULL) /* Print the Header instead */ _print_str("PRIORITY", width, right, true); else if (job == (priority_factors_object_t *) -1) _print_str("", width, right, true); else { sprintf(temp, "%lld", (long long)_get_priority(job)); _print_str(temp, width, right, true); } if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_job_job_id(priority_factors_object_t * job, int width, bool right, char* suffix) { if (job == NULL) /* Print the Header instead */ _print_str("JOBID", width, right, true); else if (job == (priority_factors_object_t *) -1) _print_str("Weights", width, right, true); else { char id[FORMAT_STRING_SIZE]; snprintf(id, FORMAT_STRING_SIZE, "%u", job->job_id); _print_str(id, width, right, true); } if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
static void _print_int( char **str, int *len, int num ) { char nstr[12]; int i=10; if( num == 0 ) { _print_char(str, len, '0'); } if( num < 0 ) { _print_char(str, len, '-'); _print_int(str, len, -1 * num ); return; } nstr[11]='\0'; while( (i>0) && num ) { nstr[i] = '0' + (num % 10); num /= 10; i--; } _print_str(str, len, nstr + i+1); }
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; }
static int _print_norm(double number, int width, bool right, bool cut_output) { char buf[32]; snprintf(buf, 32, "%.7lf", number); return _print_str(buf, width, right, cut_output); }
int _print_pn_min_cpus(job_info_t * job, int width, bool right_justify, char* suffix) { char tmp_char[8]; if (job == NULL) /* Print the Header instead */ _print_str("MIN_CPUS", width, right_justify, true); else { convert_num_unit((float)job->pn_min_cpus, tmp_char, sizeof(tmp_char), UNIT_NONE); _print_str(tmp_char, width, right_justify, true); } if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
static int _print_secs(long time, int width, bool right, bool cut_output) { char str[FORMAT_STRING_SIZE]; long days, hours, minutes, seconds; seconds = time % 60; minutes = (time / 60) % 60; hours = (time / 3600) % 24; days = time / 86400; if (days) snprintf(str, FORMAT_STRING_SIZE, "%ld-%2.2ld:%2.2ld:%2.2ld", days, hours, minutes, seconds); else if (hours) snprintf(str, FORMAT_STRING_SIZE, "%ld:%2.2ld:%2.2ld", hours, minutes, seconds); else snprintf(str, FORMAT_STRING_SIZE, "%ld:%2.2ld", minutes, seconds); _print_str(str, width, right, cut_output); return SLURM_SUCCESS; }
int _print_state_long(sinfo_data_t * sinfo_data, int width, bool right_justify, char *suffix) { if (sinfo_data && sinfo_data->nodes_total) { char *upper_state = node_state_string(sinfo_data->node_state); char *lower_state = _str_tolower(upper_state); _print_str(lower_state, width, right_justify, true); xfree(lower_state); } else if (sinfo_data) _print_str("n/a", width, right_justify, true); else _print_str("STATE", width, right_justify, true); if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_root(sinfo_data_t * sinfo_data, int width, bool right_justify, char *suffix) { if (sinfo_data) { if (sinfo_data->part_info == NULL) _print_str("n/a", width, right_justify, true); else if (sinfo_data->part_info->flags & PART_FLAG_ROOT_ONLY) _print_str("yes", width, right_justify, true); else _print_str("no", width, right_justify, true); } else _print_str("ROOT", width, right_justify, true); if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_priority(sinfo_data_t * sinfo_data, int width, bool right_justify, char *suffix) { char id[FORMAT_STRING_SIZE]; if (sinfo_data) { _build_min_max_16_string(id, FORMAT_STRING_SIZE, sinfo_data->part_info->priority, sinfo_data->part_info->priority, true); _print_str(id, width, right_justify, true); } else _print_str("PRIORITY", width, right_justify, true); if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_memory(sinfo_data_t * sinfo_data, int width, bool right_justify, char *suffix) { char id[FORMAT_STRING_SIZE]; if (sinfo_data) { _build_min_max_32_string(id, FORMAT_STRING_SIZE, sinfo_data->min_mem, sinfo_data->max_mem, false, false); _print_str(id, width, right_justify, true); } else _print_str("MEMORY", width, right_justify, true); if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_threads(sinfo_data_t * sinfo_data, int width, bool right_justify, char *suffix) { char id[FORMAT_STRING_SIZE]; if (sinfo_data) { _build_min_max_16_string(id, FORMAT_STRING_SIZE, sinfo_data->min_threads, sinfo_data->max_threads, false); _print_str(id, width, right_justify, true); } else { _print_str("THREADS", width, right_justify, true); } if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_timestamp(sinfo_data_t * sinfo_data, int width, bool right_justify, char *suffix) { if (sinfo_data && sinfo_data->reason_time) { char time_str[32]; slurm_make_time_str(&sinfo_data->reason_time, time_str, sizeof(time_str)); _print_str(time_str, width, right_justify, true); } else if (sinfo_data) _print_str("Unknown", width, right_justify, true); else _print_str("TIMESTAMP", width, right_justify, true); if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_job_core_spec(job_info_t * job, int width, bool right, char* suffix) { if (job == NULL) /* Print the Header instead */ _print_str("CORE_SPEC", width, right, true); else _print_int(job->core_spec, width, right, true); return SLURM_SUCCESS; }
int _print_job_reason(job_info_t * job, int width, bool right, char* suffix) { if (job == NULL) /* Print the Header instead */ _print_str("REASON", width, right, true); else { char id[FORMAT_STRING_SIZE], *reason; if (job->state_desc) reason = job->state_desc; else reason = job_reason_string(job->state_reason); snprintf(id, FORMAT_STRING_SIZE, "%s", reason); _print_str(id, width, right, true); } if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_job_group_name(job_info_t * job, int width, bool right, char* suffix) { struct group *group_info = NULL; if (job == NULL) /* Print the Header instead */ _print_str("GROUP", width, right, true); else { group_info = getgrgid((gid_t) job->group_id); if (group_info && group_info->gr_name[0]) _print_str(group_info->gr_name, width, right, true); else _print_int(job->group_id, width, right, true); } if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_node_address(sinfo_data_t * sinfo_data, int width, bool right_justify, char *suffix) { if (sinfo_data) { char *tmp = NULL; tmp = hostlist_ranged_string_xmalloc( sinfo_data->node_addr); _print_str(tmp, width, right_justify, true); xfree(tmp); } else { char *title = "NODE_ADDR"; _print_str(title, width, right_justify, false); } if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_time(sinfo_data_t * sinfo_data, int width, bool right_justify, char *suffix) { if (sinfo_data) { if (sinfo_data->part_info == NULL) _print_str("n/a", width, right_justify, true); else if (sinfo_data->part_info->max_time == INFINITE) _print_str("infinite", width, right_justify, true); else _print_secs((sinfo_data->part_info->max_time * 60L), width, right_justify, true); } else _print_str("TIMELIMIT", width, right_justify, true); if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_max_cpus_per_node(sinfo_data_t * sinfo_data, int width, bool right_justify, char *suffix) { char tmp_line[32]; if (sinfo_data) { if (sinfo_data->part_info->max_cpus_per_node == INFINITE) sprintf(tmp_line, "UNLIMITED"); else sprintf(tmp_line, "%u", sinfo_data->max_cpus_per_node); _print_str(tmp_line, width, right_justify, true); } else { _print_str("MAX_CPUS_PER_NODE", width, right_justify, true); } if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }
int _print_alloc_nodes(sinfo_data_t * sinfo_data, int width, bool right_justify, char *suffix) { if (sinfo_data) { if (sinfo_data->part_info == NULL) _print_str("n/a", width, right_justify, true); else if (sinfo_data->part_info->allow_alloc_nodes) _print_str(sinfo_data->part_info->allow_alloc_nodes, width, right_justify, true); else _print_str("all", width, right_justify, true); } else _print_str("ALLOCNODES", width, right_justify, true); if (suffix) printf("%s", suffix); return SLURM_SUCCESS; }