You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by zm...@apache.org on 2016/10/18 18:52:35 UTC
aurora git commit: Adding an error message when the
mesos_containerizer_path is not set correctly.
Repository: aurora
Updated Branches:
refs/heads/master ad77de1e6 -> 8e228b681
Adding an error message when the mesos_containerizer_path is not set correctly.
Testing Done:
I verified the new error makes its way to the UI when mesos_containerizer_path
is set to a file that does not exist and also verified the executors complates
succesfully when mesos_containerizer_path is set to the correct location.
Unit tests:
```
./pants test src/test/python/apache/thermos::
./pants test src/test/python/apache/aurora/executor::
```
Bugs closed: AURORA-1789
Reviewed at https://reviews.apache.org/r/52804/
Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/8e228b68
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/8e228b68
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/8e228b68
Branch: refs/heads/master
Commit: 8e228b6810a3c3ec66ab9656827dd86232ff2087
Parents: ad77de1
Author: Justin Pinkul <jp...@live.com>
Authored: Tue Oct 18 11:52:22 2016 -0700
Committer: Zameer Manji <zm...@apache.org>
Committed: Tue Oct 18 11:52:22 2016 -0700
----------------------------------------------------------------------
.../aurora/executor/thermos_task_runner.py | 13 +++-
.../aurora/executor/test_thermos_executor.py | 82 +++++++++++++++++++-
2 files changed, 91 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/aurora/blob/8e228b68/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 efa51e1..8f88af4 100644
--- a/src/main/python/apache/aurora/executor/thermos_task_runner.py
+++ b/src/main/python/apache/aurora/executor/thermos_task_runner.py
@@ -389,9 +389,16 @@ class DefaultThermosTaskRunnerProvider(TaskRunnerProvider):
return None if assigned_task.task.container.docker else assigned_task.task.job.role
def from_assigned_task(self, assigned_task, sandbox):
- if sandbox.is_filesystem_image and self._mesos_containerizer_path is None:
- raise TaskError('Cannot launch task using a filesystem image: no mesos_containerizer_path '
- 'was set.')
+ if sandbox.is_filesystem_image:
+ if self._mesos_containerizer_path is None:
+ raise TaskError('Cannot launch task using a filesystem image: no mesos_containerizer_path '
+ 'was set.')
+ if not os.path.isfile(self._mesos_containerizer_path):
+ raise TaskError('Cannot launch task using a filesystem image: mesos_containerizer_path '
+ ' %s does not exist.' % self._mesos_containerizer_path)
+ if not os.access(self._mesos_containerizer_path, os.X_OK):
+ raise TaskError('Cannot launch task using a filesystem image: mesos_containerizer_path '
+ ' %s is not marked as executable.' % self._mesos_containerizer_path)
task_id = assigned_task.taskId
role = self._get_role(assigned_task)
http://git-wip-us.apache.org/repos/asf/aurora/blob/8e228b68/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 0bfe9e9..3f82165 100644
--- a/src/test/python/apache/aurora/executor/test_thermos_executor.py
+++ b/src/test/python/apache/aurora/executor/test_thermos_executor.py
@@ -100,6 +100,19 @@ class FailingSandboxProvider(SandboxProvider):
return FailingSandbox(safe_mkdtemp(), exception_type=self._exception_type, **kwargs)
+class FileSystemImageTestSandboxProvider(SandboxProvider):
+ class FileSystemImageSandboxTest(DirectorySandbox):
+ def create(self):
+ pass
+
+ @property
+ def is_filesystem_image(self):
+ return True
+
+ def from_assigned_task(self, assigned_task, **kwargs):
+ return self.FileSystemImageSandboxTest(safe_mkdtemp())
+
+
class SlowSandbox(DirectorySandbox):
def __init__(self, *args, **kwargs):
super(SlowSandbox, self).__init__(*args, **kwargs)
@@ -188,11 +201,12 @@ def thermos_runner_path(build=True):
return thermos_runner_path.value
-def make_provider(checkpoint_root, runner_class=ThermosTaskRunner):
+def make_provider(checkpoint_root, runner_class=ThermosTaskRunner, mesos_containerizer_path=None):
return DefaultThermosTaskRunnerProvider(
pex_location=thermos_runner_path(),
checkpoint_root=checkpoint_root,
task_runner_class=runner_class,
+ mesos_containerizer_path=mesos_containerizer_path
)
@@ -572,6 +586,72 @@ class TestThermosExecutor(object):
assert updates[0][0][0].state == mesos_pb2.TASK_STARTING
assert updates[1][0][0].state == mesos_pb2.TASK_FAILED
+ def test_filesystem_image_assign_no_containerizer(self):
+ proxy_driver = ProxyDriver()
+
+ with temporary_dir() as tempdir:
+ te = FastThermosExecutor(
+ runner_provider=make_provider(tempdir, mesos_containerizer_path=None),
+ sandbox_provider=FileSystemImageTestSandboxProvider())
+ te.launchTask(proxy_driver, make_task(HELLO_WORLD_MTI))
+
+ te.SANDBOX_INITIALIZATION_TIMEOUT = Amount(1, Time.MILLISECONDS)
+ te.START_TIMEOUT = Amount(10, Time.MILLISECONDS)
+ te.STOP_TIMEOUT = Amount(10, Time.MILLISECONDS)
+
+ proxy_driver.wait_stopped()
+
+ updates = proxy_driver.method_calls['sendStatusUpdate']
+ assert len(updates) == 2
+ assert updates[0][0][0].state == mesos_pb2.TASK_STARTING
+ assert updates[1][0][0].state == mesos_pb2.TASK_FAILED
+
+ def test_filesystem_image_assign_missing_containerizer(self):
+ proxy_driver = ProxyDriver()
+
+ with temporary_dir() as tempdir:
+ te = FastThermosExecutor(
+ runner_provider=make_provider(tempdir, mesos_containerizer_path='/doesnotexist'),
+ sandbox_provider=FileSystemImageTestSandboxProvider())
+ te.launchTask(proxy_driver, make_task(HELLO_WORLD_MTI))
+
+ te.SANDBOX_INITIALIZATION_TIMEOUT = Amount(1, Time.MILLISECONDS)
+ te.START_TIMEOUT = Amount(10, Time.MILLISECONDS)
+ te.STOP_TIMEOUT = Amount(10, Time.MILLISECONDS)
+
+ proxy_driver.wait_stopped()
+
+ updates = proxy_driver.method_calls['sendStatusUpdate']
+ assert len(updates) == 2
+ assert updates[0][0][0].state == mesos_pb2.TASK_STARTING
+ assert updates[1][0][0].state == mesos_pb2.TASK_FAILED
+
+ def test_filesystem_image_containerizer_not_executable(self):
+ proxy_driver = ProxyDriver()
+
+ with temporary_dir() as tempdir:
+
+ tempfile = os.path.join(tempdir, 'fake-containierizer')
+ with open(tempfile, 'a'):
+ os.utime(tempfile, None)
+
+ te = FastThermosExecutor(
+ runner_provider=make_provider(tempdir, mesos_containerizer_path=tempfile),
+ sandbox_provider=FileSystemImageTestSandboxProvider())
+
+ te.SANDBOX_INITIALIZATION_TIMEOUT = Amount(1, Time.MILLISECONDS)
+ te.START_TIMEOUT = Amount(10, Time.MILLISECONDS)
+ te.STOP_TIMEOUT = Amount(10, Time.MILLISECONDS)
+
+ te.launchTask(proxy_driver, make_task(HELLO_WORLD_MTI))
+
+ proxy_driver.wait_stopped()
+
+ updates = proxy_driver.method_calls['sendStatusUpdate']
+ assert len(updates) == 2
+ assert updates[0][0][0].state == mesos_pb2.TASK_STARTING
+ assert updates[1][0][0].state == mesos_pb2.TASK_FAILED
+
def test_waiting_executor():
proxy_driver = ProxyDriver()