You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by wf...@apache.org on 2014/10/01 00:48:33 UTC
git commit: Stop sending and receiving DeletedTasks framework message.
Repository: incubator-aurora
Updated Branches:
refs/heads/master cdedd20b1 -> b4fea865c
Stop sending and receiving DeletedTasks framework message.
Bugs closed: AURORA-764
Reviewed at https://reviews.apache.org/r/26154/
Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/b4fea865
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/b4fea865
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/b4fea865
Branch: refs/heads/master
Commit: b4fea865cce341df22e9eb099798391ca57291bb
Parents: cdedd20
Author: Bill Farner <wf...@apache.org>
Authored: Tue Sep 30 15:47:06 2014 -0700
Committer: Bill Farner <wf...@apache.org>
Committed: Tue Sep 30 15:47:06 2014 -0700
----------------------------------------------------------------------
.../aurora/scheduler/MesosSchedulerImpl.java | 44 ++++----------------
.../aurora/scheduler/http/api/ApiBeta.java | 4 +-
.../http/api/GsonMessageBodyHandler.java | 6 +--
.../aurora/scheduler/storage/db/DbStorage.java | 4 +-
.../apache/aurora/executor/gc_executor.py | 9 ++--
.../org/apache/aurora/gen/internal_rpc.thrift | 39 -----------------
.../scheduler/MesosSchedulerImplTest.java | 38 ++++-------------
.../scheduler/cron/ExpectedPrediction.java | 4 +-
.../aurora/scheduler/http/api/ApiBetaTest.java | 4 +-
.../scheduler/log/mesos/MesosLogTest.java | 14 +++----
.../apache/aurora/executor/test_gc_executor.py | 13 +-----
11 files changed, 36 insertions(+), 143 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b4fea865/src/main/java/org/apache/aurora/scheduler/MesosSchedulerImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/MesosSchedulerImpl.java b/src/main/java/org/apache/aurora/scheduler/MesosSchedulerImpl.java
index e4439f6..ed3c8a7 100644
--- a/src/main/java/org/apache/aurora/scheduler/MesosSchedulerImpl.java
+++ b/src/main/java/org/apache/aurora/scheduler/MesosSchedulerImpl.java
@@ -20,23 +20,17 @@ import java.util.logging.Logger;
import javax.inject.Inject;
-import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.twitter.common.application.Lifecycle;
import com.twitter.common.inject.TimedInterceptor.Timed;
import com.twitter.common.stats.Stats;
import org.apache.aurora.GuiceUtils.AllowUnchecked;
-import org.apache.aurora.codec.ThriftBinaryCodec;
-import org.apache.aurora.gen.ScheduleStatus;
-import org.apache.aurora.gen.comm.SchedulerMessage;
-import org.apache.aurora.gen.comm.SchedulerMessage._Fields;
import org.apache.aurora.scheduler.base.Conversions;
import org.apache.aurora.scheduler.base.SchedulerException;
import org.apache.aurora.scheduler.events.EventSink;
import org.apache.aurora.scheduler.events.PubsubEvent.DriverDisconnected;
import org.apache.aurora.scheduler.events.PubsubEvent.DriverRegistered;
-import org.apache.aurora.scheduler.state.StateManager;
import org.apache.aurora.scheduler.storage.Storage;
import org.apache.aurora.scheduler.storage.Storage.MutableStoreProvider;
import org.apache.aurora.scheduler.storage.Storage.MutateWork;
@@ -69,7 +63,6 @@ class MesosSchedulerImpl implements Scheduler {
private final List<TaskLauncher> taskLaunchers;
private final Storage storage;
- private final StateManager stateManager;
private final Lifecycle lifecycle;
private final EventSink eventSink;
private volatile boolean isRegistered = false;
@@ -77,24 +70,23 @@ class MesosSchedulerImpl implements Scheduler {
/**
* Creates a new scheduler.
*
- * @param stateManager Scheduler state manager.
+ * @param storage Store to save host attributes into.
* @param lifecycle Application lifecycle manager.
* @param taskLaunchers Task launchers, which will be used in order. Calls to
* {@link TaskLauncher#willUse(Offer)} and
* {@link TaskLauncher#statusUpdate(TaskStatus)} are propagated to provided
* launchers, ceasing after the first match (based on a return value of
* {@code true}.
+ * @param eventSink Pubsub sink to send driver status changes to.
*/
@Inject
public MesosSchedulerImpl(
Storage storage,
- StateManager stateManager,
final Lifecycle lifecycle,
List<TaskLauncher> taskLaunchers,
EventSink eventSink) {
this.storage = requireNonNull(storage);
- this.stateManager = requireNonNull(stateManager);
this.lifecycle = requireNonNull(lifecycle);
this.taskLaunchers = requireNonNull(taskLaunchers);
this.eventSink = requireNonNull(eventSink);
@@ -224,34 +216,12 @@ class MesosSchedulerImpl implements Scheduler {
@Timed("scheduler_framework_message")
@Override
- public void frameworkMessage(SchedulerDriver driver, ExecutorID executor, SlaveID slave,
+ public void frameworkMessage(
+ SchedulerDriver driver,
+ ExecutorID executor,
+ SlaveID slave,
byte[] data) {
- if (data == null) {
- LOG.info("Received empty framework message.");
- return;
- }
-
- try {
- SchedulerMessage schedulerMsg = ThriftBinaryCodec.decode(SchedulerMessage.class, data);
- if (schedulerMsg == null || !schedulerMsg.isSet()) {
- LOG.warning("Received empty scheduler message.");
- return;
- }
-
- if (schedulerMsg.getSetField() == _Fields.DELETED_TASKS) {
- for (String taskId : schedulerMsg.getDeletedTasks().getTaskIds()) {
- stateManager.changeState(
- taskId,
- Optional.<ScheduleStatus>absent(),
- ScheduleStatus.SANDBOX_DELETED,
- Optional.of("Sandbox disk space reclaimed."));
- }
- } else {
- LOG.warning("Received unhandled scheduler message type: " + schedulerMsg.getSetField());
- }
- } catch (ThriftBinaryCodec.CodingException e) {
- LOG.log(Level.SEVERE, "Failed to decode framework message.", e);
- }
+ LOG.warning("Ignoring framework message.");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b4fea865/src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java b/src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java
index 2b96427..eaf6338 100644
--- a/src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java
+++ b/src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java
@@ -20,6 +20,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.net.URI;
+import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -38,7 +39,6 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.StreamingOutput;
-import com.google.common.base.Charsets;
import com.google.common.base.Throwables;
import com.google.common.collect.Lists;
import com.google.common.io.ByteSource;
@@ -159,7 +159,7 @@ public class ApiBeta {
public void write(OutputStream output) throws IOException {
try {
Object response = method.invoke(api, params);
- try (OutputStreamWriter out = new OutputStreamWriter(output, Charsets.UTF_8)) {
+ try (OutputStreamWriter out = new OutputStreamWriter(output, StandardCharsets.UTF_8)) {
GSON.toJson(response, out);
}
} catch (IllegalAccessException | InvocationTargetException e) {
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b4fea865/src/main/java/org/apache/aurora/scheduler/http/api/GsonMessageBodyHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/http/api/GsonMessageBodyHandler.java b/src/main/java/org/apache/aurora/scheduler/http/api/GsonMessageBodyHandler.java
index 826c0ad..2ec7da6 100644
--- a/src/main/java/org/apache/aurora/scheduler/http/api/GsonMessageBodyHandler.java
+++ b/src/main/java/org/apache/aurora/scheduler/http/api/GsonMessageBodyHandler.java
@@ -22,6 +22,7 @@ import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@@ -35,7 +36,6 @@ import javax.ws.rs.ext.MessageBodyReader;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
-import com.google.common.base.Charsets;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@@ -87,7 +87,7 @@ public class GsonMessageBodyHandler
// For some reason try-with-resources syntax trips a findbugs error here.
InputStreamReader streamReader = null;
try {
- streamReader = new InputStreamReader(entityStream, Charsets.UTF_8);
+ streamReader = new InputStreamReader(entityStream, StandardCharsets.UTF_8);
Type jsonType;
if (type.equals(genericType)) {
jsonType = type;
@@ -111,7 +111,7 @@ public class GsonMessageBodyHandler
MultivaluedMap<String, Object> httpHeaders,
OutputStream entityStream) throws IOException, WebApplicationException {
- try (OutputStreamWriter writer = new OutputStreamWriter(entityStream, Charsets.UTF_8)) {
+ try (OutputStreamWriter writer = new OutputStreamWriter(entityStream, StandardCharsets.UTF_8)) {
Type jsonType;
if (type.equals(genericType)) {
jsonType = type;
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b4fea865/src/main/java/org/apache/aurora/scheduler/storage/db/DbStorage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/storage/db/DbStorage.java b/src/main/java/org/apache/aurora/scheduler/storage/db/DbStorage.java
index 71bc4c9..40487e5 100644
--- a/src/main/java/org/apache/aurora/scheduler/storage/db/DbStorage.java
+++ b/src/main/java/org/apache/aurora/scheduler/storage/db/DbStorage.java
@@ -15,8 +15,8 @@ package org.apache.aurora.scheduler.storage.db;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
-import com.google.common.base.Charsets;
import com.google.common.io.CharStreams;
import com.google.common.util.concurrent.AbstractIdleService;
import com.google.inject.Inject;
@@ -178,7 +178,7 @@ class DbStorage extends AbstractIdleService implements Storage {
CharStreams.toString(
new InputStreamReader(
DbStorage.class.getResourceAsStream("schema.sql"),
- Charsets.UTF_8))),
+ StandardCharsets.UTF_8))),
SqlCommandType.UPDATE)
.build());
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b4fea865/src/main/python/apache/aurora/executor/gc_executor.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/executor/gc_executor.py b/src/main/python/apache/aurora/executor/gc_executor.py
index 6701caa..44eb0da 100644
--- a/src/main/python/apache/aurora/executor/gc_executor.py
+++ b/src/main/python/apache/aurora/executor/gc_executor.py
@@ -47,7 +47,7 @@ from .executor_detector import ExecutorDetector
from gen.apache.aurora.api.constants import TERMINAL_STATES
from gen.apache.aurora.api.ttypes import ScheduleStatus
-from gen.apache.aurora.comm.ttypes import AdjustRetainedTasks, DeletedTasks, SchedulerMessage
+from gen.apache.aurora.comm.ttypes import AdjustRetainedTasks
from gen.apache.thermos.ttypes import TaskState
THERMOS_TO_TWITTER_STATES = {
@@ -436,11 +436,8 @@ class ThermosGCExecutor(ExecutorBase, ExceptionalThread, Observable):
self._task_id = task_id
self.log('Launching garbage collection [task_id=%s]' % task_id)
self._start_time = retain_start
- local_gc, remote_gc, _ = self.reconcile_states(self._driver, retain_tasks)
- deleted_tasks = set(retain_tasks).intersection(self.garbage_collect(local_gc)) | remote_gc
- if deleted_tasks:
- self._driver.sendFrameworkMessage(thrift_serialize(
- SchedulerMessage(deletedTasks=DeletedTasks(taskIds=deleted_tasks))))
+ local_gc, _, _ = self.reconcile_states(self._driver, retain_tasks)
+ self.garbage_collect(local_gc)
self.send_update(
self._driver, task.task_id.value, mesos_pb2.TASK_FINISHED, 'Garbage collection finished.')
self.log('Garbage collection complete [task_id=%s]' % task_id)
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b4fea865/src/main/thrift/org/apache/aurora/gen/internal_rpc.thrift
----------------------------------------------------------------------
diff --git a/src/main/thrift/org/apache/aurora/gen/internal_rpc.thrift b/src/main/thrift/org/apache/aurora/gen/internal_rpc.thrift
index 842b011..a2c230f 100644
--- a/src/main/thrift/org/apache/aurora/gen/internal_rpc.thrift
+++ b/src/main/thrift/org/apache/aurora/gen/internal_rpc.thrift
@@ -19,18 +19,6 @@ include "api.thrift"
// Thrift interface to define the communication between the scheduler and executor.
-// Message sent from the executor to the scheduler, indicating that sandboxes
-// for terminated tasks were deleted due to disk exhaustion.
-struct DeletedTasks {
- 1: set<string> taskIds
-}
-
-// Message sent from the executor to the scheduler.
-// TODO(wfarner): Consider renaming to be more clear.
-union SchedulerMessage {
- 4: DeletedTasks deletedTasks
-}
-
// Message sent from the scheduler to the executor, indicating that some
// task history associated with the host may have been purged, and the
// executor should only retain tasks associated with the provided tasks IDs.
@@ -38,30 +26,3 @@ struct AdjustRetainedTasks {
2: map<string, api.ScheduleStatus> retainedTasks // All tasks that the executor should
// retain, and their statuses.
}
-
-// Message sent from the scheduler to the executor.
-// TODO(wfarner): Consider renaming to be more clear.
-union ExecutorMessage {
- 4: AdjustRetainedTasks adjustRetainedTasks
-}
-
-struct TaskResourceSample {
- // dynamic
- 13: i64 microTimestamp
-
- // static
- 1: double reservedCpuRate
- 2: double reservedRamBytes
- 3: double reservedDiskBytes
-
- // dynamic
- 4: double cpuRate
- 5: double cpuUserSecs
- 6: double cpuSystemSecs
- 7: i16 cpuNice
- 8: i64 ramRssBytes
- 9: i64 ramVssBytes
- 10: i16 numThreads
- 11: i16 numProcesses
- 12: i64 diskBytes
-}
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b4fea865/src/test/java/org/apache/aurora/scheduler/MesosSchedulerImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/MesosSchedulerImplTest.java b/src/test/java/org/apache/aurora/scheduler/MesosSchedulerImplTest.java
index 606b5b0..e3af344 100644
--- a/src/test/java/org/apache/aurora/scheduler/MesosSchedulerImplTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/MesosSchedulerImplTest.java
@@ -14,13 +14,12 @@
package org.apache.aurora.scheduler;
import java.lang.Thread.UncaughtExceptionHandler;
+import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
-import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
import com.google.common.testing.TearDown;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
@@ -30,16 +29,11 @@ import com.twitter.common.application.Lifecycle;
import com.twitter.common.base.Command;
import com.twitter.common.testing.easymock.EasyMockTest;
-import org.apache.aurora.codec.ThriftBinaryCodec;
-import org.apache.aurora.gen.ScheduleStatus;
-import org.apache.aurora.gen.comm.DeletedTasks;
-import org.apache.aurora.gen.comm.SchedulerMessage;
import org.apache.aurora.scheduler.base.Conversions;
import org.apache.aurora.scheduler.base.SchedulerException;
import org.apache.aurora.scheduler.events.EventSink;
import org.apache.aurora.scheduler.events.PubsubEvent.DriverDisconnected;
import org.apache.aurora.scheduler.events.PubsubEvent.DriverRegistered;
-import org.apache.aurora.scheduler.state.StateManager;
import org.apache.aurora.scheduler.storage.Storage;
import org.apache.aurora.scheduler.storage.Storage.StorageException;
import org.apache.aurora.scheduler.storage.testing.StorageTestUtil;
@@ -96,7 +90,6 @@ public class MesosSchedulerImplTest extends EasyMockTest {
private TaskLauncher userLauncher;
private SchedulerDriver driver;
private EventSink eventSink;
- private StateManager stateManager;
private MesosSchedulerImpl scheduler;
@@ -108,13 +101,11 @@ public class MesosSchedulerImplTest extends EasyMockTest {
systemLauncher = createMock(TaskLauncher.class);
userLauncher = createMock(TaskLauncher.class);
eventSink = createMock(EventSink.class);
- stateManager = createMock(StateManager.class);
Injector injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(Storage.class).toInstance(storageUtil.storage);
- bind(StateManager.class).toInstance(stateManager);
bind(Lifecycle.class).toInstance(lifecycle);
bind(new TypeLiteral<List<TaskLauncher>>() { })
.toInstance(Arrays.asList(systemLauncher, userLauncher));
@@ -257,29 +248,14 @@ public class MesosSchedulerImplTest extends EasyMockTest {
}
@Test
- public void testSandboxesDeleted() throws Exception {
- String task1 = "task1";
- String task2 = "task2";
- String message = "Sandbox disk space reclaimed.";
-
- expect(stateManager.changeState(
- task1,
- Optional.<ScheduleStatus>absent(),
- ScheduleStatus.SANDBOX_DELETED,
- Optional.of(message))).andReturn(true);
-
- expect(stateManager.changeState(
- task2,
- Optional.<ScheduleStatus>absent(),
- ScheduleStatus.SANDBOX_DELETED,
- Optional.of(message))).andReturn(true);
-
+ public void testFrameworkMessageIgnored() throws Exception {
control.replay();
- SchedulerMessage schedulerMessage =
- SchedulerMessage.deletedTasks(new DeletedTasks(ImmutableSet.of("task1", "task2")));
- byte[] data = ThriftBinaryCodec.encode(schedulerMessage);
- scheduler.frameworkMessage(driver, EXECUTOR_ID, SLAVE_ID, data);
+ scheduler.frameworkMessage(
+ driver,
+ EXECUTOR_ID,
+ SLAVE_ID,
+ "hello".getBytes(StandardCharsets.UTF_8));
}
private void expectOfferAttributesSaved(Offer offer) {
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b4fea865/src/test/java/org/apache/aurora/scheduler/cron/ExpectedPrediction.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/cron/ExpectedPrediction.java b/src/test/java/org/apache/aurora/scheduler/cron/ExpectedPrediction.java
index ccfbecb..8d1142f 100644
--- a/src/test/java/org/apache/aurora/scheduler/cron/ExpectedPrediction.java
+++ b/src/test/java/org/apache/aurora/scheduler/cron/ExpectedPrediction.java
@@ -14,9 +14,9 @@
package org.apache.aurora.scheduler.cron;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.util.List;
-import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@@ -37,7 +37,7 @@ public final class ExpectedPrediction {
.fromJson(
new InputStreamReader(
ExpectedPrediction.class.getResourceAsStream("expected-predictions.json"),
- Charsets.UTF_8),
+ StandardCharsets.UTF_8),
new TypeToken<List<ExpectedPrediction>>() { }.getType());
}
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b4fea865/src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java b/src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java
index ec467aa..6215404 100644
--- a/src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java
@@ -14,12 +14,12 @@
package org.apache.aurora.scheduler.http.api;
import java.net.URI;
+import java.nio.charset.StandardCharsets;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response.Status;
-import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
@@ -91,7 +91,7 @@ public class ApiBetaTest extends JettyServerModuleTest {
.setKey(LockKey.job(new JobKey("role", "env", "name")))
.setToken("token");
SessionKey session = new SessionKey()
- .setData("session data".getBytes(Charsets.UTF_8))
+ .setData("session data".getBytes(StandardCharsets.UTF_8))
.setMechanism("fake");
Response response = new Response()
.setResponseCode(OK);
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b4fea865/src/test/java/org/apache/aurora/scheduler/log/mesos/MesosLogTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/log/mesos/MesosLogTest.java b/src/test/java/org/apache/aurora/scheduler/log/mesos/MesosLogTest.java
index 35ccd14..5b6e064 100644
--- a/src/test/java/org/apache/aurora/scheduler/log/mesos/MesosLogTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/log/mesos/MesosLogTest.java
@@ -14,11 +14,11 @@
package org.apache.aurora.scheduler.log.mesos;
import java.lang.reflect.Constructor;
+import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.concurrent.TimeoutException;
-import com.google.common.base.Charsets;
import com.google.common.base.Function;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
@@ -78,7 +78,7 @@ public class MesosLogTest extends EasyMockTest {
bind(new TypeLiteral<Amount<Long, Time>>() { }).annotatedWith(MesosLog.WriteTimeout.class)
.toInstance(WRITE_TIMEOUT);
bind(byte[].class).annotatedWith(MesosLog.NoopEntry.class)
- .toInstance(DUMMY_CONTENT.getBytes(Charsets.UTF_8));
+ .toInstance(DUMMY_CONTENT.getBytes(StandardCharsets.UTF_8));
bind(Lifecycle.class).toInstance(new Lifecycle(shutdownHooks, null));
}
});
@@ -117,12 +117,12 @@ public class MesosLogTest extends EasyMockTest {
shutdownHooks.execute();
control.replay();
- logStream.append(data.getBytes(Charsets.UTF_8));
+ logStream.append(data.getBytes(StandardCharsets.UTF_8));
}
private void expectStreamUnusable() throws Exception {
try {
- logStream.append("nothing".getBytes(Charsets.UTF_8));
+ logStream.append("nothing".getBytes(StandardCharsets.UTF_8));
fail();
} catch (IllegalStateException e) {
// Expected.
@@ -141,12 +141,12 @@ public class MesosLogTest extends EasyMockTest {
Constructor<Log.Entry> entryConstructor =
Log.Entry.class.getDeclaredConstructor(Position.class, byte[].class);
entryConstructor.setAccessible(true);
- return entryConstructor.newInstance(position, data.getBytes(Charsets.UTF_8));
+ return entryConstructor.newInstance(position, data.getBytes(StandardCharsets.UTF_8));
}
private IExpectationSetters<Position> expectWrite(String content) throws Exception {
return expect(
- logWriter.append(EasyMock.aryEq(content.getBytes(Charsets.UTF_8)),
+ logWriter.append(EasyMock.aryEq(content.getBytes(StandardCharsets.UTF_8)),
// Cast is needed to prevent NullPointerException on unboxing.
EasyMock.eq((long) WRITE_TIMEOUT.getValue()),
EasyMock.eq(WRITE_TIMEOUT.getUnit().getTimeUnit())));
@@ -193,7 +193,7 @@ public class MesosLogTest extends EasyMockTest {
.transform(new Function<byte[], String>() {
@Override
public String apply(byte[] data) {
- return new String(data, Charsets.UTF_8);
+ return new String(data, StandardCharsets.UTF_8);
}
})
.toList();
http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/b4fea865/src/test/python/apache/aurora/executor/test_gc_executor.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/executor/test_gc_executor.py b/src/test/python/apache/aurora/executor/test_gc_executor.py
index e9bc7eb..774c9ba 100644
--- a/src/test/python/apache/aurora/executor/test_gc_executor.py
+++ b/src/test/python/apache/aurora/executor/test_gc_executor.py
@@ -39,7 +39,7 @@ from apache.thermos.core.runner import TaskRunner
from gen.apache.aurora.api.constants import LIVE_STATES, TERMINAL_STATES
from gen.apache.aurora.api.ttypes import ScheduleStatus
-from gen.apache.aurora.comm.ttypes import AdjustRetainedTasks, SchedulerMessage
+from gen.apache.aurora.comm.ttypes import AdjustRetainedTasks
from gen.apache.thermos.ttypes import ProcessState, TaskState
ACTIVE_TASKS = ('sleep60-lost',)
@@ -100,7 +100,6 @@ class ProxyDriver(object):
def __init__(self):
self.stopped = threading.Event()
self.updates = []
- self.messages = []
def stop(self):
self.stopped.set()
@@ -108,9 +107,6 @@ class ProxyDriver(object):
def sendStatusUpdate(self, update): # noqa
self.updates.append(StatusUpdate(update.state, update.task_id.value))
- def sendFrameworkMessage(self, message): # noqa
- self.messages.append(thrift_deserialize(SchedulerMessage(), message))
-
def serialize_art(art, task_id=TASK_ID):
td = mesos_pb2.TaskInfo()
@@ -343,7 +339,6 @@ def test_gc_with_loss():
lose=True)
assert len(executor._kills) == len(ACTIVE_TASKS)
assert len(executor.gcs) == len(FINISHED_TASKS)
- assert len(proxy_driver.messages) == 0
assert len(proxy_driver.updates) >= 1
assert StatusUpdate(mesos_pb2.TASK_LOST, ACTIVE_TASKS[0]) in proxy_driver.updates
@@ -353,7 +348,6 @@ def test_gc_with_starting_task():
active_executors=set(ACTIVE_TASKS), retained_tasks={ACTIVE_TASKS[0]: ScheduleStatus.STARTING})
assert len(executor._kills) == 0
assert len(executor.gcs) == len(FINISHED_TASKS)
- assert len(proxy_driver.messages) == 0
def test_gc_without_task_missing():
@@ -361,7 +355,6 @@ def test_gc_without_task_missing():
lose=False)
assert len(executor._kills) == len(ACTIVE_TASKS)
assert len(executor.gcs) == len(FINISHED_TASKS)
- assert len(proxy_driver.messages) == 0
def test_gc_without_loss():
@@ -369,7 +362,6 @@ def test_gc_without_loss():
retained_tasks={ACTIVE_TASKS[0]: ScheduleStatus.RUNNING})
assert len(executor._kills) == 0
assert len(executor.gcs) == len(FINISHED_TASKS)
- assert len(proxy_driver.messages) == 0
def test_gc_withheld():
@@ -378,7 +370,6 @@ def test_gc_withheld():
'failure': ScheduleStatus.FAILED})
assert len(executor._kills) == 0
assert len(executor.gcs) == len(FINISHED_TASKS) - 1
- assert len(proxy_driver.messages) == 0
def test_gc_withheld_and_executor_missing():
@@ -387,8 +378,6 @@ def test_gc_withheld_and_executor_missing():
'failure': ScheduleStatus.FAILED})
assert len(executor._kills) == 0
assert len(executor.gcs) == len(FINISHED_TASKS)
- assert len(proxy_driver.messages) == 1
- assert proxy_driver.messages[0].deletedTasks.taskIds == set(['failure'])
def build_blocking_gc_executor(td, proxy_driver):