aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject git commit: Changing from STARTING to RUNNING in job uptime calculations.
Date Fri, 21 Mar 2014 21:31:30 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 8e54fd40b -> 15679b3db


Changing from STARTING to RUNNING in job uptime calculations.

Bugs closed: AURORA-272

Reviewed at https://reviews.apache.org/r/19362/


Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/15679b3d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/15679b3d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/15679b3d

Branch: refs/heads/master
Commit: 15679b3dbd45fa734c2624794f441237bc9c7d19
Parents: 8e54fd4
Author: Maxim Khutornenko <maxim@apache.org>
Authored: Fri Mar 21 14:30:39 2014 -0700
Committer: Maxim Khutornenko <maxim@apache.org>
Committed: Fri Mar 21 14:30:39 2014 -0700

----------------------------------------------------------------------
 src/main/python/apache/aurora/client/api/sla.py      |  7 ++-----
 src/test/python/apache/aurora/client/api/test_sla.py | 12 ++++++------
 2 files changed, 8 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/15679b3d/src/main/python/apache/aurora/client/api/sla.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/client/api/sla.py b/src/main/python/apache/aurora/client/api/sla.py
index 7b4d75c..a615092 100644
--- a/src/main/python/apache/aurora/client/api/sla.py
+++ b/src/main/python/apache/aurora/client/api/sla.py
@@ -33,9 +33,6 @@ from gen.apache.aurora.ttypes import (
 )
 
 
-SLA_LIVE_STATES = LIVE_STATES | set([ScheduleStatus.STARTING])
-
-
 def job_key_from_scheduled(task, cluster):
   """Creates AuroraJobKey from the ScheduledTask.
 
@@ -65,7 +62,7 @@ def task_query(job_key=None, hosts=None, job_keys=None):
       jobName=job_key.name if job_key else None,
       slaveHosts=set(hosts) if hosts else None,
       jobKeys=set(k.to_thrift() for k in job_keys) if job_keys else None,
-      statuses=SLA_LIVE_STATES)
+      statuses=LIVE_STATES)
 
 
 class JobUpTimeSlaVector(object):
@@ -141,7 +138,7 @@ class JobUpTimeSlaVector(object):
     instance_map = {}
     for task in self._tasks:
       for event in task.taskEvents:
-        if event.status == ScheduleStatus.STARTING:
+        if event.status == ScheduleStatus.RUNNING:
           instance_map[task.assignedTask.instanceId] = math.floor(self._now - event.timestamp
/ 1000)
           break
     return instance_map

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/15679b3d/src/test/python/apache/aurora/client/api/test_sla.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/client/api/test_sla.py b/src/test/python/apache/aurora/client/api/test_sla.py
index fba85c9..74c0ac3 100644
--- a/src/test/python/apache/aurora/client/api/test_sla.py
+++ b/src/test/python/apache/aurora/client/api/test_sla.py
@@ -21,13 +21,13 @@ from apache.aurora.client.api.sla import (
     DomainUpTimeSlaVector,
     JobUpTimeSlaVector,
     Sla,
-    SLA_LIVE_STATES,
     task_query
 )
 from apache.aurora.common.aurora_job_key import AuroraJobKey
 from apache.aurora.common.cluster import Cluster
 
 from gen.apache.aurora.AuroraSchedulerManager import Client as scheduler_client
+from gen.apache.aurora.constants import LIVE_STATES
 from gen.apache.aurora.ttypes import (
     AssignedTask,
     Identity,
@@ -73,7 +73,7 @@ class SlaTest(unittest.TestCase):
                 environment=self._env)),
         status=ScheduleStatus.RUNNING,
         taskEvents=[TaskEvent(
-            status=ScheduleStatus.STARTING,
+            status=ScheduleStatus.RUNNING,
             timestamp=(time.time() - duration) * 1000)]
     )
 
@@ -153,11 +153,11 @@ class SlaTest(unittest.TestCase):
             owner=Identity(role=self._role),
             environment=self._env,
             jobName=self._name,
-            statuses=SLA_LIVE_STATES)
+            statuses=LIVE_STATES)
     )
 
   def expect_task_status_call_cluster_scoped(self):
-    self._scheduler.getTasksStatus.assert_called_once_with(TaskQuery(statuses=SLA_LIVE_STATES))
+    self._scheduler.getTasksStatus.assert_called_once_with(TaskQuery(statuses=LIVE_STATES))
 
 
   def test_count_0(self):
@@ -341,6 +341,6 @@ class SlaTest(unittest.TestCase):
     assert len(jobs) == len(query.jobKeys), 'Expected length:%s, Actual:%s' % (
         len(jobs), len(query.jobKeys)
     )
-    assert SLA_LIVE_STATES == query.statuses, 'Expected:%s, Actual:%s' % (
-        SLA_LIVE_STATES, query.statuses
+    assert LIVE_STATES == query.statuses, 'Expected:%s, Actual:%s' % (
+      LIVE_STATES, query.statuses
     )


Mime
View raw message