Return-Path: X-Original-To: apmail-aurora-commits-archive@minotaur.apache.org Delivered-To: apmail-aurora-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 790DCC064 for ; Thu, 20 Mar 2014 00:03:02 +0000 (UTC) Received: (qmail 21019 invoked by uid 500); 20 Mar 2014 00:03:00 -0000 Delivered-To: apmail-aurora-commits-archive@aurora.apache.org Received: (qmail 20984 invoked by uid 500); 20 Mar 2014 00:03:00 -0000 Mailing-List: contact commits-help@aurora.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@aurora.incubator.apache.org Delivered-To: mailing list commits@aurora.incubator.apache.org Received: (qmail 20957 invoked by uid 99); 20 Mar 2014 00:03:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2014 00:03:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 20 Mar 2014 00:02:59 +0000 Received: (qmail 20664 invoked by uid 99); 20 Mar 2014 00:02:38 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2014 00:02:38 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 8B76598542B; Thu, 20 Mar 2014 00:02:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: wickman@apache.org To: commits@aurora.incubator.apache.org Message-Id: <3bb85b7cd1c54df3b8a7c521c106e1da@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: Don't forget to register status checker observables. Date: Thu, 20 Mar 2014 00:02:38 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org Repository: incubator-aurora Updated Branches: refs/heads/master d83729896 -> a73ee1394 Don't forget to register status checker observables. Reviewed at https://reviews.apache.org/r/19426/ Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/a73ee139 Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/a73ee139 Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/a73ee139 Branch: refs/heads/master Commit: a73ee1394f938da730be8c7c682f3555a1f116b4 Parents: d837298 Author: Brian Wickman Authored: Wed Mar 19 17:02:33 2014 -0700 Committer: Brian Wickman Committed: Wed Mar 19 17:02:33 2014 -0700 ---------------------------------------------------------------------- src/main/python/apache/aurora/executor/aurora_executor.py | 6 ++++-- src/main/python/apache/aurora/executor/common/kill_manager.py | 3 +++ .../python/apache/aurora/executor/common/status_checker.py | 4 ++++ .../python/apache/aurora/executor/test_thermos_executor.py | 6 +++++- 4 files changed, 16 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/a73ee139/src/main/python/apache/aurora/executor/aurora_executor.py ---------------------------------------------------------------------- diff --git a/src/main/python/apache/aurora/executor/aurora_executor.py b/src/main/python/apache/aurora/executor/aurora_executor.py index 28e5054..9dff12b 100644 --- a/src/main/python/apache/aurora/executor/aurora_executor.py +++ b/src/main/python/apache/aurora/executor/aurora_executor.py @@ -80,6 +80,7 @@ class AuroraExecutor(ExecutorBase, Observable): self.runner_started = threading.Event() self.sandbox_initialized = threading.Event() self.sandbox_created = threading.Event() + self.status_manager_started = threading.Event() self.terminated = threading.Event() self.launched = threading.Event() @@ -160,14 +161,14 @@ class AuroraExecutor(ExecutorBase, Observable): def _start_status_manager(self, driver, assigned_task): status_checkers = [self._kill_manager] - self.metrics.register_observable('kill_manager', self._kill_manager) + self.metrics.register_observable(self._kill_manager.name(), self._kill_manager) for status_provider in self._status_providers: status_checker = status_provider.from_assigned_task(assigned_task, self._sandbox) if status_checker is None: continue status_checkers.append(status_checker) - # self.metrics.register_observable() + self.metrics.register_observable(status_checker.name(), status_checker) self._chained_checker = ChainedStatusChecker(status_checkers) self._chained_checker.start() @@ -177,6 +178,7 @@ class AuroraExecutor(ExecutorBase, Observable): self._status_manager = self._status_manager_class( complete_checker, self._shutdown, clock=self._clock) self._status_manager.start() + self.status_manager_started.set() def _signal_kill_manager(self, driver, task_id, reason): if self._task_id is None: http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/a73ee139/src/main/python/apache/aurora/executor/common/kill_manager.py ---------------------------------------------------------------------- diff --git a/src/main/python/apache/aurora/executor/common/kill_manager.py b/src/main/python/apache/aurora/executor/common/kill_manager.py index 0d0d553..86ee4e6 100644 --- a/src/main/python/apache/aurora/executor/common/kill_manager.py +++ b/src/main/python/apache/aurora/executor/common/kill_manager.py @@ -30,6 +30,9 @@ class KillManager(StatusChecker): if self._killed: return StatusResult(self._reason, ExitState.KILLED) + def name(self): + return 'kill_manager' + def kill(self, reason): self._reason = reason self._killed = True http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/a73ee139/src/main/python/apache/aurora/executor/common/status_checker.py ---------------------------------------------------------------------- diff --git a/src/main/python/apache/aurora/executor/common/status_checker.py b/src/main/python/apache/aurora/executor/common/status_checker.py index f94042c..2d4fffc 100644 --- a/src/main/python/apache/aurora/executor/common/status_checker.py +++ b/src/main/python/apache/aurora/executor/common/status_checker.py @@ -74,6 +74,10 @@ class StatusChecker(Observable, Interface): def status(self): """Return None under normal operations. Return StatusResult to indicate status proposal.""" + def name(self): + """Return the name of the status checker. By default it is the class name. Subclassable.""" + return self.__class__.__name__ + def start(self): """Invoked once the task has been started.""" self.metrics.register(NamedGauge('enabled', 1)) http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/a73ee139/src/test/python/apache/aurora/executor/test_thermos_executor.py ---------------------------------------------------------------------- diff --git a/src/test/python/apache/aurora/executor/test_thermos_executor.py b/src/test/python/apache/aurora/executor/test_thermos_executor.py index b508eab..4cd34c6 100644 --- a/src/test/python/apache/aurora/executor/test_thermos_executor.py +++ b/src/test/python/apache/aurora/executor/test_thermos_executor.py @@ -205,7 +205,11 @@ def make_executor( task_description = make_task(task, assigned_ports=ports, instanceId=0) te.launchTask(proxy_driver, task_description) - te.runner_started.wait() + te.status_manager_started.wait() + sampled_metrics = te.metrics.sample() + assert 'kill_manager.enabled' in sampled_metrics + for checker in te._chained_checker._status_checkers: # hacky + assert ('%s.enabled' % checker.name()) in sampled_metrics while len(proxy_driver.method_calls['sendStatusUpdate']) < 2: time.sleep(0.1)