Skip to content

Commit e83517b

Browse files
committed
add out_folder for oq runs
1 parent 8f988b6 commit e83517b

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/oq_run_many.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
def main(job_ini, rup_files, gmlt_files, max_distances=None,
8-
concurrent_jobs=1):
8+
concurrent_jobs=1, out_folder='Sensitivity'):
99
'''
1010
Funtion to run sensitivity analysis for ruptures and gmlt.
1111
@@ -25,6 +25,9 @@ def main(job_ini, rup_files, gmlt_files, max_distances=None,
2525
2626
concurrent_jobs : int
2727
Number of concurrent jobs to run
28+
29+
out_folder : str
30+
Folder name to save log files (it will be relative to the location of the job.ini)
2831
2932
Returns
3033
-------
@@ -59,12 +62,12 @@ def main(job_ini, rup_files, gmlt_files, max_distances=None,
5962
# Build a job for each rupture model
6063
jobs = create_jobs(allparams, multi=True) # independent jobs
6164

62-
# Run the jobs one by one (no parallel option)
65+
# Run the jobs (possibility for parallel calcs)
6366
run_jobs(jobs, concurrent_jobs) # concurrent_jobs=1
6467

6568
# Save the logs
6669
for job in jobs:
67-
save_log = os.path.join(base_path, 'Sensitivity', f'log_calc_{job.calc_id}.txt')
70+
save_log = os.path.join(base_path, out_folder, f'log_calc_{job.calc_id}.txt')
6871
rows = logs.dbcmd(
6972
'SELECT job_id, message FROM log WHERE job_id=?x', job.calc_id)
7073
with open(save_log, 'w') as f:
@@ -82,10 +85,3 @@ def main(job_ini, rup_files, gmlt_files, max_distances=None,
8285
gmlt_files = sys.argv[3]
8386

8487
main(job, rup_files, gmlt_files)
85-
86-
# job_ini = 'Nepal/20150425_M7.8_Gorkha/OpenQuake_gmfs/job_stations_seismic.ini'
87-
# oq_rups = ['../Rupture/earthquake_rupture_model_Hayes.xml']
88-
# oq_gmlt = ['gmpe_logic_tree_Adjusted.xml']
89-
# max_distances = [50]
90-
91-
# a = main(job_ini, oq_rups, oq_gmlt, max_distances)

0 commit comments

Comments
 (0)