aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zma...@apache.org
Subject incubator-aurora git commit: Reject None values for TaskPath
Date Mon, 09 Feb 2015 18:53:32 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 11a65d2de -> dcae1e8d2


Reject None values for TaskPath

This patch modifies TaskPath to reject None values.

Testing Done:
./pants test src/test/python/apache/thermos::
./pants test src/test/python/apache/aurora/executor::
./src/test/sh/org/apache/aurora/e2e/test_end_to_end.sh

Bugs closed: AURORA-1115

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


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

Branch: refs/heads/master
Commit: dcae1e8d29d799f2df29b5f073c9143be7d17a8c
Parents: 11a65d2
Author: Zameer Manji <zmanji@apache.org>
Authored: Mon Feb 9 10:53:21 2015 -0800
Committer: Zameer Manji <zmanji@apache.org>
Committed: Mon Feb 9 10:53:21 2015 -0800

----------------------------------------------------------------------
 .../aurora/executor/thermos_task_runner.py      |  2 +-
 src/main/python/apache/thermos/common/path.py   |  3 ++
 .../common/test_resource_manager_integration.py | 42 +++++++++++---------
 .../apache/thermos/common/test_pathspec.py      |  9 +++++
 .../sh/org/apache/aurora/e2e/test_end_to_end.sh |  5 +++
 5 files changed, 41 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/dcae1e8d/src/main/python/apache/aurora/executor/thermos_task_runner.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/executor/thermos_task_runner.py b/src/main/python/apache/aurora/executor/thermos_task_runner.py
index 9ff8c53..7a28e32 100644
--- a/src/main/python/apache/aurora/executor/thermos_task_runner.py
+++ b/src/main/python/apache/aurora/executor/thermos_task_runner.py
@@ -359,7 +359,7 @@ class ThermosTaskRunner(TaskRunner):
 class DefaultThermosTaskRunnerProvider(TaskRunnerProvider):
   def __init__(self,
                pex_location,
-               checkpoint_root=None,
+               checkpoint_root=DEFAULT_CHECKPOINT_ROOT,
                artifact_dir=None,
                task_runner_class=ThermosTaskRunner,
                max_wait=Amount(1, Time.MINUTES),

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/dcae1e8d/src/main/python/apache/thermos/common/path.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/thermos/common/path.py b/src/main/python/apache/thermos/common/path.py
index 713dbe2..846f507 100644
--- a/src/main/python/apache/thermos/common/path.py
+++ b/src/main/python/apache/thermos/common/path.py
@@ -77,6 +77,9 @@ class TaskPath(object):
       self._template, keys = self.DIR_TEMPLATE, self.KNOWN_KEYS
     else:
       self._template, keys = self.LEGACY_DIR_TEMPLATE, self.LEGACY_KNOWN_KEYS
+    for k, v in kw.items():
+      if v is None:
+        raise ValueError("Key %s is None" % k)
     self._data = dict((key, '%%(%s)s' % key) for key in keys)
     self._data.update(kw)
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/dcae1e8d/src/test/python/apache/aurora/executor/common/test_resource_manager_integration.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/executor/common/test_resource_manager_integration.py
b/src/test/python/apache/aurora/executor/common/test_resource_manager_integration.py
index 6d5c7a0..8f288f6 100644
--- a/src/test/python/apache/aurora/executor/common/test_resource_manager_integration.py
+++ b/src/test/python/apache/aurora/executor/common/test_resource_manager_integration.py
@@ -33,33 +33,37 @@ def make_assigned_task(thermos_config, assigned_ports=None):
   assigned_ports = assigned_ports or {}
   executor_config = ExecutorConfig(name=AURORA_EXECUTOR_NAME, data=thermos_config.json_dumps())
   task_config = TaskConfig(
-    owner=Identity(role=thermos_config.role().get(), user=thermos_config.role().get()),
-    environment=thermos_config.environment().get(),
-    jobName=thermos_config.name().get(),
-    executorConfig=executor_config)
+      owner=Identity(role=thermos_config.role().get(), user=thermos_config.role().get()),
+      environment=thermos_config.environment().get(),
+      jobName=thermos_config.name().get(),
+      executorConfig=executor_config)
 
-  return AssignedTask(instanceId=12345, task=task_config, assignedPorts=assigned_ports)
+  return AssignedTask(
+      instanceId=12345,
+      task=task_config,
+      assignedPorts=assigned_ports,
+      taskId="taskId-12345")
 
 
 def make_job(role, environment, name, primary_port, portmap):
   from apache.aurora.config.schema.base import (
-    Announcer,
-    Job,
-    Process,
-    Resources,
-    Task,
+      Announcer,
+      Job,
+      Process,
+      Resources,
+      Task,
   )
   task = Task(
-    name='ignore2',
-    processes=[Process(name='ignore3', cmdline='ignore4')],
-    resources=Resources(cpu=1, ram=1, disk=1))
+      name='ignore2',
+      processes=[Process(name='ignore3', cmdline='ignore4')],
+      resources=Resources(cpu=1, ram=1, disk=1))
   job = Job(
-    role=role,
-    environment=environment,
-    name=name,
-    cluster='ignore1',
-    task=task,
-    announce=Announcer(primary_port=primary_port, portmap=portmap))
+      role=role,
+      environment=environment,
+      name=name,
+      cluster='ignore1',
+      task=task,
+      announce=Announcer(primary_port=primary_port, portmap=portmap))
   return job
 
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/dcae1e8d/src/test/python/apache/thermos/common/test_pathspec.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/thermos/common/test_pathspec.py b/src/test/python/apache/thermos/common/test_pathspec.py
index bc5840c..146fe55 100644
--- a/src/test/python/apache/thermos/common/test_pathspec.py
+++ b/src/test/python/apache/thermos/common/test_pathspec.py
@@ -12,6 +12,8 @@
 # limitations under the License.
 #
 
+import pytest
+
 from apache.thermos.common.path import TaskPath
 
 
@@ -23,3 +25,10 @@ def test_legacy_task_roots():
 def test_legacy_log_dirs():
   assert TaskPath(log_dir='sloth_love_chunk').given(task_id='foo').getpath(
       'process_logbase') == 'sloth_love_chunk'
+
+
+def test_exception_on_none_keys():
+  with pytest.raises(ValueError):
+    TaskPath(root=None).given(task_id='foo').getpath('checkpoint_path')
+  with pytest.raises(ValueError):
+    TaskPath(root='/var/lib/mesos').given(task_id=None).getpath('checkpoint_path')

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/dcae1e8d/src/test/sh/org/apache/aurora/e2e/test_end_to_end.sh
----------------------------------------------------------------------
diff --git a/src/test/sh/org/apache/aurora/e2e/test_end_to_end.sh b/src/test/sh/org/apache/aurora/e2e/test_end_to_end.sh
index 7ef7a6b..1d599c3 100755
--- a/src/test/sh/org/apache/aurora/e2e/test_end_to_end.sh
+++ b/src/test/sh/org/apache/aurora/e2e/test_end_to_end.sh
@@ -55,6 +55,11 @@ test_http_example() {
   check_url_live "$base_url/scheduler"
   check_url_live "$base_url/scheduler/$_role"
   check_url_live "$base_url/scheduler/$_role/$_env/$_job"
+  # Check the observer page
+  observer_url="http://$_sched_ip:1338"
+  task_id=$(vagrant ssh -c "aurora_admin query -l '%taskId%' --states=RUNNING $_cluster $_role
$_job | tr -d '\n'")
+  check_url_live "$observer_url"
+  check_url_live "$observer_url/task/$task_id"
 
   echo "== Restarting test job"
 


Mime
View raw message