Example #1
0
    def copy_static(self):
        """Copy template statics files to output dir.

        Files under each path specifed by :py:attr:`static_roots`
        will be copied to folder :file:`static` below :py:attr:`report_root`.
        """
        if is_pathlike(self.static_roots):
            _static_roots = [self.static_roots]
        else:
            _static_roots = self.static_roots
        merged_copytree(_static_roots, self.report_root / 'static')
Example #2
0
    def __init__(self, job_info, report_root):
        """Initiate a Stage object.

        Here NGS result info and path to gerenerate report is passed.

        .. py:attribute:: job_info
            :annotation: = job_info

            :py:class:`~ngcloud.info.JobInfo` object.

        .. py:attribute:: report_root
            :annotation: = report_root

            :py:class:`~pathlib.Path` object.

        .. py:attribute:: result_info
            :annotation: = dict()

            A :class:`!dict` object to store NGS result info. See :meth:`parse`
            for more information.

            .. note:: Key names should follow Python argument naming rule.

        .. py:attribute:: result_root
            :annotation: = join_info.root_path + result_foldername

            :class:`~pathlib.Path` object to the stage result root folder.

            This attribute is automatically set by finding the matched
            foldername based on :attr:`result_foldername`
        """
        logger.info("Initating new stage {}".format(type(self).__name__))
        self._setup_jinja2()
        if is_pathlike(self.template_entrances):
            tpls = [self.template_entrances]
        else:
            tpls = self.template_entrances
        self._templates = {tpl: self._env.get_template(tpl) for tpl in tpls}

        self.job_info = job_info
        self.report_root = report_root
        self.result_info = dict()
        logger.debug("... Loacate result folder path")
        self.result_root = self._locate_result_folder()
        logger.debug("... stage initiated".format(type(self).__name__))