Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_models(full_path, name):
try:
with open(full_path, "r") as model_file:
stochss_model = json.loads(model_file.read())
stochss_model['name'] = name
is_ode = stochss_model['defaultMode'] == "continuous"
except FileNotFoundError as error:
print(str(error))
log.critical("Failed to find the model file: {0}".format(error))
try:
_model = ModelFactory(stochss_model, is_ode) # build GillesPy2 model
gillespy2_model = _model.model
except Exception as error:
print(str(error))
log.error(str(error))
gillespy2_model = None
return gillespy2_model, stochss_model
def get_models(full_path, name, wkfl_path, is_ode):
try:
with open(full_path, "r") as model_file:
stochss_model = json.loads(model_file.read())
stochss_model['name'] = name
except FileNotFoundError as error:
log.critical("Failed to copy the model into the directory: {0}".format(error))
open(os.path.join(wkfl_path, 'ERROR'), 'w').close() # update status to error
try:
_model = ModelFactory(stochss_model, is_ode) # build GillesPy2 model
gillespy2_model = _model.model
except Exception as error:
log.error("GillesPy2 Model Errors: "+str(error))
gillespy2_model = None
return gillespy2_model, stochss_model