You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2014/05/03 04:36:21 UTC
[4/7] git commit: Updated Mesos to satisfy whitespace/indent.
Updated Mesos to satisfy whitespace/indent.
Also modified cpplint.py to check that access keywords are NOT
indented and enabled the cpplint rule in mesos-style.py.
Review: https://reviews.apache.org/r/21005
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c1402733
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c1402733
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c1402733
Branch: refs/heads/master
Commit: c14027334b6c83352bcf5c436cc19f997f7fb5a9
Parents: 3fa78fa
Author: Adam B <ad...@mesosphere.io>
Authored: Fri May 2 19:22:36 2014 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Fri May 2 19:25:04 2014 -0700
----------------------------------------------------------------------
src/log/coordinator.cpp | 2 +-
src/log/recover.cpp | 2 +-
.../native/mesos_executor_driver_impl.cpp | 55 ++++++----
.../native/mesos_scheduler_driver_impl.cpp | 100 +++++++++++--------
src/slave/state.cpp | 2 +-
src/tests/master_tests.cpp | 2 +-
src/tests/slave_recovery_tests.cpp | 2 +-
support/cpplint.patch | 35 +++++--
support/cpplint.py | 8 +-
support/mesos-style.py | 1 +
10 files changed, 135 insertions(+), 74 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1402733/src/log/coordinator.cpp
----------------------------------------------------------------------
diff --git a/src/log/coordinator.cpp b/src/log/coordinator.cpp
index 271fe89..50b7363 100644
--- a/src/log/coordinator.cpp
+++ b/src/log/coordinator.cpp
@@ -213,7 +213,7 @@ Future<Option<uint64_t> > CoordinatorProcess::checkPromisePhase(
return getMissingPositions()
.then(defer(self(), &Self::catchupMissingPositions, lambda::_1))
.then(defer(self(), &Self::updateIndexAfterElected));
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1402733/src/log/recover.cpp
----------------------------------------------------------------------
diff --git a/src/log/recover.cpp b/src/log/recover.cpp
index 7c0566a..2013e91 100644
--- a/src/log/recover.cpp
+++ b/src/log/recover.cpp
@@ -292,7 +292,7 @@ private:
void finished(const Future<Option<RecoverResponse> >& future)
{
- if (future.isDiscarded()) {
+ if (future.isDiscarded()) {
// We use the boolean flag 'terminating' to distinguish between
// a user initiated discard and a timeout induced discard. In
// the case of a user initiated discard, the flag 'terminating'
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1402733/src/python/native/mesos_executor_driver_impl.cpp
----------------------------------------------------------------------
diff --git a/src/python/native/mesos_executor_driver_impl.cpp b/src/python/native/mesos_executor_driver_impl.cpp
index a2f7607..aa564ed 100644
--- a/src/python/native/mesos_executor_driver_impl.cpp
+++ b/src/python/native/mesos_executor_driver_impl.cpp
@@ -88,25 +88,42 @@ PyTypeObject MesosExecutorDriverImplType = {
* List of Python methods in MesosExecutorDriverImpl.
*/
PyMethodDef MesosExecutorDriverImpl_methods[] = {
- {"start", (PyCFunction) MesosExecutorDriverImpl_start, METH_NOARGS,
- "Start the driver to connect to Mesos"},
- {"stop", (PyCFunction) MesosExecutorDriverImpl_stop, METH_NOARGS,
- "Stop the driver, disconnecting from Mesos"},
- {"abort", (PyCFunction) MesosExecutorDriverImpl_abort, METH_NOARGS,
- "Abort the driver, disallowing calls from and to the driver"},
- {"join", (PyCFunction) MesosExecutorDriverImpl_join, METH_NOARGS,
- "Wait for a running driver to disconnect from Mesos"},
- {"run", (PyCFunction) MesosExecutorDriverImpl_run, METH_NOARGS,
- "Start a driver and run it, returning when it disconnects from Mesos"},
- {"sendStatusUpdate",
- (PyCFunction) MesosExecutorDriverImpl_sendStatusUpdate,
- METH_VARARGS,
- "Send a status update for a task"},
- {"sendFrameworkMessage",
- (PyCFunction) MesosExecutorDriverImpl_sendFrameworkMessage,
- METH_VARARGS,
- "Send a FrameworkMessage to a slave"},
- {NULL} /* Sentinel */
+ { "start",
+ (PyCFunction) MesosExecutorDriverImpl_start,
+ METH_NOARGS,
+ "Start the driver to connect to Mesos"
+ },
+ { "stop",
+ (PyCFunction) MesosExecutorDriverImpl_stop,
+ METH_NOARGS,
+ "Stop the driver, disconnecting from Mesos"
+ },
+ { "abort",
+ (PyCFunction) MesosExecutorDriverImpl_abort,
+ METH_NOARGS,
+ "Abort the driver, disallowing calls from and to the driver"
+ },
+ { "join",
+ (PyCFunction) MesosExecutorDriverImpl_join,
+ METH_NOARGS,
+ "Wait for a running driver to disconnect from Mesos"
+ },
+ { "run",
+ (PyCFunction) MesosExecutorDriverImpl_run,
+ METH_NOARGS,
+ "Start a driver and run it, returning when it disconnects from Mesos"
+ },
+ { "sendStatusUpdate",
+ (PyCFunction) MesosExecutorDriverImpl_sendStatusUpdate,
+ METH_VARARGS,
+ "Send a status update for a task"
+ },
+ { "sendFrameworkMessage",
+ (PyCFunction) MesosExecutorDriverImpl_sendFrameworkMessage,
+ METH_VARARGS,
+ "Send a FrameworkMessage to a slave"
+ },
+ { NULL } /* Sentinel */
};
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1402733/src/python/native/mesos_scheduler_driver_impl.cpp
----------------------------------------------------------------------
diff --git a/src/python/native/mesos_scheduler_driver_impl.cpp b/src/python/native/mesos_scheduler_driver_impl.cpp
index ff5c749..19ce6a4 100644
--- a/src/python/native/mesos_scheduler_driver_impl.cpp
+++ b/src/python/native/mesos_scheduler_driver_impl.cpp
@@ -88,45 +88,67 @@ PyTypeObject MesosSchedulerDriverImplType = {
* List of Python methods in MesosSchedulerDriverImpl.
*/
PyMethodDef MesosSchedulerDriverImpl_methods[] = {
- {"start", (PyCFunction) MesosSchedulerDriverImpl_start, METH_NOARGS,
- "Start the driver to connect to Mesos"},
- {"stop", (PyCFunction) MesosSchedulerDriverImpl_stop, METH_VARARGS,
- "Stop the driver, disconnecting from Mesos"},
- {"abort", (PyCFunction) MesosSchedulerDriverImpl_abort, METH_NOARGS,
- "Abort the driver, disabling calls from and to the driver"},
- {"join", (PyCFunction) MesosSchedulerDriverImpl_join, METH_NOARGS,
- "Wait for a running driver to disconnect from Mesos"},
- {"run", (PyCFunction) MesosSchedulerDriverImpl_run, METH_NOARGS,
- "Start a driver and run it, returning when it disconnects from Mesos"},
- {"requestResources",
- (PyCFunction) MesosSchedulerDriverImpl_requestResources,
- METH_VARARGS,
- "Request resources from the Mesos allocator"},
- {"launchTasks",
- (PyCFunction) MesosSchedulerDriverImpl_launchTasks,
- METH_VARARGS,
- "Reply to a Mesos offer with a list of tasks"},
- {"killTask",
- (PyCFunction) MesosSchedulerDriverImpl_killTask,
- METH_VARARGS,
- "Kill the task with the given ID"},
- {"declineOffer",
- (PyCFunction) MesosSchedulerDriverImpl_declineOffer,
- METH_VARARGS,
- "Decline a Mesos offer"},
- {"reviveOffers",
- (PyCFunction) MesosSchedulerDriverImpl_reviveOffers,
- METH_NOARGS,
- "Remove all filters and ask Mesos for new offers"},
- {"sendFrameworkMessage",
- (PyCFunction) MesosSchedulerDriverImpl_sendFrameworkMessage,
- METH_VARARGS,
- "Send a FrameworkMessage to a slave"},
- {"reconcileTasks",
- (PyCFunction) MesosSchedulerDriverImpl_reconcileTasks,
- METH_VARARGS,
- "Master sends status updates if task status is different from last known state."},
- {NULL} /* Sentinel */
+ { "start",
+ (PyCFunction) MesosSchedulerDriverImpl_start,
+ METH_NOARGS,
+ "Start the driver to connect to Mesos"
+ },
+ { "stop",
+ (PyCFunction) MesosSchedulerDriverImpl_stop,
+ METH_VARARGS,
+ "Stop the driver, disconnecting from Mesos"
+ },
+ { "abort",
+ (PyCFunction) MesosSchedulerDriverImpl_abort,
+ METH_NOARGS,
+ "Abort the driver, disabling calls from and to the driver"
+ },
+ { "join",
+ (PyCFunction) MesosSchedulerDriverImpl_join,
+ METH_NOARGS,
+ "Wait for a running driver to disconnect from Mesos"
+ },
+ { "run",
+ (PyCFunction) MesosSchedulerDriverImpl_run,
+ METH_NOARGS,
+ "Start a driver and run it, returning when it disconnects from Mesos"
+ },
+ { "requestResources",
+ (PyCFunction) MesosSchedulerDriverImpl_requestResources,
+ METH_VARARGS,
+ "Request resources from the Mesos allocator"
+ },
+ { "launchTasks",
+ (PyCFunction) MesosSchedulerDriverImpl_launchTasks,
+ METH_VARARGS,
+ "Reply to a Mesos offer with a list of tasks"
+ },
+ { "killTask",
+ (PyCFunction) MesosSchedulerDriverImpl_killTask,
+ METH_VARARGS,
+ "Kill the task with the given ID"
+ },
+ { "declineOffer",
+ (PyCFunction) MesosSchedulerDriverImpl_declineOffer,
+ METH_VARARGS,
+ "Decline a Mesos offer"
+ },
+ { "reviveOffers",
+ (PyCFunction) MesosSchedulerDriverImpl_reviveOffers,
+ METH_NOARGS,
+ "Remove all filters and ask Mesos for new offers"
+ },
+ { "sendFrameworkMessage",
+ (PyCFunction) MesosSchedulerDriverImpl_sendFrameworkMessage,
+ METH_VARARGS,
+ "Send a FrameworkMessage to a slave"
+ },
+ { "reconcileTasks",
+ (PyCFunction) MesosSchedulerDriverImpl_reconcileTasks,
+ METH_VARARGS,
+ "Master sends status updates if task status is different from last known state."
+ },
+ { NULL } /* Sentinel */
};
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1402733/src/slave/state.cpp
----------------------------------------------------------------------
diff --git a/src/slave/state.cpp b/src/slave/state.cpp
index 2889245..87e9eb9 100644
--- a/src/slave/state.cpp
+++ b/src/slave/state.cpp
@@ -242,7 +242,7 @@ Try<FrameworkState> FrameworkState::recover(
": " + executors.error());
}
- // Recover the executors.
+ // Recover the executors.
foreach (const string& path, executors.get()) {
ExecutorID executorId;
executorId.set_value(os::basename(path).get());
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1402733/src/tests/master_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp
index d407834..746668a 100644
--- a/src/tests/master_tests.cpp
+++ b/src/tests/master_tests.cpp
@@ -1142,7 +1142,7 @@ TEST_F(MasterTest, LaunchAcrossSlavesTest)
EXPECT_EQ(2, resources1.cpus().get());
EXPECT_EQ(Megabytes(1024), resources1.mem().get());
- // Test that offers cannot span multiple slaves.
+ // Test that offers cannot span multiple slaves.
Future<vector<Offer> > offers2;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers2));
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1402733/src/tests/slave_recovery_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/slave_recovery_tests.cpp b/src/tests/slave_recovery_tests.cpp
index 86cf12b..2d6b8d4 100644
--- a/src/tests/slave_recovery_tests.cpp
+++ b/src/tests/slave_recovery_tests.cpp
@@ -2339,7 +2339,7 @@ TYPED_TEST(SlaveRecoveryTest, SchedulerFailover)
.WillOnce(FutureArg<1>(&offers2))
.WillRepeatedly(Return()); // Ignore subsequent offers.
- // Kill the task.
+ // Kill the task.
driver2.killTask(task.task_id());
// Wait for TASK_KILLED update.
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1402733/support/cpplint.patch
----------------------------------------------------------------------
diff --git a/support/cpplint.patch b/support/cpplint.patch
index 63b5ae9..4f1ec66 100644
--- a/support/cpplint.patch
+++ b/support/cpplint.patch
@@ -1,5 +1,5 @@
---- support/cpplint.py 2014-03-14 14:44:03.077741545 -0700
-+++ support/cpplint.py2 2014-03-14 14:53:33.053733284 -0700
+--- support/cpplint.py.orig 2014-05-01 18:17:51.480890494 -0700
++++ support/cpplint.py 2014-05-01 18:20:52.068887876 -0700
@@ -28,6 +28,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -27,7 +27,30 @@
def ParseNolintSuppressions(filename, raw_line, linenum, error):
"""Updates the global list of error-suppressions.
-@@ -3400,7 +3402,7 @@
+@@ -1993,11 +1995,9 @@
+ if access_match:
+ classinfo.access = access_match.group(2)
+
+- # Check that access keywords are indented +1 space. Skip this
+- # check if the keywords are not preceded by whitespaces.
++ # Check that access keywords are not indented.
+ indent = access_match.group(1)
+- if (len(indent) != classinfo.class_indent + 1 and
+- Match(r'^\s*$', indent)):
++ if (len(indent) != classinfo.class_indent):
+ if classinfo.is_struct:
+ parent = 'struct ' + classinfo.name
+ else:
+@@ -2006,7 +2006,7 @@
+ if access_match.group(3):
+ slots = access_match.group(3)
+ error(filename, linenum, 'whitespace/indent', 3,
+- '%s%s: should be indented +1 space inside %s' % (
++ '%s%s: should not be indented inside %s' % (
+ access_match.group(2), slots, parent))
+
+ # Consume braces or semicolons from what's left of the line
+@@ -3400,7 +3400,7 @@
# Check if the line is a header guard.
is_header_guard = False
@@ -36,7 +59,7 @@
cppvar = GetHeaderGuardCPPVariable(filename)
if (line.startswith('#ifndef %s' % cppvar) or
line.startswith('#define %s' % cppvar) or
-@@ -3867,7 +3869,7 @@
+@@ -3867,7 +3867,7 @@
error(filename, linenum, 'runtime/init', 4,
'You seem to be initializing a member variable with itself.')
@@ -45,7 +68,7 @@
# TODO(unknown): check that 1-arg constructors are explicit.
# How to tell it's a constructor?
# (handled in CheckForNonStandardConstructs for now)
-@@ -4011,7 +4013,7 @@
+@@ -4011,7 +4011,7 @@
# Check for use of unnamed namespaces in header files. Registration
# macros are typically OK, so we allow use of "namespace {" on lines
# that end with backslashes.
@@ -54,7 +77,7 @@
and Search(r'\bnamespace\s*{', line)
and line[-1] != '\\'):
error(filename, linenum, 'build/namespaces', 4,
-@@ -4552,7 +4554,7 @@
+@@ -4552,7 +4552,7 @@
CheckForCopyright(filename, lines, error)
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1402733/support/cpplint.py
----------------------------------------------------------------------
diff --git a/support/cpplint.py b/support/cpplint.py
index 2ad644e..90aa4ba 100644
--- a/support/cpplint.py
+++ b/support/cpplint.py
@@ -1995,11 +1995,9 @@ class _NestingState(object):
if access_match:
classinfo.access = access_match.group(2)
- # Check that access keywords are indented +1 space. Skip this
- # check if the keywords are not preceded by whitespaces.
+ # Check that access keywords are not indented.
indent = access_match.group(1)
- if (len(indent) != classinfo.class_indent + 1 and
- Match(r'^\s*$', indent)):
+ if (len(indent) != classinfo.class_indent):
if classinfo.is_struct:
parent = 'struct ' + classinfo.name
else:
@@ -2008,7 +2006,7 @@ class _NestingState(object):
if access_match.group(3):
slots = access_match.group(3)
error(filename, linenum, 'whitespace/indent', 3,
- '%s%s: should be indented +1 space inside %s' % (
+ '%s%s: should not be indented inside %s' % (
access_match.group(2), slots, parent))
# Consume braces or semicolons from what's left of the line
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1402733/support/mesos-style.py
----------------------------------------------------------------------
diff --git a/support/mesos-style.py b/support/mesos-style.py
index 4649edb..d404432 100755
--- a/support/mesos-style.py
+++ b/support/mesos-style.py
@@ -16,6 +16,7 @@ active_rules = ['build/class',
'whitespace/comma',
'whitespace/ending_newline',
'whitespace/forcolon',
+ 'whitespace/indent',
'whitespace/tab',
'whitespace/todo']