From 5e18d6662f7165db49870ac4a95ab515bc656eee Mon Sep 17 00:00:00 2001 From: Danny Auble <da@schedmd.com> Date: Wed, 25 Jan 2017 12:16:04 -0700 Subject: [PATCH] Add back functionality to look at standard locations for files for batch jobs. Fallout from commit df31645095. --- .../burst_buffer/cray/burst_buffer_cray.c | 11 +++++++++- src/slurmctld/job_mgr.c | 20 +++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/plugins/burst_buffer/cray/burst_buffer_cray.c b/src/plugins/burst_buffer/cray/burst_buffer_cray.c index f68989ee40f..3031d654456 100644 --- a/src/plugins/burst_buffer/cray/burst_buffer_cray.c +++ b/src/plugins/burst_buffer/cray/burst_buffer_cray.c @@ -3181,7 +3181,7 @@ extern int bb_p_job_validate2(struct job_record *job_ptr, char **err_msg) dw_cli_path = xstrdup(bb_state.bb_config.get_sys_state); slurm_mutex_unlock(&bb_state.bb_mutex); - /* Standard file location for job arrays, version 16.05+ */ + /* Standard file location for job arrays */ if ((job_ptr->array_task_id != NO_VAL) && (job_ptr->array_job_id != job_ptr->job_id)) { hash_inx = job_ptr->array_job_id % 10; @@ -3198,6 +3198,15 @@ extern int bb_p_job_validate2(struct job_record *job_ptr, char **err_msg) } else { xfree(hash_dir); } + } else { + hash_inx = job_ptr->job_id % 10; + xstrfmtcat(hash_dir, "%s/hash.%d", state_save_loc, hash_inx); + (void) mkdir(hash_dir, 0700); + xstrfmtcat(job_dir, "%s/job.%u", hash_dir, job_ptr->job_id); + (void) mkdir(job_dir, 0700); + xstrfmtcat(script_file, "%s/script", job_dir); + if (job_ptr->batch_flag == 0) + rc = _build_bb_script(job_ptr, script_file); } /* Run "job_process" function, validates user script */ diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c index f3c106d5ecc..ad2be37eb6c 100644 --- a/src/slurmctld/job_mgr.c +++ b/src/slurmctld/job_mgr.c @@ -6581,7 +6581,7 @@ char **get_job_env(struct job_record *job_ptr, uint32_t * env_size) char *file_name = NULL, job_dir[40], **environment = NULL; int cc, fd = -1, hash; - /* Standard file location for job arrays, version 16.05+ */ + /* Standard file location for job arrays */ if (job_ptr->array_task_id != NO_VAL) { hash = job_ptr->array_job_id % 10; sprintf(job_dir, "/hash.%d/job.%u/environment", @@ -6590,6 +6590,14 @@ char **get_job_env(struct job_record *job_ptr, uint32_t * env_size) file_name = slurm_get_state_save_location(); xstrcat(file_name, job_dir); fd = open(file_name, 0); + } else { + hash = job_ptr->job_id % 10; + sprintf(job_dir, "/hash.%d/job.%u/environment", + hash, job_ptr->job_id); + xfree(file_name); + file_name = slurm_get_state_save_location(); + xstrcat(file_name, job_dir); + fd = open(file_name, 0); } if (fd >= 0) { @@ -6620,7 +6628,7 @@ char *get_job_script(struct job_record *job_ptr) if (!job_ptr->batch_flag) return NULL; - /* Standard file location for job arrays, version 16.05+ */ + /* Standard file location for job arrays */ if (job_ptr->array_task_id != NO_VAL) { hash = job_ptr->array_job_id % 10; sprintf(job_dir, "/hash.%d/job.%u/script", @@ -6629,6 +6637,14 @@ char *get_job_script(struct job_record *job_ptr) file_name = slurm_get_state_save_location(); xstrcat(file_name, job_dir); fd = open(file_name, 0); + } else { + hash = job_ptr->job_id % 10; + sprintf(job_dir, "/hash.%d/job.%u/script", + hash, job_ptr->job_id); + xfree(file_name); + file_name = slurm_get_state_save_location(); + xstrcat(file_name, job_dir); + fd = open(file_name, 0); } if (fd >= 0) { -- GitLab