Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Attributes
----------
wkfl : StochSS Workflow
The workflow object being worked with.
verbose : boolean
Print progress statements.
'''
is_ode = wkfl.settings['simulationSettings']['algorithm'] == "ODE"
# Get the model data from the file and create the model object
gillespy2_model, stochss_model = get_models(wkfl.wkfl_mdl_path, wkfl.mdl_file.split('.')[0], wkfl.wkfl_path, is_ode)
# run the workflow
try:
wkfl.run(gillespy2_model, verbose)
except Exception as error:
# update workflow status to error if GillesPy2 throws an exception
log.error("Workflow errors: {0}".format(error))
open(os.path.join(wkfl.wkfl_path, 'ERROR'), 'w').close()
else:
open(os.path.join(wkfl.wkfl_path, 'COMPLETE'), 'w').close() # update status to complete
Attributes
----------
wkfl : StochSS Workflow
The workflow object being worked with.
wkfl_type : str
The type of workflow to be used.
is_new : boolean
Represents whether the workflow is new or not.
'''
old_model_path = os.path.join(wkfl.wkfl_path, wkfl.mdl_file) # path to the old model
os.remove(old_model_path) # remove the old model
try:
copyfile(wkfl.mdl_path, wkfl.wkfl_mdl_path) # copy the new model into the workflow directory
except FileNotFoundError as error:
log.error("Failed to copy the model into the directory: {0}".format(error))
# Update the workflow info file
update_info_file(wkfl, wkfl_type, initialize)
# Update workflow settings file
wkfl.save()
if initialize:
# Update workflow status to running
open(os.path.join(wkfl.wkfl_path, 'RUNNING'), 'w').close()
return "Successfully saved the existing workflow: {0}".format(wkfl.wkfl_path)