Exemple #1
0
    def get_after_dependencies(self):
        """
        Compute and return a set of after dependencies.

        After dependencies express the desire that given job A runs after a
        given job B. This is spelled out as::

            id: A
            after: B

            id: B

        To combat a simple mistake where the jobs are space-delimited any
        mixture of white-space (including newlines) and commas are allowed.
        """
        deps = set()
        if self.after is None:
            return deps

        class V(Visitor):

            def visit_Text_node(visitor, node: Text):
                deps.add(self.qualify_id(node.text))

            def visit_Error_node(visitor, node: Error):
                logger.warning(_("unable to parse depends: %s"), node.msg)

        V().visit(WordList.parse(self.after))
        return deps
Exemple #2
0
    def get_nested_part(self):
        """Compute and return a set of test plan ids from nested_part field."""
        nested_parts = []
        if self.nested_part is not None:
            from plainbox.impl.session import SessionManager
            with SessionManager.get_throwaway_manager(self.provider_list) as m:
                context = m.default_device_context
                testplan_ids = []

                class V(Visitor):

                    def visit_Text_node(visitor, node: Text):
                        testplan_ids.append(self.qualify_id(node.text))

                    def visit_Error_node(visitor, node: Error):
                        logger.warning(_(
                            "unable to parse nested_part: %s"), node.msg)

                V().visit(WordList.parse(self.nested_part))
                for tp_id in testplan_ids:
                    try:
                        nested_parts.append(context.get_unit(tp_id, 'test plan'))
                    except KeyError:
                        logger.warning(_(
                            "unable to find nested part: %s"), tp_id)
        return nested_parts
Exemple #3
0
    def get_salvage_dependencies(self):
        """Return a set of jobs that need to fail before this job can run."""
        deps = set()
        if self.salvages is None:
            return deps

        class V(Visitor):
            def visit_Text_node(visitor, node: Text):
                deps.add(self.qualify_id(node.text))

            def visit_Error_node(visitor, node: Error):
                logger.warning(_("unable to parse depends: %s"), node.msg)

        V().visit(WordList.parse(self.salvages))
        return deps
    def get_bootstrap_job_ids(self):
        """Compute and return a set of job ids from bootstrap_include field."""
        job_ids = set()
        if self.bootstrap_include is None:
            return job_ids

        class V(Visitor):
            def visit_Text_node(visitor, node: Text):
                job_ids.add(self.qualify_id(node.text))

            def visit_Error_node(visitor, node: Error):
                logger.warning(_("unable to parse bootstrap_include: %s"),
                               node.msg)

        V().visit(WordList.parse(self.bootstrap_include))
        return job_ids
Exemple #5
0
    def get_bootstrap_job_ids(self):
        """Compute and return a set of job ids from bootstrap_include field."""
        job_ids = []
        if self.bootstrap_include is not None:

            class V(Visitor):

                def visit_Text_node(visitor, node: Text):
                    job_ids.append(self.qualify_id(node.text))

                def visit_Error_node(visitor, node: Error):
                    logger.warning(_(
                        "unable to parse bootstrap_include: %s"), node.msg)

            V().visit(WordList.parse(self.bootstrap_include))
        for tp_unit in self.get_nested_part():
            job_ids.extend(tp_unit.get_bootstrap_job_ids())
        return job_ids
Exemple #6
0
    def get_direct_dependencies(self):
        """
        Compute and return a set of direct dependencies

        To combat a simple mistake where the jobs are space-delimited any
        mixture of white-space (including newlines) and commas are allowed.
        """
        deps = set()
        if self.depends is None:
            return deps

        class V(Visitor):
            def visit_Text_node(visitor, node: Text):
                deps.add(self.qualify_id(node.text))

            def visit_Error_node(visitor, node: Error):
                logger.warning(_("unable to parse depends: %s"), node.msg)

        V().visit(WordList.parse(self.depends))
        return deps