Skip to content

Commit

Permalink
precommand bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mkphuthi committed Jan 20, 2025
1 parent b24fa2a commit 9c92520
Showing 1 changed file with 2 additions and 39 deletions.
41 changes: 2 additions & 39 deletions asimtools/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ def _gen_array_script(
# txt += ' WORKDIR=${fls[${SLURM_ARRAY_TASK_ID}]}\n'
# txt += 'fi\n\n'
# txt += 'cd ${WORKDIR}\n'
txt += ' ' + '\n'.join(slurm_params.get('precommands', []))
txt += ' ' + '\n'.join(slurm_params.get('precommands', [])) + '\n'
txt += '\n '.join(
self.unitjobs[0].calc_params.get('precommands', [])
) + '\n'
Expand Down Expand Up @@ -961,44 +961,7 @@ def submit(self, dependency: Union[List,None] = None, debug: bool = False) -> Li
curjob.env['slurm']['flags']['-J'] = \
f'step-{step+i}'

# if i < len(self.unitjobs)-1:
# nextjob = self.unitjobs[i+1]

# curworkdir = os.path.relpath(
# curjob.workdir,
# nextjob.workdir
# )
# nextjob.sim_input['dependent_dir'] = str(curworkdir)

# #### dep in job script implementation
# #if there is a following job
# if i < len(self.unitjobs)-1:
# nextjob = self.unitjobs[i+1]

# nextworkdir = os.path.relpath(
# nextjob.workdir,
# curjob.workdir
# )
# curworkdir = os.path.relpath(
# curjob.workdir,
# nextjob.workdir
# )
# # Add postcommands to go into the next workdir
# postcommands = curjob.env['slurm'].get(
# 'postcommands', []
# )
# postcommands += ['\n#Submitting next step:']
# postcommands += [f'cd {nextworkdir}']
# # submit the next job dependent in the current
# # sh script
# submit_txt = 'asim-execute sim_input.yaml '
# submit_txt += '-c calc_input.yaml '
# submit_txt += '-e env_input.yaml '
# postcommands += [submit_txt]
# postcommands += [f'cd {curworkdir}']
# curjob.env['slurm']['postcommands'] = postcommands
# #####
# submit the next job dependent on the current one
# submit the next job dependent on the current one
# Previous working solution
write_image = False
# Write image first step in chain being run/continued
Expand Down

0 comments on commit 9c92520

Please sign in to comment.