diff --git a/src/common/plugin.c b/src/common/plugin.c index 25ea1d4238761a303d75579def976661a5452dac..772edb27508b2091e4725bbd94d6630393de7a28 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -207,6 +207,7 @@ plugin_load_and_link(const char *type_name, int n_syms, file_name = xstrdup_printf("%s/%s", head, so_name); debug3("Trying to load plugin %s", file_name); if ((stat(file_name, &st) < 0) || (!S_ISREG(st.st_mode))) { + debug4("No Good."); xfree(file_name); } else { plug = plugin_load_from_file(file_name); diff --git a/src/sreport/cluster_reports.c b/src/sreport/cluster_reports.c index 5d3ba363f048e620d2bad3b01df750f1355c6d36..78ab61a2d06c60fd9ecb1a13ffe06b9ca48c2abc 100644 --- a/src/sreport/cluster_reports.c +++ b/src/sreport/cluster_reports.c @@ -59,6 +59,9 @@ static int _set_cond(int *start, int argc, char *argv[], int i; int set = 0; int end = 0; + time_t my_time = time(NULL); + struct tm start_tm; + struct tm end_tm; for (i=(*start); i<argc; i++) { end = parse_option_end(argv[i]); @@ -89,6 +92,51 @@ static int _set_cond(int *start, int argc, char *argv[], } } (*start) = i; + /* Default is going to be the last day */ + if(!cluster_cond->usage_end) { + if(!localtime_r(&my_time, &end_tm)) { + error("Couldn't get localtime from end %d", + my_time); + return SLURM_ERROR; + } + end_tm.tm_hour = 0; + cluster_cond->usage_end = mktime(&end_tm); + } else { + if(!localtime_r((time_t *)&cluster_cond->usage_end, &end_tm)) { + error("Couldn't get localtime from user end %d", + my_time); + return SLURM_ERROR; + } + } + end_tm.tm_sec = 0; + end_tm.tm_min = 0; + end_tm.tm_isdst = -1; + cluster_cond->usage_end = mktime(&end_tm); + + if(!cluster_cond->usage_start) { + if(!localtime_r(&my_time, &start_tm)) { + error("Couldn't get localtime from start %d", + my_time); + return SLURM_ERROR; + } + start_tm.tm_hour = 0; + start_tm.tm_mday--; + cluster_cond->usage_start = mktime(&start_tm); + } else { + if(!localtime_r((time_t *)&cluster_cond->usage_start, + &start_tm)) { + error("Couldn't get localtime from user start %d", + my_time); + return SLURM_ERROR; + } + } + start_tm.tm_sec = 0; + start_tm.tm_min = 0; + start_tm.tm_isdst = -1; + cluster_cond->usage_start = mktime(&start_tm); + + if(cluster_cond->usage_end-cluster_cond->usage_start < 3600) + cluster_cond->usage_end = cluster_cond->usage_start + 3600; return set; } @@ -192,6 +240,21 @@ static List _get_cluster_list(int argc, char *argv[], List format_list) _set_cond(&i, argc, argv, cluster_cond, format_list); cluster_list = acct_storage_g_get_clusters(db_conn, cluster_cond); + if(print_fields_have_header) { + char start_char[20]; + char end_char[20]; + cluster_cond->usage_end-=1; + slurm_make_time_str((time_t *)&cluster_cond->usage_start, + start_char, sizeof(start_char)); + slurm_make_time_str((time_t *)&cluster_cond->usage_end, + end_char, sizeof(end_char)); + printf("----------------------------------------" + "----------------------------------------\n"); + printf("\tCluster Utilization Report %s - %s\n", + start_char, end_char); + printf("----------------------------------------" + "----------------------------------------\n"); + } destroy_acct_cluster_cond(cluster_cond); if(!cluster_list)