Skip to content

Commit

Permalink
Remove unused slurmdb_job_rec_t->stats
Browse files Browse the repository at this point in the history
No longer needed after 5676bdf.

Bug 12194
  • Loading branch information
Skyler Malinowski authored and gaijin03 committed Apr 3, 2022
1 parent aa677b0 commit 2f5254c
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 50 deletions.
5 changes: 0 additions & 5 deletions contribs/perlapi/libslurmdb/perl/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,12 +707,8 @@ job_rec_to_hv(slurmdb_job_rec_t* rec, HV* hv)
slurmdb_step_rec_t *step;
ListIterator itr = NULL;
AV* steps_av = (AV*)sv_2mortal((SV*)newAV());
HV* stats_hv = (HV*)sv_2mortal((SV*)newHV());
HV* step_hv;

stats_to_hv(&rec->stats, stats_hv);
hv_store_sv(hv, "stats", newRV((SV*)stats_hv));

if (rec->steps) {
itr = slurm_list_iterator_create(rec->steps);
while ((step = slurm_list_next(itr))) {
Expand Down Expand Up @@ -766,7 +762,6 @@ job_rec_to_hv(slurmdb_job_rec_t* rec, HV* hv)
STORE_FIELD(hv, rec, timelimit, uint32_t);
STORE_FIELD(hv, rec, tot_cpu_sec, uint32_t);
STORE_FIELD(hv, rec, tot_cpu_usec, uint32_t);
STORE_FIELD(hv, rec, track_steps, uint16_t);
STORE_FIELD(hv, rec, tres_alloc_str, charp);
STORE_FIELD(hv, rec, tres_req_str, charp);
STORE_FIELD(hv, rec, uid, uint32_t);
Expand Down
1 change: 0 additions & 1 deletion slurm/slurmdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,6 @@ typedef struct {
time_t start;
uint32_t state;
uint32_t state_reason_prev;
slurmdb_stats_t stats;
List steps; /* list of slurmdb_step_rec_t *'s */
time_t submit;
char *submit_line;
Expand Down
2 changes: 0 additions & 2 deletions src/common/slurmdb_defs.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,6 @@ static void _find_create_parent(slurmdb_assoc_rec_t *assoc_rec, List assoc_list,
extern slurmdb_job_rec_t *slurmdb_create_job_rec()
{
slurmdb_job_rec_t *job = xmalloc(sizeof(slurmdb_job_rec_t));
memset(&job->stats, 0, sizeof(slurmdb_stats_t));
job->array_task_id = NO_VAL;
job->derived_ec = NO_VAL;
job->state = JOB_PENDING;
Expand Down Expand Up @@ -945,7 +944,6 @@ extern void slurmdb_destroy_job_rec(void *object)
xfree(job->nodes);
xfree(job->resv_name);
xfree(job->script);
slurmdb_free_slurmdb_stats_members(&job->stats);
FREE_NULL_LIST(job->steps);
xfree(job->submit_line);
xfree(job->system_comment);
Expand Down
25 changes: 14 additions & 11 deletions src/common/slurmdb_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -3779,7 +3779,6 @@ extern void slurmdb_pack_job_rec(void *object, uint16_t protocol_version,
pack_time(job->start, buffer);
pack32(job->state, buffer);
pack32(job->state_reason_prev, buffer);
_pack_slurmdb_stats(&job->stats, protocol_version, buffer);

if (job->steps)
count = list_count(job->steps);
Expand Down Expand Up @@ -3862,7 +3861,8 @@ extern void slurmdb_pack_job_rec(void *object, uint16_t protocol_version,
pack_time(job->start, buffer);
pack32(job->state, buffer);
pack32(job->state_reason_prev, buffer);
_pack_slurmdb_stats(&job->stats, protocol_version, buffer);
/* job->stats removed in 22.05 */
_pack_slurmdb_stats(NULL, protocol_version, buffer);

if (job->steps)
count = list_count(job->steps);
Expand Down Expand Up @@ -3943,7 +3943,8 @@ extern void slurmdb_pack_job_rec(void *object, uint16_t protocol_version,
pack_time(job->start, buffer);
pack32(job->state, buffer);
pack32(job->state_reason_prev, buffer);
_pack_slurmdb_stats(&job->stats, protocol_version, buffer);
/* job->stats removed in 22.05 */
_pack_slurmdb_stats(NULL, protocol_version, buffer);

if (job->steps)
count = list_count(job->steps);
Expand Down Expand Up @@ -4072,10 +4073,6 @@ extern int slurmdb_unpack_job_rec(void **job, uint16_t protocol_version,
safe_unpack32(&uint32_tmp, buffer);
job_ptr->state = uint32_tmp;
safe_unpack32(&job_ptr->state_reason_prev, buffer);
if (_unpack_slurmdb_stats(&job_ptr->stats, protocol_version,
buffer)
!= SLURM_SUCCESS)
goto unpack_error;

safe_unpack32(&count, buffer);
job_ptr->steps = list_create(slurmdb_destroy_step_rec);
Expand Down Expand Up @@ -4114,6 +4111,8 @@ extern int slurmdb_unpack_job_rec(void **job, uint16_t protocol_version,
safe_unpack32(&job_ptr->wckeyid, buffer);
safe_unpackstr_xmalloc(&job_ptr->work_dir, &uint32_tmp, buffer);
} else if (protocol_version >= SLURM_21_08_PROTOCOL_VERSION) {
slurmdb_stats_t stats = {0};

safe_unpackstr_xmalloc(&job_ptr->account, &uint32_tmp, buffer);
safe_unpackstr_xmalloc(&job_ptr->admin_comment, &uint32_tmp,
buffer);
Expand Down Expand Up @@ -4170,10 +4169,11 @@ extern int slurmdb_unpack_job_rec(void **job, uint16_t protocol_version,
safe_unpack32(&uint32_tmp, buffer);
job_ptr->state = uint32_tmp;
safe_unpack32(&job_ptr->state_reason_prev, buffer);
if (_unpack_slurmdb_stats(&job_ptr->stats, protocol_version,
buffer)
/* job->stats removed in 22.05 */
if (_unpack_slurmdb_stats(&stats, protocol_version, buffer)
!= SLURM_SUCCESS)
goto unpack_error;
slurmdb_free_slurmdb_stats_members(&stats);

safe_unpack32(&count, buffer);
job_ptr->steps = list_create(slurmdb_destroy_step_rec);
Expand Down Expand Up @@ -4214,6 +4214,8 @@ extern int slurmdb_unpack_job_rec(void **job, uint16_t protocol_version,
safe_unpack32(&job_ptr->wckeyid, buffer);
safe_unpackstr_xmalloc(&job_ptr->work_dir, &uint32_tmp, buffer);
} else if (protocol_version >= SLURM_MIN_PROTOCOL_VERSION) {
slurmdb_stats_t stats = {0};

safe_unpackstr_xmalloc(&job_ptr->account, &uint32_tmp, buffer);
safe_unpackstr_xmalloc(&job_ptr->admin_comment, &uint32_tmp,
buffer);
Expand Down Expand Up @@ -4264,10 +4266,11 @@ extern int slurmdb_unpack_job_rec(void **job, uint16_t protocol_version,
safe_unpack32(&uint32_tmp, buffer);
job_ptr->state = uint32_tmp;
safe_unpack32(&job_ptr->state_reason_prev, buffer);
if (_unpack_slurmdb_stats(&job_ptr->stats, protocol_version,
buffer)
/* job->stats removed in 22.05 */
if (_unpack_slurmdb_stats(&stats, protocol_version, buffer)
!= SLURM_SUCCESS)
goto unpack_error;
slurmdb_free_slurmdb_stats_members(&stats);

safe_unpack32(&count, buffer);
job_ptr->steps = list_create(slurmdb_destroy_step_rec);
Expand Down
15 changes: 0 additions & 15 deletions src/sacct/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ extern int get_data(void)
ListIterator itr_step = NULL;
slurmdb_job_cond_t *job_cond = params.job_cond;
int cnt;
char *tmp_usage;

if (params.opt_completion) {
jobs = slurmdb_jobcomp_jobs_get(job_cond);
Expand Down Expand Up @@ -551,21 +550,7 @@ extern int get_data(void)
step->sys_cpu_sec;
job->sys_cpu_usec +=
step->sys_cpu_usec;

/* get the max for all the sacct_t struct */
aggregate_stats(&job->stats, &step->stats);
}

/* Now figure out the average of the total of averages */
tmp_usage = job->stats.tres_usage_in_ave;
job->stats.tres_usage_in_ave =
slurmdb_ave_tres_usage(tmp_usage, cnt);
xfree(tmp_usage);
tmp_usage = job->stats.tres_usage_out_ave;
job->stats.tres_usage_out_ave =
slurmdb_ave_tres_usage(tmp_usage, cnt);
xfree(tmp_usage);

list_iterator_destroy(itr_step);
}
list_iterator_destroy(itr);
Expand Down
20 changes: 10 additions & 10 deletions testsuite/expect/test21.41
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,16 @@ proc create_sql {cluster sql_in sql_rem} {
puts $file "on duplicate key update period_start=VALUES(period_start), period_end=VALUES(period_end);"

# add jobs
puts $file "insert into job_table (jobid, associd, wckey, wckeyid, uid, gid, `partition`, blockid, cluster, account, eligible, submit, start, end, suspended, name, track_steps, state, comp_code, priority, req_cpus, tres_alloc, nodelist, kill_requid, qos, deleted) values"
puts $file "('$jobid01', '$user1acct1', '$wckey1', '$user1wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$account1', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '0', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"
puts $file "('$jobid02', '$user1acct1', '$wckey2', '$user1wckey2', '$uid', '$gid', 'debug', '', '$cluster', '$account1', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '0', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"
puts $file "('$jobid03', '$user2acct1', '$wckey1', '$user2wckey1', '0', '0', 'debug', '', '$cluster', '$account1', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '0', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"
puts $file "('$jobid04', '$user2acct1', '$wckey2', '$user2wckey2', '0', '0', 'debug', '', '$cluster', '$account1', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '0', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"

puts $file "('$jobid05', '$user1acct2', '$wckey1', '$user1wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$account2', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '0', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"
puts $file "('$jobid06', '$user1acct2', '$wckey2', '$user1wckey2', '$uid', '$gid', 'debug', '', '$cluster', '$account2', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '0', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"
puts $file "('$jobid07', '$user2acct2', '$wckey1', '$user2wckey1', '0', '0', 'debug', '', '$cluster', '$account2', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '0', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"
puts $file "('$jobid08', '$user2acct2', '$wckey2', '$user2wckey2', '0', '0', 'debug', '', '$cluster', '$account2', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '0', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"
puts $file "insert into job_table (jobid, associd, wckey, wckeyid, uid, gid, `partition`, blockid, cluster, account, eligible, submit, start, end, suspended, name, state, comp_code, priority, req_cpus, tres_alloc, nodelist, kill_requid, qos, deleted) values"
puts $file "('$jobid01', '$user1acct1', '$wckey1', '$user1wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$account1', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"
puts $file "('$jobid02', '$user1acct1', '$wckey2', '$user1wckey2', '$uid', '$gid', 'debug', '', '$cluster', '$account1', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"
puts $file "('$jobid03', '$user2acct1', '$wckey1', '$user2wckey1', '0', '0', 'debug', '', '$cluster', '$account1', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"
puts $file "('$jobid04', '$user2acct1', '$wckey2', '$user2wckey2', '0', '0', 'debug', '', '$cluster', '$account1', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"

puts $file "('$jobid05', '$user1acct2', '$wckey1', '$user1wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$account2', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"
puts $file "('$jobid06', '$user1acct2', '$wckey2', '$user1wckey2', '$uid', '$gid', 'debug', '', '$cluster', '$account2', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"
puts $file "('$jobid07', '$user2acct2', '$wckey1', '$user2wckey1', '0', '0', 'debug', '', '$cluster', '$account2', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"
puts $file "('$jobid08', '$user2acct2', '$wckey2', '$user2wckey2', '0', '0', 'debug', '', '$cluster', '$account2', 1199138400, 1199138400, 1199138400, 1199139600, '0', '$job_name', '3', '0', '2', 2, '1=2', '$node_list', '0', '0', '0')"
puts $file "on duplicate key update id=LAST_INSERT_ID(id), eligible=VALUES(eligible), submit=VALUES(submit), start=VALUES(start), end=VALUES(end), associd=VALUES(associd), tres_alloc=VALUES(tres_alloc), wckey=VALUES(wckey), wckeyid=VALUES(wckeyid);";
close $file

Expand Down
12 changes: 6 additions & 6 deletions testsuite/expect/test22.1
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,12 @@ proc create_sql {cluster sql_in sql_rem} {
puts $file "on duplicate key update period_start=VALUES(period_start), period_end=VALUES(period_end);"

# Now we will put in a job running for an hour and 5 minutes
puts $file "insert into job_table (jobid, associd, wckey, wckeyid, uid, gid, `partition`, blockid, cluster, account, eligible, submit, start, end, suspended, name, track_steps, state, comp_code, priority, req_cpus, tres_alloc, nodelist, kill_requid, qos, deleted) values"
puts $file "('65536', '$user1acct1', '$wckey1', '$user1wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$job1_acct', $job0_start, $job0_start, $job0_start, $job0_end, '0', '$test_job1', '0', '3', '0', '$job1_cpus', $job1_cpus, '1=$job1_cpus', '$job1_nodes', '0', '0', '0')"
puts $file "('65537', '$user1acct1', '$wckey1', '$user1wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$job1_acct', $job1_start, $job1_start, $job1_start, $job1_end, '0', '$test_job1', '0', '3', '0', '$job1_cpus', $job1_cpus, '1=$job1_cpus', '$job1_nodes', '0', '0', '0')"
puts $file ", ('65538', '$user2acct3', '$wckey1', '$user2wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$job2_acct', $job2_elig, $job2_elig, $job2_start, $job2_end, '0', '$test_job2', '0', '3', '0', '$job2_cpus', '$job2_cpus', '1=$job2_cpus', '$job2_nodes', '0', '0', '0')"
puts $file ", ('65539', '$user1acct2', '$wckey1', '$user1wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$job3_acct', $job3_elig, $job3_elig, $job3_start, $job3_end, '0', '$test_job3', '0', '3', '0', '$job3_cpus', '$job3_cpus', '1=$job3_cpus', '$job3_nodes', '0', '0', '0')"
puts $file ", ('65540', '$user1acct2', '$wckey1', '$user1wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$job4_acct', $job4_elig, $job4_elig, $job4_start, $job4_end, '0', '$test_job4', '0', '3', '0', '$job4_cpus', '$job4_cpus', '1=$job4_cpus', '$job4_nodes', '0', '0', '0')"
puts $file "insert into job_table (jobid, associd, wckey, wckeyid, uid, gid, `partition`, blockid, cluster, account, eligible, submit, start, end, suspended, name, state, comp_code, priority, req_cpus, tres_alloc, nodelist, kill_requid, qos, deleted) values"
puts $file "('65536', '$user1acct1', '$wckey1', '$user1wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$job1_acct', $job0_start, $job0_start, $job0_start, $job0_end, '0', '$test_job1', '3', '0', '$job1_cpus', $job1_cpus, '1=$job1_cpus', '$job1_nodes', '0', '0', '0')"
puts $file "('65537', '$user1acct1', '$wckey1', '$user1wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$job1_acct', $job1_start, $job1_start, $job1_start, $job1_end, '0', '$test_job1', '3', '0', '$job1_cpus', $job1_cpus, '1=$job1_cpus', '$job1_nodes', '0', '0', '0')"
puts $file ", ('65538', '$user2acct3', '$wckey1', '$user2wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$job2_acct', $job2_elig, $job2_elig, $job2_start, $job2_end, '0', '$test_job2', '3', '0', '$job2_cpus', '$job2_cpus', '1=$job2_cpus', '$job2_nodes', '0', '0', '0')"
puts $file ", ('65539', '$user1acct2', '$wckey1', '$user1wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$job3_acct', $job3_elig, $job3_elig, $job3_start, $job3_end, '0', '$test_job3', '3', '0', '$job3_cpus', '$job3_cpus', '1=$job3_cpus', '$job3_nodes', '0', '0', '0')"
puts $file ", ('65540', '$user1acct2', '$wckey1', '$user1wckey1', '$uid', '$gid', 'debug', '', '$cluster', '$job4_acct', $job4_elig, $job4_elig, $job4_start, $job4_end, '0', '$test_job4', '3', '0', '$job4_cpus', '$job4_cpus', '1=$job4_cpus', '$job4_nodes', '0', '0', '0')"
puts $file "on duplicate key update id=LAST_INSERT_ID(id), eligible=VALUES(eligible), submit=VALUES(submit), start=VALUES(start), end=VALUES(end), associd=VALUES(associd), tres_alloc=VALUES(tres_alloc), wckey=VALUES(wckey), wckeyid=VALUES(wckeyid);";
close $file

Expand Down

0 comments on commit 2f5254c

Please sign in to comment.