Skip to content

Commit

Permalink
Create a temproary directory for all submission files.
Browse files Browse the repository at this point in the history
This way they can be called whatever is desired and there will be no overlap. i.e. can have runscript.sh without the random hash from TemporaryNamedFile.

	modified:   productionsystem/sql/models/ParametricJobs.py
  • Loading branch information
alexanderrichards committed Jul 17, 2019
1 parent f5e2e05 commit 0ea270d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions productionsystem/sql/models/ParametricJobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,12 @@ def _setup_dirac_job(self, DiracJob, tmp_runscript, tmp_filemanager):
def submit(self):
"""Submit parametric job."""
with dirac_api_job_client() as (dirac, dirac_job_class),\
TemporyFileManagerContext() as tmp_filemanager:
TemporyFileManagerContext() as tmp_filemanager,\
open(os.path.join(tmp_filemanager.new_dir(), "runscript.sh"), "w") as tmp_runscript:
os.chmod(tmp_runscript.name, 0o755)
try:
dirac_jobs = self._setup_dirac_job(dirac_job_class,
tmp_filemanager.new_file(mode="w",
permissions=0o755,
prefix="jobscript_",
suffix=".sh"),
tmp_runscript,
tmp_filemanager)
except Exception as err:
self.logger.exception("Error setting up the parametric job %d.%d: %s",
Expand Down

0 comments on commit 0ea270d

Please sign in to comment.