Commit 17ced41c authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Revert to the last commit.

parent edb8c6b6
Loading
Loading
Loading
Loading
Loading
+3 −21
Original line number Diff line number Diff line
@@ -52,8 +52,8 @@ class StartJobRPCServer(RedisRPCServer):

    def callback(self, requestBody):
        # debug block...
        #out = open("start_job_rpc_server_log.txt", "a")
        #out.write(json.dumps(requestBody))
        out = open("start_job_rpc_server_log.txt", "a")
        out.write(json.dumps(requestBody))

        job = Job()
        job.setId(requestBody["job"]["jobId"])
@@ -71,28 +71,10 @@ class StartJobRPCServer(RedisRPCServer):
                         "errorCode": 3,
                         "errorMsg": errorMsg }
            return response

        # Check if 'read_pending_queue' is full
        if pendingQueueLen >= self.maxPendingJobs:
            job.setPhase("ERROR")
            job.setErrorType("transient")
            errorMsg = "Pending queue is full, please, retry later."
            job.setErrorMessage(errorMsg)
            self.logger.warning(errorMsg)
            errorFlag = True
        # Check if the user is already present in the VOSpace database. If not, change the job phase to 'ERROR'.
        # The user must be created in the database using the 'vos_user' admin command.
        elif not self.dbConn.getUserName(requestBody["job"]["ownerId"]):
            job.setPhase("ERROR")
            job.setErrorType("transient")
            errorMsg = "The user is registered in the authentication system (RAP), but is not present into the 'users' table of the VOSpace database."
            job.setErrorMessage(errorMsg)
            self.logger.warning(errorMsg)
            errorFlag = True
        else:
            errorFlag = False

        if errorFlag:
            job.setErrorMessage("Pending queue is full, please, retry later.")
            try:
                self.dbConn.insertJob(job)
            except Exception: