示例#1
0
文件: builder.py 项目: bazsi/codega
    def run_task_file(cls, config_file, task, **kwargs):
        config_path = get_config(config_file)

        # Check if file exists
        if config_path is None:
            if config_file:
                logger.critical("File %r not found", config_file)

            else:
                logger.critical("No suitable config file could be found")

            return False

        # Load configuration file
        try:
            logger.info('Loading config file %r', config_path)
            config = ConfigSource(BuildRunner.__environment_replacements).load(config_path)

        except ParseError, parse_error:
            logger.error('Parse error: %s', parse_error)
            logger.exception()
            if not kwargs.get('guarded', True):
                raise

            return False
示例#2
0
文件: base.py 项目: bazsi/codega
    def handle_exception(self, desc_short, desc_long):
        '''Handle some exception that occured during the execution

        Arguments:
        exception -- Caught exception
        '''

        logger.exception(preface='An error occured during the execution of %s' % self.name,
                         level=logger.ERROR,
                         short_desc=desc_short,
                         long_desc=desc_long,
                         level_trace=logger.DEBUG)
示例#3
0
    def run_task(self, task, *args, **kwargs):
        if not self.__builders:
            logger.error("No builders found")
            return False

        for builder in self.__builders:
            try:
                if not builder.run_task(task, *args, **kwargs):
                    logger.info('Builder has no task %s' % task)

                else:
                    logger.info('Completed task %s on %s' % (task, builder))

            except Exception, error:
                logger.critical('Could not complete %s: %s', task, error)
                logger.exception()
                return False
示例#4
0
    def run_task(self, task, *args, **kwargs):
        if not self.__builders:
            logger.error("No builders found")
            return False

        for builder in self.__builders:
            try:
                if not builder.run_task(task, *args, **kwargs):
                    logger.info('Builder has no task %s' % task)

                else:
                    logger.info('Completed task %s on %s' % (task, builder))

            except Exception, error:
                logger.critical('Could not complete %s: %s', task, error)
                logger.exception()
                return False
示例#5
0
    def run_task_file(cls, config_file, task, **kwargs):
        config_path = get_config(config_file)

        # Check if file exists
        if config_path is None:
            if config_file:
                logger.critical("File %r not found", config_file)

            else:
                logger.critical("No suitable config file could be found")

            return False

        # Load configuration file
        try:
            logger.info('Loading config file %r', config_path)
            config = ConfigSource(
                BuildRunner.__environment_replacements).load(config_path)

        except ParseError, parse_error:
            logger.error('Parse error: %s', parse_error)
            logger.exception()
            return False