예제 #1
0
def seed(tasks, concurrency=2, dry_run=False, skip_geoms_for_last_levels=0,
    progress_logger=None, cache_locker=None):
    if cache_locker is None:
        cache_locker = DummyCacheLocker()

    active_tasks = tasks[::-1]
    while active_tasks:
        task = active_tasks[-1]
        print format_seed_task(task)

        wait = len(active_tasks) == 1
        try:
            with cache_locker.lock(task.md['cache_name'], no_block=not wait):
                if progress_logger and progress_logger.progress_store:
                    progress_logger.current_task_id = task.id
                    start_progress = progress_logger.progress_store.get(task.id)
                else:
                    start_progress = None
                seed_progress = SeedProgress(old_progress_identifier=start_progress)
                seed_task(task, concurrency, dry_run, skip_geoms_for_last_levels, progress_logger,
                    seed_progress=seed_progress)
        except CacheLockedError:
            print '    ...cache is locked, skipping'
            active_tasks = [task] + active_tasks[:-1]
        else:
            active_tasks.pop()
예제 #2
0
def seed(tasks, concurrency=2, dry_run=False, skip_geoms_for_last_levels=0,
    progress_logger=None, cache_locker=None):
    if cache_locker is None:
        cache_locker = DummyCacheLocker()

    active_tasks = tasks[::-1]
    while active_tasks:
        task = active_tasks[-1]
        print(format_seed_task(task))

        wait = len(active_tasks) == 1
        try:
            with cache_locker.lock(task.md['cache_name'], no_block=not wait):
                if progress_logger and progress_logger.progress_store:
                    progress_logger.current_task_id = task.id
                    start_progress = progress_logger.progress_store.get(task.id)
                else:
                    start_progress = None
                seed_progress = SeedProgress(old_progress_identifier=start_progress)
                seed_task(task, concurrency, dry_run, skip_geoms_for_last_levels, progress_logger,
                    seed_progress=seed_progress)
        except CacheLockedError:
            print('    ...cache is locked, skipping')
            active_tasks = [task] + active_tasks[:-1]
        else:
            active_tasks.pop()
예제 #3
0
파일: seeder.py 프로젝트: atrawog/mapproxy
def seed(tasks, concurrency=2, dry_run=False, skip_geoms_for_last_levels=0,
    progress_logger=None, cache_locker=None):
    if cache_locker is None:
        cache_locker = DummyCacheLocker()
    
    active_tasks = tasks[::-1]
    while active_tasks:
        task = active_tasks[-1]
        print format_seed_task(task)
        
        wait = len(active_tasks) == 1
        try:
            with cache_locker.lock(task.md['cache_name'], no_block=not wait):
                _seed_task(task, concurrency, dry_run, skip_geoms_for_last_levels, progress_logger)
        except CacheLockedError:
            print '    ...cache is locked, skipping'
            active_tasks = [task] + active_tasks[:-1]
        else:
            active_tasks.pop()
예제 #4
0
def seed(tasks,
         concurrency=2,
         dry_run=False,
         skip_geoms_for_last_levels=0,
         progress_logger=None,
         cache_locker=None):
    if cache_locker is None:
        cache_locker = DummyCacheLocker()

    active_tasks = tasks[::-1]
    while active_tasks:
        task = active_tasks[-1]
        print format_seed_task(task)

        wait = len(active_tasks) == 1
        try:
            with cache_locker.lock(task.md['cache_name'], no_block=not wait):
                _seed_task(task, concurrency, dry_run,
                           skip_geoms_for_last_levels, progress_logger)
        except CacheLockedError:
            print '    ...cache is locked, skipping'
            active_tasks = [task] + active_tasks[:-1]
        else:
            active_tasks.pop()