Ejemplo n.º 1
0
def clean(job):
    gridJobId = job.getCurrentGID()

    try:
        debug('CleanJob(%s)' % gridJobId)
        arclib.CleanJob(gridJobId)
        debug('RemoveJobID(%s)' % gridJobId)
        arclib.RemoveJobID(gridJobId)
        return True
    except:
        pass

    warn('Job %s could not be cleaned' % (job.id))
    return False
Ejemplo n.º 2
0
    def clean(self, jobId):
        """Removes a (finished?) job from a remote cluster.

        If this fails, just remove it from our list (forget it).
        @type  jobID: string
        @param jobID: jobId URL identifier."""

        logger.debug('Cleaning up job %s' % jobId )
        self.__lockArclib()
        try:
            arclib.CleanJob(jobId)
        except arclib.FTPControlError, err:
                logger.error('Failed to clean job %s: %s' % (jobId, err.what()))
                arclib.RemoveJobID(jobId)
Ejemplo n.º 3
0
def download(job):

    gridJobId = job.getCurrentGID()

    if os.path.isdir('results'):
        os.system('mv results results.%s' % time.time())
    os.system('mkdir results')
    try:
        jctrl = arclib.FTPControl()
        debug('DownloadDirectory(%s)' % gridJobId)
        jctrl.DownloadDirectory(gridJobId, 'results')
        debug('CleanJob(%s)' % gridJobId)
        arclib.CleanJob(gridJobId)
        debug('RemoveJobID(%s)' % gridJobId)
        arclib.RemoveJobID(gridJobId)
    except arclib.FTPControlError:
        err = sys.exc_info()[0]
        warn('Job %s downloading failed: %r ' % (job.id, err))
        return False

    return True
Ejemplo n.º 4
0
def cancel(job):
    gridJobId = job.getCurrentGID()

    try:
        debug('CancelJob(%s)' % gridJobId)
        arclib.CancelJob(gridJobId)
        debug('RemoveJobID(%s)' % gridJobId)
        arclib.RemoveJobID(gridJobId)
        return True
    except:
        debug('Job %s could not be cancelled, trying to clean' % (job.id))
        pass

    try:
        debug('CleanJob(%s)' % gridJobId)
        arclib.CleanJob(gridJobId)
        debug('RemoveJobID(%s)' % gridJobId)
        arclib.RemoveJobID(gridJobId)
        return True
    except:
        debug('Job %s could not be cleaned' % (job.id))

    warn('Job %s could not be cancelled or cleaned' % (job.id))
    return False