Commit 7aefe3ee authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fixes #2.

Former-commit-id: 5daf3659
Former-commit-id: 6b122d4b
parent d62740d7
......@@ -13,6 +13,7 @@ from collections import OrderedDict
import multiprocessing
from inspect import getargvalues, stack, getfullargspec, signature, _empty
import json
from json import JSONDecodeError
from jsmin import jsmin
from cerberus import Validator
import pkgutil
......@@ -515,7 +516,14 @@ class JobConfig(object):
# update default options with those from DB
if self.DB_job_record.analysis_parameter:
db_options = json_to_python(json.loads(jsmin(self.DB_job_record.analysis_parameter))) # type: dict
try:
params_dict = json.loads(jsmin(self.DB_job_record.analysis_parameter))
except JSONDecodeError:
warnings.warn('The given JSON options file could not be decoded. JSON decoder failed with the '
'following error:')
raise
db_options = json_to_python(params_dict) # type: dict
default_options.update(db_options)
if validate:
......
......@@ -47,12 +47,12 @@ class BaseTest_ExceptionHandler:
raise RuntimeError('TestException raised by dummy_gms_mapper_fail()')
def get_current_progress_stats(self):
return get_info_from_postgreSQLdb(self.PC.job.conn_database, 'jobs', 'statistics',
cond_dict=dict(id=self.PC.job.ID))[0][0]
return get_info_from_postgreSQLdb(self.PC.config.conn_database, 'jobs', 'statistics',
cond_dict=dict(id=self.PC.config.ID))[0][0]
def is_sceneid_in_failedIDs(self, sceneid):
return sceneid in get_info_from_postgreSQLdb(self.PC.job.conn_database, 'jobs', ['failed_sceneids'],
{'id': self.PC.job.ID})[0][0]
return sceneid in get_info_from_postgreSQLdb(self.PC.config.conn_database, 'jobs', ['failed_sceneids'],
{'id': self.PC.config.ID})[0][0]
class Test_ExceptionHandler_NoSubsystems(BaseTest_ExceptionHandler.Test_ExceptionHandler):
......@@ -72,7 +72,7 @@ class Test_ExceptionHandler_NoSubsystems(BaseTest_ExceptionHandler.Test_Exceptio
def test_disabled_exception_handler(self):
"""Check if exception handler raises exceptions of CFG.Job.disable_exception_handler = True."""
self.PC.job.disable_exception_handler = True
self.PC.config.disable_exception_handler = True
self.assertRaises(RuntimeError, self.dummy_gms_mapper_fail, self.PC.config.data_list[0])
......
......@@ -139,7 +139,7 @@ class BaseTestCases:
self.assertIsInstance(self.L2C_newObjects, list)
self.assertNotEqual(len(self.L2C_newObjects), 0, msg='L2C_processing did not output an L2C object.')
self.assertIsInstance(self.L2C_newObjects[0], L2C_object)
# Setting the job.status manually.
# Setting the config.status manually.
# if self.L2C_newObjects:
# self.PC.config.status = "finished"
# FIXME after updating the job.status-attribute for the level-processes, delete the code that is commented
......
Markdown is supported
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