8000 fix calling method on wrong object by honnix · Pull Request #2709 · spotify/luigi · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix calling method on wrong object #2709

New issue
8000

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions luigi/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,10 @@ def initialize(self, scheduler):
self._scheduler = scheduler

def get(self):
metrics = self._scheduler._state._metrics_collector.generate_latest()
metrics_collector = self._scheduler._state._metrics_collector
metrics = metrics_collector.generate_latest()
if metrics:
metrics.configure_http_handler(self)
metrics_collector.configure_http_handler(self)
self.write(metrics)


Expand Down
3 changes: 2 additions & 1 deletion test/server_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,8 @@ def test_get(self):
with mock.patch.object(self.handler, 'write') as patched_write:
self.handler.get()
patched_write.assert_called_once_with(mock_metrics)
mock_metrics.configure_http_handler.assert_called_once_with(self.handler)
self.mock_scheduler._state._metrics_collector.configure_http_handler.assert_called_once_with(
self.handler)

def test_get_no_metrics(self):
self.mock_scheduler._state._metrics_collector.generate_latest.return_value = None
Expand Down
0