Skip to content

Commit

Permalink
reduce start_execution_manager batch size to 500 jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
asjohnston-asf committed May 2, 2024
1 parent c3546ad commit 7497244
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [7.1.1]
### Changed
- Reduced `start_execution_manager` batch size from 600 jobs to 500 jobs. Fixes [#2241](https://github.com/ASFHyP3/hyp3/issues/2241).

## [7.1.0]
### Added
- A `hyp3-its-live-test` deployment to [`deploy-enterprise-test.yml`](.github/workflows/deploy-enterprise-test.yml) for ITS_LIVE testing in preparation for some significant ITS_LIVE project development
Expand Down
4 changes: 2 additions & 2 deletions apps/start-execution-manager/src/start_execution_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ def lambda_handler(event, context) -> None:
worker_function_arn = os.environ['START_EXECUTION_WORKER_ARN']
logger.info(f'Worker function ARN: {worker_function_arn}')

pending_jobs = dynamo.jobs.get_jobs_waiting_for_execution(limit=600)
pending_jobs = dynamo.jobs.get_jobs_waiting_for_execution(limit=500)
logger.info(f'Got {len(pending_jobs)} pending jobs')

batch_size = 300
batch_size = 250
for i in range(0, len(pending_jobs), batch_size):
jobs = pending_jobs[i:i + batch_size]
logger.info(f'Invoking worker for {len(jobs)} jobs')
Expand Down
24 changes: 12 additions & 12 deletions tests/test_start_execution_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,41 +53,41 @@ def test_invoke_worker():
)


def test_lambda_handler_600_jobs():
def test_lambda_handler_500_jobs():
with patch('dynamo.jobs.get_jobs_waiting_for_execution') as mock_get_jobs_waiting_for_execution, \
patch('start_execution_manager.invoke_worker') as mock_invoke_worker, \
patch.dict(os.environ, {'START_EXECUTION_WORKER_ARN': 'test-worker-function-arn'}, clear=True):
mock_jobs = list(range(600))
mock_jobs = list(range(500))
mock_get_jobs_waiting_for_execution.return_value = mock_jobs

mock_invoke_worker.return_value = {'StatusCode': None}

start_execution_manager.lambda_handler(None, None)

mock_get_jobs_waiting_for_execution.assert_called_once_with(limit=600)
mock_get_jobs_waiting_for_execution.assert_called_once_with(limit=500)

assert mock_invoke_worker.mock_calls == [
call('test-worker-function-arn', mock_jobs[0:300]),
call('test-worker-function-arn', mock_jobs[300:600]),
call('test-worker-function-arn', mock_jobs[0:250]),
call('test-worker-function-arn', mock_jobs[250:500]),
]


def test_lambda_handler_500_jobs():
def test_lambda_handler_400_jobs():
with patch('dynamo.jobs.get_jobs_waiting_for_execution') as mock_get_jobs_waiting_for_execution, \
patch('start_execution_manager.invoke_worker') as mock_invoke_worker, \
patch.dict(os.environ, {'START_EXECUTION_WORKER_ARN': 'test-worker-function-arn'}, clear=True):
mock_jobs = list(range(500))
mock_jobs = list(range(400))
mock_get_jobs_waiting_for_execution.return_value = mock_jobs

mock_invoke_worker.return_value = {'StatusCode': None}

start_execution_manager.lambda_handler(None, None)

mock_get_jobs_waiting_for_execution.assert_called_once_with(limit=600)
mock_get_jobs_waiting_for_execution.assert_called_once_with(limit=500)

assert mock_invoke_worker.mock_calls == [
call('test-worker-function-arn', mock_jobs[0:300]),
call('test-worker-function-arn', mock_jobs[300:500]),
call('test-worker-function-arn', mock_jobs[0:250]),
call('test-worker-function-arn', mock_jobs[250:400]),
]


Expand All @@ -102,7 +102,7 @@ def test_lambda_handler_50_jobs():

start_execution_manager.lambda_handler(None, None)

mock_get_jobs_waiting_for_execution.assert_called_once_with(limit=600)
mock_get_jobs_waiting_for_execution.assert_called_once_with(limit=500)

assert mock_invoke_worker.mock_calls == [
call('test-worker-function-arn', mock_jobs),
Expand All @@ -117,6 +117,6 @@ def test_lambda_handler_no_jobs():

start_execution_manager.lambda_handler(None, None)

mock_get_jobs_waiting_for_execution.assert_called_once_with(limit=600)
mock_get_jobs_waiting_for_execution.assert_called_once_with(limit=500)

mock_invoke_worker.assert_not_called()

0 comments on commit 7497244

Please sign in to comment.