diff --git a/NEWS b/NEWS index 1eee5779ee5529b47d2a020bf71403b2965fbb69..9588e0a3f16b1c81ddfcc99ae7d2830d0b39571a 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,8 @@ documents those changes that are of interest to users and admins. * Changes in SLURM 2.1.0-pre7 ============================= -- BLUEGENE - make 2.1 run correctly on a real bluegene cluster + -- sacctmgr - display better debug for when an admin specifies a non-existant + parent account when changing parent accounts. * Changes in SLURM 2.1.0-pre6 ============================= diff --git a/doc/man/man1/sacct.1 b/doc/man/man1/sacct.1 index 4f970191450f1402d84e3b96895cef02328f57ff..149ba08ccaf9b0dd19039cf6d0564fe69aa0bcc8 100644 --- a/doc/man/man1/sacct.1 +++ b/doc/man/man1/sacct.1 @@ -306,15 +306,15 @@ operand is a comma\-separated list of these state designators. Space characters are not allowed in the \f2state_list\fP\c -NOTE: The default starttime is midnight of the current day so if you -want to see only jobs in the state now use \-S now. +NOTE: When specifying states and no start time is given the default +starttime is 'now'. \&. .TP \f3\-S \fP\f3,\fP \f3\-\-starttime\fP Select jobs eligible after the specified time. Default is midnight of current day. If states are given with the \-s option then return jobs -in this state at this time. +in this state at this time, 'now' is also used as the default time. Valid time formats are... HH:MM[:SS] [AM|PM] diff --git a/slurm/slurm_errno.h b/slurm/slurm_errno.h index 15c6a6b8a481928a87cab71c478e959c25ca4e54..cb336c350c3362a7933952be03724054fb1d01ca 100644 --- a/slurm/slurm_errno.h +++ b/slurm/slurm_errno.h @@ -155,9 +155,10 @@ enum { ESLURM_TASKDIST_REQUIRES_OVERCOMMIT, ESLURM_JOB_HELD, ESLURM_INVALID_CRYPTO_TYPE_CHANGE, - ESLURM_INVALID_BANK_ACCOUNT, ESLURM_INVALID_TASK_MEMORY, ESLURM_INVALID_ACCOUNT, + ESLURM_INVALID_PARENT_ACCOUNT, + ESLURM_SAME_PARENT_ACCOUNT, ESLURM_INVALID_LICENSES, ESLURM_NEED_RESTART, ESLURM_ACCOUNTING_POLICY, diff --git a/src/common/slurm_errno.c b/src/common/slurm_errno.c index 2a75683c7f462fc0ab498255b3e26c86789071bb..5767a00d62c71f01b76f02bcf0ea043e1347d869 100644 --- a/src/common/slurm_errno.c +++ b/src/common/slurm_errno.c @@ -210,12 +210,14 @@ static slurm_errtab_t slurm_errtab[] = { "Requested more tasks than available processors" }, { ESLURM_JOB_HELD, "Job is in held state, pending scheduler release" }, - { ESLURM_INVALID_BANK_ACCOUNT, - "Invalid bank account specified" }, { ESLURM_INVALID_TASK_MEMORY, "Memory required by task is not available" }, { ESLURM_INVALID_ACCOUNT, - "Job has invalid account" }, + "Invalid account specified" }, + { ESLURM_INVALID_PARENT_ACCOUNT, + "Invalid parent account specified" }, + { ESLURM_SAME_PARENT_ACCOUNT, + "Account already child of parent account specified" }, { ESLURM_INVALID_QOS, "Job has invalid qos" }, { ESLURM_INVALID_WCKEY, @@ -226,7 +228,7 @@ static slurm_errtab_t slurm_errtab[] = { "The node configuration changes that were made require restart " "of the slurmctld daemon to take effect"}, { ESLURM_ACCOUNTING_POLICY, - "Job violates accounting policy (job submit limit, the user's " + "Job violates accounting policy (job submit limit, user's " "size and/or time limits)"}, { ESLURM_INVALID_TIME_LIMIT, "Requested time limit exceeds partition limit" }, diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c index 7b96247dcf6970dac9b28309d6c2263c9e75d832..26f8e090e47f544e1bc788abe31ca7f7e3019621 100644 --- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c +++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c @@ -1799,7 +1799,7 @@ static int _move_account(mysql_conn_t *mysql_conn, uint32_t lft, uint32_t rgt, if(!(row = mysql_fetch_row(result))) { debug4("Can't move a none existant association"); mysql_free_result(result); - return SLURM_SUCCESS; + return ESLURM_INVALID_PARENT_ACCOUNT; } par_left = atoi(row[0]); mysql_free_result(result); @@ -1809,7 +1809,7 @@ static int _move_account(mysql_conn_t *mysql_conn, uint32_t lft, uint32_t rgt, if(diff == 0) { debug3("Trying to move association to the same position? " "Nothing to do."); - return rc; + return ESLURM_SAME_PARENT_ACCOUNT; } width = (rgt - lft + 1); @@ -1903,7 +1903,7 @@ static int _move_parent(mysql_conn_t *mysql_conn, uid_t uid, mysql_free_result(result); - if(rc == SLURM_ERROR) + if(rc != SLURM_SUCCESS) return rc; /* now move the one we wanted to move in the first place @@ -1930,9 +1930,6 @@ static int _move_parent(mysql_conn_t *mysql_conn, uid_t uid, } mysql_free_result(result); - if(rc == SLURM_ERROR) - return rc; - return rc; } @@ -5695,16 +5692,6 @@ extern List acct_storage_p_modify_associations( row[MASSOC_CLUSTER], row[MASSOC_ACCT], row[MASSOC_USER]); } else { - if(row[MASSOC_PACCT][0]) { - object = xstrdup_printf( - "C = %-10s A = %s of %s", - row[MASSOC_CLUSTER], row[MASSOC_ACCT], - row[MASSOC_PACCT]); - } else { - object = xstrdup_printf( - "C = %-10s A = %s", - row[MASSOC_CLUSTER], row[MASSOC_ACCT]); - } if(assoc->parent_acct) { if(!strcasecmp(row[MASSOC_ACCT], assoc->parent_acct)) { @@ -5713,19 +5700,32 @@ extern List acct_storage_p_modify_associations( xfree(object); continue; } - - if(_move_parent(mysql_conn, uid, - atoi(row[MASSOC_LFT]), - atoi(row[MASSOC_RGT]), - row[MASSOC_CLUSTER], - row[MASSOC_ID], - row[MASSOC_PACCT], - assoc->parent_acct, - now) - == SLURM_ERROR) + rc = _move_parent(mysql_conn, uid, + atoi(row[MASSOC_LFT]), + atoi(row[MASSOC_RGT]), + row[MASSOC_CLUSTER], + row[MASSOC_ID], + row[MASSOC_PACCT], + assoc->parent_acct, + now); + if((rc == ESLURM_INVALID_PARENT_ACCOUNT) + || (rc == ESLURM_SAME_PARENT_ACCOUNT)) { + continue; + } else if(rc != SLURM_SUCCESS) break; + moved_parent = 1; } + if(row[MASSOC_PACCT][0]) { + object = xstrdup_printf( + "C = %-10s A = %s of %s", + row[MASSOC_CLUSTER], row[MASSOC_ACCT], + row[MASSOC_PACCT]); + } else { + object = xstrdup_printf( + "C = %-10s A = %s", + row[MASSOC_CLUSTER], row[MASSOC_ACCT]); + } account_type = 1; } list_append(ret_list, object); @@ -5842,6 +5842,11 @@ extern List acct_storage_p_modify_associations( mysql_free_result(result); if(assoc->parent_acct) { + if(((rc == ESLURM_INVALID_PARENT_ACCOUNT) + || (rc == ESLURM_SAME_PARENT_ACCOUNT)) + && list_count(ret_list)) + rc = SLURM_SUCCESS; + if(rc != SLURM_SUCCESS) { if(mysql_conn->rollback) { mysql_db_rollback(mysql_conn->db_conn); diff --git a/src/sacct/options.c b/src/sacct/options.c index f9c55cacb489d47ea8829188f8434480a4533cb9..7cd7ab8835b45cba542a10d9de5b08e78b5d0ef1 100644 --- a/src/sacct/options.c +++ b/src/sacct/options.c @@ -467,7 +467,8 @@ sacct [<OPTION>] \n\ -S, --starttime: \n\ Select jobs eligible after this time. Default is \n\ midnight of current day. If states are given with the -s\n\ - option then return jobs in this state at this time. \n\ + option then return jobs in this state at this time, 'now'\n\ + is also used as the default time. \n\ -T, --truncate: \n\ Truncate time. So if a job started before --starttime \n\ the start time would be truncated to --starttime. \n\ @@ -866,19 +867,22 @@ void parse_command_line(int argc, char **argv) job_cond->without_steps = params.opt_allocs; if(!job_cond->usage_start) { - job_cond->usage_start = time(NULL); - struct tm start_tm; - - if(!localtime_r(&job_cond->usage_start, &start_tm)) { - error("Couldn't get localtime from %d", - job_cond->usage_start); - return; + if(job_cond->state_list) + job_cond->usage_start = time(NULL); + else { + struct tm start_tm; + + if(!localtime_r(&job_cond->usage_start, &start_tm)) { + error("Couldn't get localtime from %d", + job_cond->usage_start); + return; + } + start_tm.tm_sec = 0; + start_tm.tm_min = 0; + start_tm.tm_hour = 0; + start_tm.tm_isdst = -1; + job_cond->usage_start = mktime(&start_tm); } - start_tm.tm_sec = 0; - start_tm.tm_min = 0; - start_tm.tm_hour = 0; - start_tm.tm_isdst = -1; - job_cond->usage_start = mktime(&start_tm); } if(verbosity > 0) { diff --git a/src/sacctmgr/account_functions.c b/src/sacctmgr/account_functions.c index 46eb4fcc3a97ac3fa8ba72b659d45477e33348af..dae854c408ed16a71f5103822c42dff6ba19652b 100644 --- a/src/sacctmgr/account_functions.c +++ b/src/sacctmgr/account_functions.c @@ -1564,10 +1564,23 @@ assoc_start: "'where' options.\n"); goto assoc_end; } + + if(assoc->parent_acct) { + acct_account_rec_t *acct_rec = + sacctmgr_find_account(assoc->parent_acct); + if(!acct_rec) { + exit_code=1; + fprintf(stderr, + " Parent Account %s doesn't exist.\n", + assoc->parent_acct); + rc = SLURM_ERROR; + goto assoc_end; + } + } ret_list = acct_storage_g_modify_associations( db_conn, my_uid, acct_cond->assoc_cond, assoc); - + if(ret_list && list_count(ret_list)) { char *object = NULL; ListIterator itr = list_iterator_create(ret_list); diff --git a/src/sacctmgr/user_functions.c b/src/sacctmgr/user_functions.c index cb45e231d09ec3bc5a258e1734b46e3909787bd1..c60b9575b58a793c3fc90e66e00265da8a09e42d 100644 --- a/src/sacctmgr/user_functions.c +++ b/src/sacctmgr/user_functions.c @@ -2181,7 +2181,7 @@ extern int sacctmgr_modify_user(int argc, char *argv[]) if(regret_list) { list_iterator_destroy(itr); itr = list_iterator_create(regret_list); - printf(" Can modify because these users " + printf(" Can't modify because these users " "aren't associated with new " "default account '%s'...\n", user->default_acct); diff --git a/src/slurmctld/reservation.c b/src/slurmctld/reservation.c index f5a2b0fd35a1e8d85566e3f47bd95034eb3651f5..64129df5692933676e24d3ad03c71c9fc3e637b6 100644 --- a/src/slurmctld/reservation.c +++ b/src/slurmctld/reservation.c @@ -368,7 +368,7 @@ static bool _is_account_valid(char *account) static int _append_assoc_list(List assoc_list, acct_association_rec_t *assoc) { - int rc = ESLURM_INVALID_BANK_ACCOUNT; + int rc = ESLURM_INVALID_ACCOUNT; acct_association_rec_t *assoc_ptr = NULL; if (assoc_mgr_fill_in_assoc( acct_db_conn, assoc, @@ -428,7 +428,7 @@ static int _set_assoc_list(slurmctld_resv_t *resv_ptr) acct_db_conn, &assoc, accounting_enforce, assoc_list)) != SLURM_SUCCESS) { - rc = ESLURM_INVALID_BANK_ACCOUNT; + rc = ESLURM_INVALID_ACCOUNT; goto end_it; } } @@ -612,7 +612,7 @@ static int _build_account_list(char *accounts, int *account_cnt, *account_list = (char **) NULL; if (!accounts) - return ESLURM_INVALID_BANK_ACCOUNT; + return ESLURM_INVALID_ACCOUNT; i = strlen(accounts); ac_list = xmalloc(sizeof(char *) * (i + 2)); @@ -636,7 +636,7 @@ static int _build_account_list(char *accounts, int *account_cnt, xfree(ac_list[i]); xfree(ac_list); xfree(tmp); - return ESLURM_INVALID_BANK_ACCOUNT; + return ESLURM_INVALID_ACCOUNT; } /* @@ -657,7 +657,7 @@ static int _update_account_list(slurmctld_resv_t *resv_ptr, bool found_it; if (!accounts) - return ESLURM_INVALID_BANK_ACCOUNT; + return ESLURM_INVALID_ACCOUNT; i = strlen(accounts); ac_list = xmalloc(sizeof(char *) * (i + 2)); @@ -785,7 +785,7 @@ static int _update_account_list(slurmctld_resv_t *resv_ptr, xfree(ac_list); xfree(ac_type); xfree(ac_cpy); - return ESLURM_INVALID_BANK_ACCOUNT; + return ESLURM_INVALID_ACCOUNT; } /* @@ -1183,7 +1183,7 @@ extern int create_resv(resv_desc_msg_t *resv_desc_ptr) if ((resv_desc_ptr->accounts == NULL) && (resv_desc_ptr->users == NULL)) { info("Reservation request lacks users or accounts"); - rc = ESLURM_INVALID_BANK_ACCOUNT; + rc = ESLURM_INVALID_ACCOUNT; goto bad_parse; } if (resv_desc_ptr->accounts) { @@ -1469,7 +1469,7 @@ extern int update_resv(resv_desc_msg_t *resv_desc_ptr) } if ((resv_ptr->users == NULL) && (resv_ptr->accounts == NULL)) { info("Reservation request lacks users or accounts"); - error_code = ESLURM_INVALID_BANK_ACCOUNT; + error_code = ESLURM_INVALID_ACCOUNT; goto update_failure; }