Commit ca3e3f7a authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Minor changes.

parent 5b96412a
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -406,7 +406,7 @@ class DbConnector(object):
        finally:
            self.connPool.putconn(conn, close = False)

    def listActiveJobs(self):
    def getActiveJobs(self):
        """Returns some info about active jobs."""
        conn = self.getConnection()
        try:
@@ -420,6 +420,7 @@ class DbConnector(object):
                       owner_id
                       FROM job
                       WHERE phase NOT IN ('ABORTED',
                                           'ARCHIVED',
                                           'COMPLETED',
                                           'ERROR')
                       AND
@@ -447,12 +448,12 @@ class DbConnector(object):
        finally:
            self.connPool.putconn(conn, close = False)

    def listJobsByPhase(self, phase):
    def getJobsByPhase(self, phase):
        """Returns some info about jobs according to the phase."""
        conn = self.getConnection()
        try:
            cursor = conn.cursor(cursor_factory = RealDictCursor)
            if phase in [ "PENDING", "QUEUED", "EXECUTING" ]:
            if phase in [ "PENDING", "QUEUED", "EXECUTING", "HELD", "SUSPENDED" ]:
                cursor.execute("""
                    SELECT job_id,
                           job_type,
+2 −2
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ class JobRPCServer(RedisRPCServer):
                         "errorMsg": errorMsg }
        elif requestBody["requestType"] == "JOB_LIST":
            try:
                result = self.dbConn.listActiveJobs()
                result = self.dbConn.getActiveJobs()
            except Exception:
                errorMsg = "Database error."
                self.logger.exception(errorMsg)
@@ -62,7 +62,7 @@ class JobRPCServer(RedisRPCServer):
        elif requestBody["requestType"] == "JOB_BY_PHASE":
            jobPhase = requestBody["jobPhase"]
            try:
                result = self.dbConn.listJobsByPhase(jobPhase)
                result = self.dbConn.getJobsByPhase(jobPhase)
            except Exception:
                errorMsg = "Database error."
                self.logger.exception(errorMsg)