diff --git a/flamenco_worker/upstream_update_queue.py b/flamenco_worker/upstream_update_queue.py index 4db476b88ba6c19488c0ca7dea45ca13725bfc97..eed8b3d546e2c66f0c8396203569aef9fd771096 100644 --- a/flamenco_worker/upstream_update_queue.py +++ b/flamenco_worker/upstream_update_queue.py @@ -149,23 +149,23 @@ class TaskUpdateQueue: return queue_is_empty - async def flush_for_shutdown(self, *, loop: asyncio.AbstractEventLoop): + async def flush_and_report(self, *, loop: asyncio.AbstractEventLoop): """Flushes the queue, and just reports errors, doesn't wait nor retry.""" import requests - self._log.info('flush_for_shutdown: trying one last push to get updates to Manager') + self._log.info('flush_and_report: trying one last push to get updates to Manager') try: await self.flush(loop=loop) except requests.ConnectionError: - self._log.warning('flush_for_shutdown: Unable to connect to Manager, ' + self._log.warning('flush_and_report: Unable to connect to Manager, ' 'some items are still queued.') except requests.HTTPError as ex: - self._log.warning('flush_for_shutdown: Manager did not accept our updates (%s),' + self._log.warning('flush_and_report: Manager did not accept our updates (%s),' ' some items are still queued.', ex) except Exception: - self._log.exception('flush_for_shutdown: Unexpected exception, ' + self._log.exception('flush_and_report: Unexpected exception, ' 'Some items are still queued.') async def flush_and_catch(self, *, loop: asyncio.AbstractEventLoop): diff --git a/flamenco_worker/worker.py b/flamenco_worker/worker.py index f8c46ac12742767defddc031f13da1fd622c7c57..9fac48b019b6ecf5ef3dba06fb3770d4b63fd2c9 100644 --- a/flamenco_worker/worker.py +++ b/flamenco_worker/worker.py @@ -279,7 +279,7 @@ class FlamencoWorker: self.loop.run_until_complete(self.push_to_manager()) # Try to do a final push of queued updates to the Manager. - self.loop.run_until_complete(self.tuqueue.flush_for_shutdown(loop=self.loop)) + self.loop.run_until_complete(self.tuqueue.flush_and_report(loop=self.loop)) # Let the Manager know we're shutting down self._log.info('shutdown(): signing off at Manager') diff --git a/tests/test_worker.py b/tests/test_worker.py index e620ccee0f4e68d62f2d77fae6dc10dd153b011d..1542696cde391cef853b82fa3f5ed7620caa1d6b 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -26,7 +26,7 @@ class AbstractFWorkerTest(AbstractWorkerTest): self.trunner = Mock(spec=TaskRunner) self.tuqueue = Mock(spec=TaskUpdateQueue) - self.tuqueue.flush_for_shutdown = CoroMock() + self.tuqueue.flush_and_report = CoroMock() self.trunner.execute = self.mock_task_execute self.trunner.abort_current_task = CoroMock() @@ -407,7 +407,7 @@ class WorkerShutdownTest(AbstractWorkerTest): self.trunner = Mock(spec=TaskRunner) self.tuqueue = Mock(spec=TaskUpdateQueue) - self.tuqueue.flush_for_shutdown = CoroMock() + self.tuqueue.flush_and_report = CoroMock() self.trunner.abort_current_task = CoroMock() self.worker = FlamencoWorker(