From 9b595f2edcdbf6285c71148423d37b83e45865d9 Mon Sep 17 00:00:00 2001 From: Zsolt Ero Date: Thu, 7 Dec 2023 23:37:45 +0100 Subject: [PATCH] rename --- init-server.py | 44 +++++++++---------- .../{tile_creator => tile_gen}/gen_monaco.sh | 4 +- .../planetiler_monaco.sh} | 2 +- .../planetiler_planet.sh} | 2 +- .../prepare-virtualenv.sh | 0 ssh_lib/planetiler.py | 2 +- 6 files changed, 26 insertions(+), 28 deletions(-) rename scripts/{tile_creator => tile_gen}/gen_monaco.sh (50%) rename scripts/{tile_creator/run_monaco.sh => tile_gen/planetiler_monaco.sh} (93%) rename scripts/{tile_creator/run_planet.sh => tile_gen/planetiler_planet.sh} (93%) rename scripts/{tile_creator => tile_gen}/prepare-virtualenv.sh (100%) diff --git a/init-server.py b/init-server.py index 33ab18e..ab2c832 100755 --- a/init-server.py +++ b/init-server.py @@ -24,24 +24,22 @@ def prepare_shared(c): set_cpu_governor(c) -def prepare_tile_creator(c): +def prepare_tile_gen(c): install_planetiler(c) - put( - c, - scripts / 'tile_creator' / 'prepare-virtualenv.sh', - TILE_GEN_BIN, - permissions='755', - owner='ofm', - ) - - put( - c, - scripts / 'tile_creator' / 'run_planet.sh', - TILE_GEN_BIN, - permissions='755', - owner='ofm', - ) + for file in [ + 'prepare-virtualenv.sh', + 'run_planet.sh', + 'run_monaco.sh', + 'gen_monaco.sh', + ]: + put( + c, + scripts / 'tile_gen' / file, + TILE_GEN_BIN, + permissions='755', + owner='ofm', + ) sudo_cmd(c, f'cd {TILE_GEN_BIN} && source prepare-virtualenv.sh', user='ofm') @@ -55,16 +53,16 @@ def prepare_http_host(c): @click.argument('hostname') @click.option('--port', type=int, help='SSH port (if not in .ssh/config)') @click.option('--user', help='SSH user (if not in .ssh/config)') -@click.option('--tile-creator', is_flag=True, help='Install tile-creator task') +@click.option('--tile-gen', is_flag=True, help='Install tile-gen task') @click.option('--http-host', is_flag=True, help='Install http-host task') -def main(hostname, user, port, tile_creator, http_host): +def main(hostname, user, port, tile_gen, http_host): if not click.confirm(f'Run script on {hostname}?'): return - if not tile_creator and not http_host: - tile_creator = click.confirm('Would you like to install tile-creator task?') + if not tile_gen and not http_host: + tile_gen = click.confirm('Would you like to install tile-gen task?') http_host = click.confirm('Would you like to install http-host task?') - if not tile_creator and not http_host: + if not tile_gen and not http_host: return ssh_passwd = dotenv_values('.env').get('SSH_PASSWD') @@ -86,8 +84,8 @@ def main(hostname, user, port, tile_creator, http_host): # prepare_shared(c) - if tile_creator: - prepare_tile_creator(c) + if tile_gen: + prepare_tile_gen(c) if http_host: prepare_http_host(c) diff --git a/scripts/tile_creator/gen_monaco.sh b/scripts/tile_gen/gen_monaco.sh similarity index 50% rename from scripts/tile_creator/gen_monaco.sh rename to scripts/tile_gen/gen_monaco.sh index bb5f0f7..abdac0d 100644 --- a/scripts/tile_creator/gen_monaco.sh +++ b/scripts/tile_gen/gen_monaco.sh @@ -2,10 +2,10 @@ DATE=$(date +"%Y%m%d_%H%M%S") -RUN_FOLDER="/data/tile_creator/runs/monaco_$DATE" +RUN_FOLDER="/data/ofm/runs/monaco_$DATE" mkdir -p "$RUN_FOLDER" cd "$RUN_FOLDER" || exit -bash /data/tile_creator/bin/run_monaco.sh "$DATE" +bash /data/tile_gen/run_monaco.sh "$DATE" diff --git a/scripts/tile_creator/run_monaco.sh b/scripts/tile_gen/planetiler_monaco.sh similarity index 93% rename from scripts/tile_creator/run_monaco.sh rename to scripts/tile_gen/planetiler_monaco.sh index d4be924..4899e41 100644 --- a/scripts/tile_creator/run_monaco.sh +++ b/scripts/tile_gen/planetiler_monaco.sh @@ -5,7 +5,7 @@ # setting it to too much means there is too much memory used java -Xmx1g \ - -jar /data/ofm/tile_creator/bin/planetiler.jar \ + -jar /data/ofm/tile_gen/planetiler.jar \ `# Download the latest planet.osm.pbf from s3://osm-pds bucket` \ --area=monaco --download \ `# Accelerate the download by fetching the 10 1GB chunks at a time in parallel` \ diff --git a/scripts/tile_creator/run_planet.sh b/scripts/tile_gen/planetiler_planet.sh similarity index 93% rename from scripts/tile_creator/run_planet.sh rename to scripts/tile_gen/planetiler_planet.sh index 188d9c8..072d634 100644 --- a/scripts/tile_creator/run_planet.sh +++ b/scripts/tile_gen/planetiler_planet.sh @@ -5,7 +5,7 @@ # setting it to too much means there is too much memory used java -Xmx30g \ - -jar /data/ofm/tile_creator/bin/planetiler.jar \ + -jar /data/ofm/tile_gen/planetiler.jar \ `# Download the latest planet.osm.pbf from s3://osm-pds bucket` \ --area=planet --bounds=planet --download \ `# Accelerate the download by fetching the 10 1GB chunks at a time in parallel` \ diff --git a/scripts/tile_creator/prepare-virtualenv.sh b/scripts/tile_gen/prepare-virtualenv.sh similarity index 100% rename from scripts/tile_creator/prepare-virtualenv.sh rename to scripts/tile_gen/prepare-virtualenv.sh diff --git a/ssh_lib/planetiler.py b/ssh_lib/planetiler.py index c620723..bfcd525 100644 --- a/ssh_lib/planetiler.py +++ b/ssh_lib/planetiler.py @@ -3,7 +3,7 @@ from ssh_lib.utils import apt_get_install, apt_get_update PLANETILER_VERSION = '0.7.0' -TILE_GEN_BIN = '/data/ofm/tile_gen/bin' +TILE_GEN_BIN = '/data/ofm/tile_gen' PLANETILER_PATH = f'{TILE_GEN_BIN}/planetiler.jar'