def __call__(self, ref_to_proj: str = None, resolvers: list = (), ignore: bool = False): proj = None for res in resolvers or self.ALL: assert res in self.ALL method = getattr(self, 'resolve_{}'.format(res)) proj = method(ref_to_proj) if proj is not None: LOG.info("Working project is '{}'".format(proj.name)) LOG.debug("Project resolution method was '{}'".format(res)) break else: message = """Could not determine working project from reference '{}'""".format( ref_to_proj) details = """Resolvers used: {}""".format(resolvers) if ignore: LOG.info(message) LOG.debug(details) else: raise ResolutionError(message, details) return proj
def print_logs(self, logs): for line in logs: dyct = assert_dict(line) if 'stream' in dyct: message = dyct['stream'].strip() if message: LOG.debug(message) if 'error' in dyct: raise NhaDockerError(dyct['error'].strip())
def _run(self, **kwargs): try: LOG.debug("Notebook parameters:") LOG.debug(kwargs.get('parameters', {})) self.proc_mon.set_state(Task.State.RUNNING) pm.execute_notebook(**kwargs) except Exception as e: self._handle_exc(e) return False else: LOG.info("Notebook execution succeeded!") self.proc_mon.set_state(Task.State.FINISHED) return True