Added ability to adjust heap size -- most useful when using --use-ram argument

This commit is contained in:
Mike C 2017-01-20 14:24:41 -05:00
parent bc03a2e078
commit 508f868c1c

View file

@ -32,6 +32,8 @@ if __name__ == '__main__':
help='don\'t sleep between downloads -- WARNING you can easily run into throttling on mirrors if you use this option')
parser.add_argument('--use-ram', action='store_true',
help='use RAM for mapsforge processing -- WARNING mapsforge uses 10x the map size in RAM for processing (ie. 100Mb map = 1Gb RAM usage), you want a LOT of RAM for this option')
parser.add_argument('--max-heap-space', action='store', default='4g',
help='set the max heap space for the JVM, use standard -Xmx values, default (4g) should be fine if not using --use-ram argument')
#TODO: Add argument to pass path to osmosis
#TODO: Add argument to pass path to output dir
args = parser.parse_args()
@ -72,7 +74,7 @@ if __name__ == '__main__':
subprocess.run([bunzip2_cmd, os.path.join(dirpath, file)])
# Setup various runtime aspects (going to do multiple osmosis runs (maps AND POIs)
env['JAVACMD_OPTIONS'] = '-server -Djava.io.tmpdir=' + os.path.join(base_path, 'tmp') # Setup java temp dir to something a bit more sane (tmpfs /tmp for the loss)
env['JAVACMD_OPTIONS'] = '-Xmx' + args.max_heap_space + ' -server -Djava.io.tmpdir=' + os.path.join(base_path, 'tmp') # Setup java temp dir to something a bit more sane (tmpfs /tmp for the loss)
files_to_process = []
for dirpath, dirnames, filenames in os.walk('dl'):
for file in filenames: