예제 #1
0
    def get_root_workflow_list(self, counts_only=False, **table_args):
        """
        Get basic information about all workflows running, on all databases. This is for the index page.
        Returns a list of workflows.
        """
        self._workflows = []

        # Now, let's try to access the database
        try:
            all_workflows = None
            all_workflows = queries.MasterDatabase(self._master_db_url)
            counts = all_workflows.get_workflow_counts()

            if counts_only:
                if counts[0] == 0:
                    raise NoWorkflowsFoundError(count=None, filtered=None)

                return counts

            count, filtered, workflows = all_workflows.get_all_workflows(
                **table_args
            )

            if workflows:
                self._workflows.extend(workflows)

            if len(self._workflows) == 0:
                # Throw no workflows found error.
                raise NoWorkflowsFoundError(count=count, filtered=filtered)

            return (count, filtered, self._workflows, counts)

        finally:
            Dashboard.close(all_workflows)
예제 #2
0
 def initialize(self, root_wf_id, wf_id):
     try:
         workflow = queries.MasterDatabase(self._master_db_url)
         self._db_id, self._root_wf_uuid, self._wf_db_url = workflow.get_wf_id_url(
             root_wf_id)
         self._wf_id = wf_id
     finally:
         Dashboard.close(workflow)