How to use the gillespy2.core.log function in gillespy2

To help you get started, we’ve selected a few gillespy2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github StochSS / stochss / stochss / handlers / util / run_model.py View on Github external
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
github StochSS / stochss / stochss / handlers / util / run_workflow.py View on Github external
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
github StochSS / stochss / stochss / handlers / util / run_workflow.py View on Github external
used for it.

    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.
    '''
    os.mkdir(wkfl.res_path) # make the workflow's result directory
    try:
        copyfile(wkfl.mdl_path, wkfl.wkfl_mdl_path) # copy the 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 new workflow: {0}".format(wkfl.wkfl_path)