Skip to content

Commit

Permalink
Merge pull request #9070 from gem/ds_calc_dir
Browse files Browse the repository at this point in the history
Restored ds_calc_dir as it was
  • Loading branch information
micheles committed Oct 4, 2023
2 parents e7280d5 + 4a99818 commit 4d9e762
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions openquake/commonlib/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ def _read(calc_id: int, datadir, mode, haz_id=None):
job = dbcmd('get_job', calc_id)
if job:
jid = job.id
path = job.ds_calc_dir
path = job.ds_calc_dir + '.hdf5'
hc_id = job.hazard_calculation_id
if not hc_id and haz_id:
dbcmd('update_job', jid, {'hazard_calculation_id': haz_id})
hc_id = haz_id
if hc_id and hc_id != jid:
hc = dbcmd('get_job', hc_id)
if hc:
ppath = hc.ds_calc_dir
ppath = hc.ds_calc_dir + '.hdf5'
else:
ppath = os.path.join(ddir, 'calc_%d.hdf5' % hc_id)
else: # when using oq run there is no job in the db
Expand Down
2 changes: 1 addition & 1 deletion openquake/server/db/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def create_job(db, datadir, calculation_mode='to be set',
job_id = db('INSERT INTO job (?S) VALUES (?X)', job.keys(), job.values()
).lastrowid
db('UPDATE job SET ds_calc_dir=?x WHERE id=?x',
os.path.join(datadir, 'calc_%s.hdf5' % job_id), job_id)
os.path.join(datadir, 'calc_%s' % job_id), job_id)
return job_id


Expand Down

0 comments on commit 4d9e762

Please sign in to comment.