diff --git a/src/plugins/burst_buffer/cray/burst_buffer_cray.c b/src/plugins/burst_buffer/cray/burst_buffer_cray.c index 3f3e0329bad8781a59d97c36dbc1ed753012b15c..3d829d23de5b873bb3ef7a2e60da9d128d64a5dd 100644 --- a/src/plugins/burst_buffer/cray/burst_buffer_cray.c +++ b/src/plugins/burst_buffer/cray/burst_buffer_cray.c @@ -851,6 +851,23 @@ static int _open_part_state_file(char **state_file) return state_fd; } +/* Return true if the burst buffer name is that of a job (i.e. numeric) and + * and that job is complete. Otherwise return false. */ +static bool _is_complete_job(char *name) +{ + char *end_ptr = NULL; + uint32_t job_id = 0; + struct job_record *job_ptr; + + if (name && (name[0] >='0') && (name[0] <='9')) { + job_id = strtol(name, &end_ptr, 10); + job_ptr = find_job_record(job_id); + if (!job_ptr || IS_JOB_COMPLETED(job_ptr)) + return true; + } + return false; +} + /* Recover saved burst buffer state and use it to preserve account, partition, * and QOS information for persistent burst buffers. */ static void _recover_bb_state(void) @@ -931,7 +948,12 @@ static void _recover_bb_state(void) pool = xstrdup(bb_state.bb_config.default_pool); } - if (bb_state.bb_config.flags & BB_FLAG_EMULATE_CRAY) { + if ((bb_state.bb_config.flags & BB_FLAG_EMULATE_CRAY) && + _is_complete_job(name)) { + info("%s, Ignoring burst buffer state for completed job %s", + __func__, name); + bb_alloc = NULL; + } else if (bb_state.bb_config.flags & BB_FLAG_EMULATE_CRAY) { bb_alloc = bb_alloc_name_rec(&bb_state, name, user_id); bb_alloc->id = id; last_persistent_id = MAX(last_persistent_id, id);