diff --git a/NEWS b/NEWS index fc98256e5f8ea9f6e14dc0c012c497d3e6f923f1..0418b80025b326bcf7744e8a63f7634eca79d6fb 100644 --- a/NEWS +++ b/NEWS @@ -265,9 +265,9 @@ documents those changes that are of interest to users and admins. with the --exclusive flag in an allocation with more than 1 node. Previously when the first node was filled up no tasks would ever run on the other nodes. - -- Fixed sview to display correct run time and suspend time when job has - been suspended. - + -- Fixed sview and sacct to display correct run time and suspend time when + job has been suspended. + * Changes in SLURM 2.0.7 ======================== -- Fix bug in select/cons_res when nodes are configured in more than one diff --git a/src/plugins/accounting_storage/mysql/mysql_jobacct_process.c b/src/plugins/accounting_storage/mysql/mysql_jobacct_process.c index 6c85a3ded3ef0aff0cd481415c25088d378cdac1..d4487f52b0aaee917b82d91f88cdb5ec76583432 100644 --- a/src/plugins/accounting_storage/mysql/mysql_jobacct_process.c +++ b/src/plugins/accounting_storage/mysql/mysql_jobacct_process.c @@ -72,8 +72,9 @@ static void _state_time_string(char **extra, uint32_t state, if(start) { if(!end) { xstrfmtcat(*extra, - "(t1.eligible && (%d between " - "t1.eligible and t1.start))", + "(t1.eligible && (!t1.start || " + "(%d between " + "t1.eligible and t1.start)))", start); } else { xstrfmtcat(*extra, @@ -95,8 +96,8 @@ static void _state_time_string(char **extra, uint32_t state, if(start) { if(!end) { xstrfmtcat(*extra, - "(t1.start && " - "(%d between t1.start and t1.end))", + "(t1.start && (!t1.end || " + "(%d between t1.start and t1.end)))", start); } else { xstrfmtcat(*extra, @@ -1182,6 +1183,7 @@ extern List mysql_jobacct_process_get_jobs(mysql_conn_t *mysql_conn, uid_t uid, job = create_jobacct_job_rec(); list_append(job_list, job); + job->state = atoi(row[JOB_REQ_STATE]); job->alloc_cpus = atoi(row[JOB_REQ_ALLOC_CPUS]); job->alloc_nodes = atoi(row[JOB_REQ_ALLOC_NODES]); job->associd = atoi(row[JOB_REQ_ASSOCID]); @@ -1291,7 +1293,10 @@ extern List mysql_jobacct_process_get_jobs(mysql_conn_t *mysql_conn, uid_t uid, } } else { job->suspended = atoi(row[JOB_REQ_SUSPENDED]); - + + /* fix the suspended number to be correct */ + if(job->state == JOB_SUSPENDED) + job->suspended = now - job->suspended; if(!job->start) { job->elapsed = 0; } else if(!job->end) { @@ -1323,7 +1328,6 @@ extern List mysql_jobacct_process_get_jobs(mysql_conn_t *mysql_conn, uid_t uid, } job->track_steps = atoi(row[JOB_REQ_TRACKSTEPS]); - job->state = atoi(row[JOB_REQ_STATE]); job->priority = atoi(row[JOB_REQ_PRIORITY]); job->req_cpus = atoi(row[JOB_REQ_REQ_CPUS]); job->requid = atoi(row[JOB_REQ_KILL_REQUID]);