示例#1
0
    def __init__(self, cfg_params, jobs):
        self.cfg_params = cfg_params

        self.copy_data = int(cfg_params.get("USER.copy_data", 0))
        self.check_RemoteDir = int(cfg_params.get("USER.check_user_remote_dir", 0))

        nj_list = []

        # get updated status from server
        try:
            from StatusServer import StatusServer

            stat = StatusServer(self.cfg_params)
            warning_msg = stat.resynchClientSide()
            if warning_msg is not None:
                common.logger.info(warning_msg)
        except:
            pass

        if jobs == "bad":
            nj_list = self.checkBadJob(nj_list)
        else:
            nj_list = self.checkAllowedJob(jobs, nj_list)

        SubmitterServer.__init__(self, cfg_params, nj_list, "range")

        return
示例#2
0
    def run(self):
        # get updated status from server
        try:
            stat = StatusServer(self.cfg_params)
            warning_msg = stat.resynchClientSide()
            if warning_msg is not None:
                common.logger.info(warning_msg)
        except:
            pass

        # check whether the action is allowable
        self.check()

        # notify the server to clean the task
        csCommunicator = ServerCommunicator(self.server_name, self.server_port,
                                            self.cfg_params)
        taskuuid = str(common._db.queryTask('name'))

        try:
            csCommunicator.cleanTask(taskuuid)
        except Exception, e:
            msg = "Client Server comunication failed about cleanJobs: task \n" + taskuuid
            msg += "Only local working directory will be removed."
            common.logger.debug(msg)
            pass
示例#3
0
    def __init__(self, cfg_params, jobs):
        self.cfg_params = cfg_params

        self.copy_data = int(cfg_params.get('USER.copy_data', 0))
        self.check_RemoteDir = int(
            cfg_params.get('USER.check_user_remote_dir', 0))

        nj_list = []

        # get updated status from server
        try:
            from StatusServer import StatusServer
            stat = StatusServer(self.cfg_params)
            warning_msg = stat.resynchClientSide()
            if warning_msg is not None:
                common.logger.info(warning_msg)
        except:
            pass

        if (jobs == 'bad'):
            nj_list = self.checkBadJob(nj_list)
        else:
            nj_list = self.checkAllowedJob(jobs, nj_list)

        SubmitterServer.__init__(self, cfg_params, nj_list, 'range')

        return
示例#4
0
    def run(self):
        """
        The main method of the class: kill a complete task
        """
        common.logger.debug("Killer::run() called")

        # get updated status from server #inherited from StatusServer
        try:
            from StatusServer import StatusServer
            stat = StatusServer(self.cfg_params)
            warning_msg = stat.resynchClientSide()
            if warning_msg is not None:
                common.logger.info(warning_msg)
        except:
            pass

        task = common._db.getTask(self.range)
        toBeKilled = []
        for job in task.jobs:
            #if job.runningJob['status'] not in ['C','E','KK','K','SU','SA','NS']: # commented for fast-kill at registration ,'SSE']:
            if job.runningJob['state'] in ['SubSuccess', 'SubRequested']:
                toBeKilled.append(job['jobId'])
            else:
                common.logger.info("Not possible to kill Job #"+str(job['jobId'])+\
                        " : Last action was: "+str(job.runningJob['state'])+\
                        " Status is "+str(job.runningJob['statusScheduler']))
            pass

        if len(toBeKilled) > 0:
            ## register proxy ##
            csCommunicator = ServerCommunicator(self.server_name,
                                                self.server_port,
                                                self.cfg_params)

            taskuuid = str(common._db.queryTask('name'))
            ret = csCommunicator.killJobs(taskuuid, toBeKilled)
            del csCommunicator

            if ret != 0:
                msg = "ClientServer ERROR: %d raised during the communication.\n" % ret
                raise CrabException(msg)

            # printout the command result
            common._db.updateRunJob_(toBeKilled, [{
                'state': 'KillRequested'
            }] * len(toBeKilled))

            common.logger.info(
                "Kill request for %d jobs succesfully sent to the server\n" %
                len(toBeKilled))

        return
示例#5
0
    def run(self):
        """
        The main method of the class: kill a complete task
        """
        common.logger.debug( "Killer::run() called")

        # get updated status from server #inherited from StatusServer
        try:
            from StatusServer import StatusServer
            stat = StatusServer(self.cfg_params)
            warning_msg = stat.resynchClientSide()
            if warning_msg is not None:
                common.logger.info(warning_msg)
        except:
            pass    

        task = common._db.getTask(self.range)
        toBeKilled = []
        for job  in task.jobs:
           #if job.runningJob['status'] not in ['C','E','KK','K','SU','SA','NS']: # commented for fast-kill at registration ,'SSE']:
           if job.runningJob['state'] in ['SubSuccess','SubRequested']:
               toBeKilled.append(job['jobId'])
           else:
               common.logger.info("Not possible to kill Job #"+str(job['jobId'])+\
                       " : Last action was: "+str(job.runningJob['state'])+\
                       " Status is "+str(job.runningJob['statusScheduler']))
           pass

        if len(toBeKilled)>0:
            ## register proxy ##
            csCommunicator = ServerCommunicator(self.server_name, self.server_port, self.cfg_params)
 
            taskuuid = str(common._db.queryTask('name'))
            ret = csCommunicator.killJobs( taskuuid, toBeKilled)
            del csCommunicator
 
            if ret != 0:
                msg = "ClientServer ERROR: %d raised during the communication.\n"%ret
                raise CrabException(msg)
 
            # printout the command result
            common._db.updateRunJob_(toBeKilled, [{'state':'KillRequested'}]*len(toBeKilled))

            common.logger.info("Kill request for %d jobs succesfully sent to the server\n"%len(toBeKilled) ) 

        return
示例#6
0
    def __init__(self, cfg_params, jobs):
        self.cfg_params = cfg_params

        nj_list = []

        # get updated status from server
        try:
            from StatusServer import StatusServer
            stat = StatusServer(self.cfg_params)
            warning_msg = stat.resynchClientSide()
            if warning_msg is not None:
                common.logger.info(warning_msg)
        except:
            pass

        nj_list = self.checkAllowedJob(jobs, nj_list)

        SubmitterServer.__init__(self, cfg_params, nj_list, 'range')

        return
    def collectLogging(self):
        # get updated status from server
        try:
            from StatusServer import StatusServer
            stat = StatusServer(self.cfg_params)
            warning_msg = stat.resynchClientSide()
            if warning_msg is not None:
                common.logger.info(warning_msg)
        except:
            pass

        #create once storage interaction object
        seEl = None
        loc = None
        try:
            seEl = SElement(self.storage_name, self.storage_proto, self.storage_port)
        except Exception, ex:
            common.logger.debug( str(ex))
            msg = "ERROR: Unable to create SE source interface \n"
            raise CrabException(msg)
    def __init__(self, cfg_params, jobs):
        self.cfg_params = cfg_params

        nj_list = []

        # get updated status from server 
        try:
            from StatusServer import StatusServer
            stat = StatusServer(self.cfg_params)
            warning_msg = stat.resynchClientSide()
            if warning_msg is not None:
                common.logger.info(warning_msg)
        except:
            pass

        nj_list = self.checkAllowedJob(jobs,nj_list)
       
        SubmitterServer.__init__(self, cfg_params, nj_list, 'range')
 
        return
示例#9
0
    def collectLogging(self):
        # get updated status from server
        try:
            from StatusServer import StatusServer
            stat = StatusServer(self.cfg_params)
            warning_msg = stat.resynchClientSide()
            if warning_msg is not None:
                common.logger.info(warning_msg)
        except:
            pass

        #create once storage interaction object
        seEl = None
        loc = None
        try:
            seEl = SElement(self.storage_name, self.storage_proto,
                            self.storage_port)
        except Exception, ex:
            common.logger.debug(str(ex))
            msg = "ERROR: Unable to create SE source interface \n"
            raise CrabException(msg)
示例#10
0
    def run(self):
        # get updated status from server
        try:
            stat = StatusServer(self.cfg_params)
            warning_msg = stat.resynchClientSide()
            if warning_msg is not None:
                common.logger.info(warning_msg)
        except:
            pass
        
        # check whether the action is allowable
        self.check()

        # notify the server to clean the task 
        csCommunicator = ServerCommunicator(self.server_name, self.server_port, self.cfg_params)
        taskuuid = str(common._db.queryTask('name'))

        try:
            csCommunicator.cleanTask(taskuuid)
        except Exception, e:
            msg = "Client Server comunication failed about cleanJobs: task \n" + taskuuid
            msg += "Only local working directory will be removed."
            common.logger.debug( msg)
            pass