Skip to content
Snippets Groups Projects
Commit a544b473 authored by Maximilian Schmidt's avatar Maximilian Schmidt
Browse files

Catch sumatra not installed case

parent 7e37845f
No related branches found
No related tags found
1 merge request!1Add all necessary files for the multi-area model
......@@ -28,7 +28,11 @@ from .default_params import nested_update, sim_params
from .default_params import check_custom_params
from dicthash import dicthash
from .multiarea_helpers import extract_area_dict, create_vector_mask
from .sumatra_helpers import register_runtime
try:
from .sumatra_helpers import register_runtime
sumatra_found = True
except ImportError:
sumatra_found = False
class Simulation:
......@@ -295,7 +299,11 @@ class Simulation:
json.dump(d, f)
def register_runtime(self):
register_runtime(self.label)
if sumatra_found:
register_runtime(self.label)
else:
raise ImportWarning('Sumatra is not installed, so'
'cannot register the runtime.')
class Area:
......
......@@ -4,7 +4,11 @@ import shutil
from config import base_path, data_path
from multiarea_model.default_params import nested_update, sim_params
from multiarea_model.sumatra_helpers import register_record
try:
from multiarea_model.sumatra_helpers import register_record
sumatra_found = True
except ImportError:
sumatra_found = False
def start_job(label, submit_cmd, jobscript_template, sumatra=False, reason=None, tag=None):
......@@ -70,7 +74,11 @@ def start_job(label, submit_cmd, jobscript_template, sumatra=False, reason=None,
# If chosen, register simulation to sumatra
if sumatra:
register_record(label, reason=reason, tag=tag)
if sumatra_found:
register_record(label, reason=reason, tag=tag)
else:
raise ImportWarning('Sumatra is not installed, so'
'cannot register simulation record.')
# Submit job
os.system('{submit_cmd} {job_script_fn}'.format(submit_cmd=submit_cmd,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment