Skip to content

Commit

Permalink
feat: added option to supress BNGL2 output
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrkarr committed Sep 30, 2021
1 parent 1cf6fec commit ed74af4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion biosimulators_bionetgen/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.17'
__version__ = '0.1.18'
2 changes: 1 addition & 1 deletion biosimulators_bionetgen/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def exec_sed_task(task, variables, preprocessed_task=None, log=None, config=None
# execute the task
bionetgen_task.actions.extend(preprocessed_task['simulation_actions'])

observable_results = exec_bionetgen_task(bionetgen_task)
observable_results = exec_bionetgen_task(bionetgen_task, verbose=config.VERBOSE)

# get predicted values of the variables
variable_results = get_variables_results_from_observable_results(observable_results, variables)
Expand Down
6 changes: 4 additions & 2 deletions biosimulators_bionetgen/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,12 @@ def create_actions_for_simulation(simulation, config=None):
return actions, exec_kisao_id


def exec_bionetgen_task(task):
def exec_bionetgen_task(task, verbose=True):
""" Execute a task and return the predicted values of the observables
Args:
task (:obj:`Task`): task
verbose (:obj:`bool`, optional): whether to display diagnostic information
Returns:
:obj:`pandas.DataFrame`: predicted values of the observables
Expand All @@ -355,7 +356,8 @@ def exec_bionetgen_task(task):
# execute the task
bionetgen_path = SimulatorConfig().bionetgen_path
try:
subprocess.check_call([bionetgen_path, task_filename, '--outdir', temp_dirname])
subprocess.check_call([bionetgen_path, task_filename, '--outdir', temp_dirname],
stdout=None if verbose else subprocess.DEVNULL)
except Exception:
# cleanup temporary files
shutil.rmtree(temp_dirname)
Expand Down

0 comments on commit ed74af4

Please sign in to comment.