diff --git a/src/changed-tiles/Dockerfile b/src/changed-tiles/Dockerfile index 1246bfd..a0bbb30 100644 --- a/src/changed-tiles/Dockerfile +++ b/src/changed-tiles/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.5.3 +FROM golang:1.4 RUN go get github.com/lukasmartinelli/pgclimb \ && go install github.com/lukasmartinelli/pgclimb diff --git a/src/generate-jobs/generate_jobs.py b/src/generate-jobs/generate_jobs.py index 28c0dea..0825e10 100755 --- a/src/generate-jobs/generate_jobs.py +++ b/src/generate-jobs/generate_jobs.py @@ -2,7 +2,7 @@ """Generate jobs for rendering tiles in pyramid and list format in JSON format Usage: - generate_jobs.py pyramid --job-zoom= + generate_jobs.py pyramid --job-zoom= [--max-zoom=] generate_jobs.py list --batch-size= generate_jobs.py (-h | --help) generate_jobs.py --version @@ -10,7 +10,8 @@ Usage: Options: -h --help Show this screen. --version Show version. - --job-zoom= Max zoom level for pyramid jobs. + --job-zoom= Job zoom level for pyramid jobs. + --max-zoom= Max zoom level for pyramid jobs. [default: 14] --batch-size= Amount of tiles for list jobs. """ @@ -87,7 +88,7 @@ def split_tiles_into_batch_jobs(tiles, batch_size): yield create_list_batch_job(tiles_batch) -def pyramid_jobs(x, y, z, job_zoom): +def pyramid_jobs(x, y, z, job_zoom, max_zoom): """ Generate pyramid jobs for a given job_zoom level starting at with the parent tile defined by x, y, z. @@ -96,7 +97,7 @@ def pyramid_jobs(x, y, z, job_zoom): bounds = mercantile.bounds(x, y, z) yield create_pyramid_job( x=x, y=y, - min_zoom=z, max_zoom=14, + min_zoom=z, max_zoom=max_zoom, bounds=bounds ) return @@ -107,7 +108,7 @@ def pyramid_jobs(x, y, z, job_zoom): for tile in pyramid_zoom_level_tiles: bounds = mercantile.bounds(tile.x, tile.y, tile.z) yield create_pyramid_job(tile.x, tile.y, min_zoom=tile.z, - max_zoom=14, bounds=bounds) + max_zoom=max_zoom, bounds=bounds) bounds = mercantile.bounds(0 , 0 , 0) yield create_pyramid_job(0, 0, min_zoom=0, max_zoom=job_zoom-1, bounds=bounds) @@ -117,12 +118,13 @@ if __name__ == '__main__': if args['pyramid']: job_zoom = int(args['--job-zoom']) + max_zoom = int(args['--max-zoom']) x = int(args['']) y = int(args['']) z = int(args['']) - for job in pyramid_jobs(x, y, z, job_zoom): + for job in pyramid_jobs(x, y, z, job_zoom=job_zoom, max_zoom=max_zoom): print(json.dumps(job), flush=True) if args['list']: diff --git a/src/generate-jobs/generate_world_jobs.sh b/src/generate-jobs/generate_world_jobs.sh index 19ad826..90e6f5d 100755 --- a/src/generate-jobs/generate_world_jobs.sh +++ b/src/generate-jobs/generate_world_jobs.sh @@ -9,12 +9,18 @@ readonly TILE_X=${TILE_X:-"0"} readonly TILE_Y=${TILE_Y:-"0"} readonly TILE_Z=${TILE_Z:-"0"} readonly JOB_ZOOM=${JOB_ZOOM:-"8"} +readonly WORLD_JOB=${WORLD_JOB:-"true"} function generate_world_jobs() { local jobs_file="$EXPORT_DATA_DIR/world_jobs.txt" local jobs_queue="jobs" python generate_jobs.py pyramid "$TILE_X" "$TILE_Y" "$TILE_Z" --job-zoom="$JOB_ZOOM" > $jobs_file + + if [ "$WORLD_JOB" = true ] ; then + python generate_jobs.py pyramid "0" "0" "0" --job-zoom="0" --max-zoom="$((JOB_ZOOM-1))" >> $jobs_file + fi + pipecat publish --amqpuri="$AMQP_URI" "$jobs_queue" < $jobs_file } diff --git a/tools/integration-test/integration_test.py b/tools/integration-test/integration_test.py index 81fc29f..ed1093b 100644 --- a/tools/integration-test/integration_test.py +++ b/tools/integration-test/integration_test.py @@ -114,6 +114,7 @@ def test_distributed_worker(): '-e', 'TILE_Y={}'.format(y), '-e', 'TILE_Z={}'.format(z), '-e', 'JOB_ZOOM={}'.format(job_zoom), + '-e', 'WORLD_JOB=false', 'generate-jobs' ])