示例#1
0
 def __init__(self, module_name, format_fields=None, summary_fmt=None, help_page_fmt=None, group=None):
     if not summary_fmt:
         summary_fmt = "No summary for '%(command)s'"
     if not help_page_fmt:
         help_page_fmt = "No help page for '%(command)s'" 
     self.module_name = module_name
     self.logger = logger.get_logger(module_name)
     self.command = cli.command_from_module_name(module_name)
     self.format_fields = format_fields if format_fields else {}
     self.format_fields['command'] = self.command
     self.summary_fmt = summary_fmt
     self.help_page_fmt = help_page_fmt
     self.group = group
     self._parser = None
示例#2
0
 def __init__(self,
              module_name,
              format_fields=None,
              summary_fmt=None,
              help_page_fmt=None,
              group=None):
     if not summary_fmt:
         summary_fmt = "No summary for '%(command)s'"
     if not help_page_fmt:
         help_page_fmt = "No help page for '%(command)s'"
     self.module_name = module_name
     self.logger = logger.get_logger(module_name)
     self.command = cli.command_from_module_name(module_name)
     self.format_fields = format_fields if format_fields else {}
     self.format_fields['command'] = self.command
     self.summary_fmt = summary_fmt
     self.help_page_fmt = help_page_fmt
     self.group = group
     self._parser = None
示例#3
0
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
"""TODO: FIXME: Docs"""

from taucmdr import logger
from taucmdr.error import InternalError, UniqueAttributeError, ModelError

LOGGER = logger.get_logger(__name__)


class Controller(object):
    """The "C" in `MVC`_.

    Attributes:
        model (AbstractModel): Data model.
        storage (AbstractDatabase): Record storage. 
    
    .. _MVC: https://en.wikipedia.org/wiki/Model-view-controller
    """
    
    messages = {}
    
    def __init__(self, model_cls, storage):
示例#4
0
and will have zero or more :any:`Trial`. There is one selected experiment per project.
The selected experiment will be used for application compilation and trial visualization.
"""

import os
import fasteners
from taucmdr import logger, util
from taucmdr.error import ConfigurationError, InternalError, IncompatibleRecordError, ProjectSelectionError
from taucmdr.error import ExperimentSelectionError
from taucmdr.mvc.model import Model
from taucmdr.mvc.controller import Controller
from taucmdr.model.trial import Trial
from taucmdr.model.project import Project
from taucmdr.cf.storage.levels import PROJECT_STORAGE, highest_writable_storage

LOGGER = logger.get_logger(__name__)


def attributes():
    from taucmdr.model.target import Target
    from taucmdr.model.application import Application
    from taucmdr.model.measurement import Measurement
    return {
        'name': {
            'primary_key': True,
            'type': 'string',
            'description': 'human-readable experiment name',
            'unique': True,
        },
        'project': {
            'model': Project,