Commit 6b122d4b authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fixes #2.


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