Ejemplo n.º 1
0
def runningUpdateJobs(dbsession, logger, testing=False):
    logger.info('Fetch overwrite id for unprocessed georeference jobs ...')
    overwrites = Georeferenzierungsprozess.by_getOverwriteIdsOfUnprocessedGeorefProcessesTypeOfUpdate(
        dbsession)

    counter = 0
    # clear all unnecessary overwrites and run update process for the actual process
    for overwrite in overwrites:
        # check if there is an old race conflict
        if not clearRaceConflicts(overwrite, dbsession):
            counter += 1
            jobs = Georeferenzierungsprozess.getJobsWithSameOverwrites(
                overwrite, dbsession)
            pendingJob = None
            for job in jobs:
                if pendingJob is None:
                    pendingJob = job
                else:
                    dbsession.delete(job)

            logger.debug('Process a update georeference process with id - %s' %
                         job.id)
            runUpdateGeoreferenceProcess(pendingJob, dbsession, logger,
                                         testing)

    logger.debug('Processed %s update georeference process.' % counter)
Ejemplo n.º 2
0
def clearRaceConflicts(overwrite, dbsession):
    # double check if there are jobs which should be deleted
    # this clears the case that while there was on job activated in the past
    # there was still because of concurrency another jobs registered with the same
    # overwrites id
    possibleConflictJobs = Georeferenzierungsprozess.getJobsWithSameOverwrites(overwrite, dbsession)

    alreadyActiveJob = None
    for conflictJob in possibleConflictJobs:
        if conflictJob.isactive == True:
            alreadyActiveJob = conflictJob
            
    if alreadyActiveJob is not None:
        for conflictJob in possibleConflictJobs:
            if conflictJob.id != alreadyActiveJob.id:
                dbsession.delete(conflictJob)  
        return True
    return False
Ejemplo n.º 3
0
def clearRaceConflicts(overwrite, dbsession):
    # double check if there are jobs which should be deleted
    # this clears the case that while there was on job activated in the past
    # there was still because of concurrency another jobs registered with the same
    # overwrites id
    possibleConflictJobs = Georeferenzierungsprozess.getJobsWithSameOverwrites(
        overwrite, dbsession)

    alreadyActiveJob = None
    for conflictJob in possibleConflictJobs:
        if conflictJob.isactive == True:
            alreadyActiveJob = conflictJob

    if alreadyActiveJob is not None:
        for conflictJob in possibleConflictJobs:
            if conflictJob.id != alreadyActiveJob.id:
                dbsession.delete(conflictJob)
        return True
    return False
Ejemplo n.º 4
0
def runningUpdateJobs(dbsession, logger, testing = False):
    logger.info('Fetch overwrite id for unprocessed georeference jobs ...')
    overwrites = Georeferenzierungsprozess.by_getOverwriteIdsOfUnprocessedGeorefProcessesTypeOfUpdate(dbsession)
                 
    counter = 0
    # clear all unnecessary overwrites and run update process for the actual process
    for overwrite in overwrites:
        # check if there is an old race conflict
        if not clearRaceConflicts(overwrite, dbsession):
            counter += 1
            jobs = Georeferenzierungsprozess.getJobsWithSameOverwrites(overwrite, dbsession)
            pendingJob = None
            for job in jobs:
                if pendingJob is None:
                    pendingJob = job
                else:
                    dbsession.delete(job)
                    
            logger.debug('Process a update georeference process with id - %s'%job.id)
            runUpdateGeoreferenceProcess(pendingJob, dbsession, logger, testing)
    
    logger.debug('Processed %s update georeference process.'%counter)