Skip to content

Commit e8658a2

Browse files
authored
Merge pull request #324 from tilezen/submit-job-overrides
Add optional batch memory override
2 parents 89647c9 + 7628944 commit e8658a2

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

config.yaml.sample

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,3 +388,7 @@ batch:
388388
retry-attempts: 5
389389
# check store if metatile already exists, and if so skip processing
390390
check-metatile-exists: true
391+
# optional override memory reserved for container when submiting job
392+
# NOTE: in megabytes
393+
# https://docs.aws.amazon.com/batch/latest/APIReference/API_ContainerOverrides.html
394+
memory:

tilequeue/command.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,6 +1895,7 @@ def tilequeue_batch_enqueue(cfg, peripherals):
18951895
assert job_queue, 'Missing batch job-queue config'
18961896

18971897
retry_attempts = batch_yaml.get('retry-attempts')
1898+
memory = batch_yaml.get('memory')
18981899

18991900
dim = 2 ** queue_zoom
19001901
z = queue_zoom
@@ -1911,22 +1912,23 @@ def tilequeue_batch_enqueue(cfg, peripherals):
19111912
'--config', '/etc/tilequeue/config.yaml',
19121913
'--tile', coord_str,
19131914
]
1915+
container_overrides = dict(command=job_cmd)
19141916
job_opts = dict(
19151917
jobDefinition=job_def,
19161918
jobQueue=job_queue,
19171919
jobName=job_name,
1918-
containerOverrides={
1919-
'command': job_cmd,
1920-
},
1920+
containerOverrides=container_overrides,
19211921
)
19221922
if retry_attempts is not None:
19231923
job_opts['retryStrategy'] = dict(attempts=retry_attempts)
1924+
if memory:
1925+
container_overrides['memory'] = memory
19241926
resp = client.submit_job(**job_opts)
19251927
assert resp['ResponseMetadata']['HTTPStatusCode'] == 200, \
19261928
'Failed to submit job: %s' % 'JobName'
19271929
i += 1
1928-
if i % 10000 == 0:
1929-
print i
1930+
if i % 1000 == 0:
1931+
print '%d jobs submitted' % i
19301932

19311933
logger.info('Batch enqueue ... done')
19321934

0 commit comments

Comments
 (0)