diff --git a/force_bdss/data_sources/base_data_source.py b/force_bdss/data_sources/base_data_source.py index e8eec36d78660d9aab8eb24f2e140392d807a05e..c700ea861daeaeb670451137b70f09ad8c065966 100644 --- a/force_bdss/data_sources/base_data_source.py +++ b/force_bdss/data_sources/base_data_source.py @@ -3,6 +3,11 @@ import six class BaseDataSource(six.with_metaclass(abc.ABCMeta)): + """Base class for the DataSource, any computational engine/retriever + for data. + + Inherit from this class for your specific DataSource. + """ def __init__(self, bundle, application, model): self.bundle = bundle self.application = application diff --git a/force_bdss/data_sources/base_data_source_model.py b/force_bdss/data_sources/base_data_source_model.py index 2aa81f20028abcee1fe8f460b7e2848855f62fb1..cc3f30ea2f0c37f693fa222e5783a96d04654fa2 100644 --- a/force_bdss/data_sources/base_data_source_model.py +++ b/force_bdss/data_sources/base_data_source_model.py @@ -4,6 +4,15 @@ from .i_data_source_bundle import IDataSourceBundle class BaseDataSourceModel(ABCHasStrictTraits): + """Base class for the bundle specific DataSource models. + This model will also provide, through traits/traitsui magic the View + that will appear in the workflow manager UI. + + In your bundle definition, your bundle-specific model must reimplement + this class. + """ + #: A reference to the creating bundle, so that we can + #: retrieve it as the originating factory. bundle = Instance(IDataSourceBundle, visible=False, transient=True) def __init__(self, bundle, *args, **kwargs): diff --git a/force_bdss/data_sources/i_data_source_bundle.py b/force_bdss/data_sources/i_data_source_bundle.py index 146c1e8cbaa03be765ad68d2707411b58046824c..5270245c23d05b36fda603bd723d843a6777ecd7 100644 --- a/force_bdss/data_sources/i_data_source_bundle.py +++ b/force_bdss/data_sources/i_data_source_bundle.py @@ -10,7 +10,12 @@ class IDataSourceBundle(Interface): name = String() def create_data_source(self, application, model): + """Factory method. + Must return the bundle-specific BaseDataSource instance. + """ pass def create_model(self, model_data=None): - pass + """Factory method. + Must return the bundle-specific BaseDataSourceModel instance. + """ diff --git a/force_bdss/io/workflow_writer.py b/force_bdss/io/workflow_writer.py index 129e64724d8d685f90028952c03d6d785315f04f..a83d54aab3c649a521a140d49774a89995275b8f 100644 --- a/force_bdss/io/workflow_writer.py +++ b/force_bdss/io/workflow_writer.py @@ -3,7 +3,20 @@ from traits.api import HasStrictTraits class WorkflowWriter(HasStrictTraits): + """A Writer for writing the Workflow onto disk. + """ def write(self, workflow, f): + """Writes the workflow model object to a file f in JSON format. + + Parameters + ---------- + workflow: Workflow + The Workflow instance to write to file + + f: File + A file object on which to write the workflow, properly serialized + into JSON. + """ data = { "version": "1", "workflow": {} diff --git a/force_bdss/kpi/base_kpi_calculator_model.py b/force_bdss/kpi/base_kpi_calculator_model.py index 9838c8682d8eb214023183f5104553cc2be0df8e..1b254a96b5198709e437b8a90187730caafe2919 100644 --- a/force_bdss/kpi/base_kpi_calculator_model.py +++ b/force_bdss/kpi/base_kpi_calculator_model.py @@ -4,6 +4,15 @@ from .i_kpi_calculator_bundle import IKPICalculatorBundle class BaseKPICalculatorModel(ABCHasStrictTraits): + """Base class for the bundle specific KPI calculator models. + This model will also provide, through traits/traitsui magic the View + that will appear in the workflow manager UI. + + In your bundle definition, your bundle-specific model must reimplement + this class. + """ + #: A reference to the creating bundle, so that we can + #: retrieve it as the originating factory. bundle = Instance(IKPICalculatorBundle, visible=False, transient=True) def __init__(self, bundle, *args, **kwargs): diff --git a/force_bdss/mco/base_mco_model.py b/force_bdss/mco/base_mco_model.py index 00ff4af283c37d9b6470afc2ad15e349985f45f2..e7466353e63a32edc862d744b643752f6c2f88cb 100644 --- a/force_bdss/mco/base_mco_model.py +++ b/force_bdss/mco/base_mco_model.py @@ -4,8 +4,18 @@ from .i_multi_criteria_optimizer_bundle import IMultiCriteriaOptimizerBundle class BaseMCOModel(ABCHasStrictTraits): + """Base class for the bundle specific MCO models. + This model will also provide, through traits/traitsui magic the View + that will appear in the workflow manager UI. + + In your bundle definition, your bundle-specific model must reimplement + this class. + """ + #: A reference to the creating bundle, so that we can + #: retrieve it as the originating factory. bundle = Instance(IMultiCriteriaOptimizerBundle, - visible=False, transient=True) + visible=False, + transient=True) def __init__(self, bundle, *args, **kwargs): self.bundle = bundle diff --git a/force_bdss/workspecs/workflow.py b/force_bdss/workspecs/workflow.py index 2796f231399f928f26aa59ba6759f79ee144e0c9..b7963a0d4622888562f05743e8d3dfdc8194b73e 100644 --- a/force_bdss/workspecs/workflow.py +++ b/force_bdss/workspecs/workflow.py @@ -6,6 +6,15 @@ from ..mco.base_mco_model import BaseMCOModel class Workflow(HasStrictTraits): + """Model object that represents the Workflow as a whole""" + #: Contains the bundle-specific MCO Model object. + #: Can be None if no MCO has been specified yet. multi_criteria_optimizer = Instance(BaseMCOModel, allow_none=True) + + #: Contains the bundle-specific DataSource Model objects. + #: The list can be empty data_sources = List(BaseDataSourceModel) + + #: Contains the bundle-specific KPI Calculator Model objects. + #: The list can be empty kpi_calculators = List(BaseKPICalculatorModel)