From 2137db7fc473f9ce7ab620fe7b9669e93bc780e5 Mon Sep 17 00:00:00 2001 From: Stefano Borini <sborini@enthought.com> Date: Fri, 29 Jun 2018 13:18:39 +0100 Subject: [PATCH] Setting the appropriate driver in case of run_datasource being specified --- force_bdss/bdss_application.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/force_bdss/bdss_application.py b/force_bdss/bdss_application.py index a822528..9012ebc 100644 --- a/force_bdss/bdss_application.py +++ b/force_bdss/bdss_application.py @@ -6,8 +6,9 @@ from stevedore.exception import NoMatches from envisage.api import Application from envisage.core_plugin import CorePlugin -from traits.api import Unicode, Bool +from traits.api import Unicode, Bool, Either +from force_bdss.core_run_datasource_driver import CoreRunDataSourceDriver from .factory_registry_plugin import FactoryRegistryPlugin from .core_evaluation_driver import CoreEvaluationDriver from .core_mco_driver import CoreMCODriver @@ -28,13 +29,23 @@ class BDSSApplication(Application): #: coordination of the MCO itself. See design notes for more details. evaluate = Bool() - def __init__(self, evaluate, workflow_filepath): + #: This entry, if not None, drives the evaluator to run a single + #: data source in the workflow. It accepts input parameters on standard + #: input and returns the output to standard output. + run_datasource = Either(Unicode(), None) + + def __init__(self, evaluate, run_datasource, workflow_filepath): self.evaluate = evaluate + self.run_datasource = run_datasource self.workflow_filepath = workflow_filepath plugins = [CorePlugin(), FactoryRegistryPlugin()] - if self.evaluate: + if self.run_datasource: + plugins.append(CoreRunDataSourceDriver( + run_datasource=run_datasource + )) + elif self.evaluate: plugins.append(CoreEvaluationDriver()) else: plugins.append(CoreMCODriver()) -- GitLab