Return-Path: X-Original-To: apmail-mesos-reviews-archive@minotaur.apache.org Delivered-To: apmail-mesos-reviews-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B9C3B1930C for ; Tue, 12 Apr 2016 09:41:18 +0000 (UTC) Received: (qmail 48810 invoked by uid 500); 12 Apr 2016 09:41:18 -0000 Delivered-To: apmail-mesos-reviews-archive@mesos.apache.org Received: (qmail 48779 invoked by uid 500); 12 Apr 2016 09:41:18 -0000 Mailing-List: contact reviews-help@mesos.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: reviews@mesos.apache.org Delivered-To: mailing list reviews@mesos.apache.org Received: (qmail 48760 invoked by uid 99); 12 Apr 2016 09:41:18 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Apr 2016 09:41:18 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id D48DE2AF9BB; Tue, 12 Apr 2016 09:41:14 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============5308852467496088829==" MIME-Version: 1.0 Subject: Re: Review Request 46044: Cleaned up c-tor signature in mesos-execute. From: Alexander Rukletsov To: Anand Mazumdar , Joseph Wu Cc: Mesos ReviewBot , Jojy Varghese , Alexander Rukletsov , mesos Date: Tue, 12 Apr 2016 09:41:14 -0000 Message-ID: <20160412094114.29094.28921@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org/ Auto-Submitted: auto-generated Sender: Alexander Rukletsov X-ReviewGroup: mesos X-Auto-Response-Suppress: DR, RN, OOF, AutoReply X-ReviewRequest-URL: https://reviews.apache.org/r/46044/ X-Sender: Alexander Rukletsov References: <20160411215347.29093.37873@reviews.apache.org> In-Reply-To: <20160411215347.29093.37873@reviews.apache.org> Reply-To: Alexander Rukletsov X-ReviewRequest-Repository: mesos --===============5308852467496088829== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit > On April 11, 2016, 9:53 p.m., Jojy Varghese wrote: > > src/cli/execute.cpp, line 196 > > > > > > I like the idea of simplifying the ctor. I am not too excited about the idea of moving everything to 'flag'. A `CommandScheduler` object should have some properties like `command`, `master`, `name`. Others like 'image' information should be moved to its own class/struct (say `ContainerInfo`). Just my 2 cents. > > Joseph Wu wrote: > I partially agree, but in this case, the `Flags` class is effectively the class/struct you're asking for. It just happens to have everything packed along with it :) > > Jojy Varghese wrote: > hmm i could extend that argument to get away with any type system or class design and replace all types with a `flag` type. Good design would allow translation between a user input (flag) to a CommandScheduler object. Passing a user input to CommandScheduler does not seem right. I think this was the reason the original author wanted input validation to happen before the object was created. CommandScheduler should only accept a strongly typed input in its ctor. I exceeded my 2 cents :| > > Joseph Wu wrote: > I agree about input validation. All our new code puts flag validation directly inside the flags. > i.e. https://github.com/apache/mesos/blob/master/src/master/flags.cpp#L420-L426 > > The existing error checking inside the `main` method should be moved into lambdas. At which point, passing `Flags` around would be equivalent to the previous explicit c-tor. We still validate flags in `main()` before we create an instance of `CommandScheduler`. Moving validations into lambdas makes sense. - Alexander ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/46044/#review128265 ----------------------------------------------------------- On April 11, 2016, 7:01 p.m., Alexander Rukletsov wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/46044/ > ----------------------------------------------------------- > > (Updated April 11, 2016, 7:01 p.m.) > > > Review request for mesos, Anand Mazumdar and Joseph Wu. > > > Repository: mesos > > > Description > ------- > > Pass complete `flags` instance rather than each flag value separately > to `CommandScheduler` in mesos-execute for brevity. > > > Diffs > ----- > > src/cli/execute.cpp 763dd26c359d1dd92c6e0365e4808b673efb1f40 > > Diff: https://reviews.apache.org/r/46044/diff/ > > > Testing > ------- > > On Mac OS 10.10.4: > make check > > Additionally manually tested mesos-execute with both responsive and unresponsive (https://github.com/rukletsov/unresponsive-process) tasks: > ./src/mesos-execute --master=127.0.0.1:5050 --name=test --command="sleep 10" --env='{"GLOG_v": "2"}' --kill_after=2secs > ./src/mesos-execute --master=127.0.0.1:5050 --name=test --command="/Users/alex/bin/unresponsive_process" --env='{"GLOG_v": "2"}' --kill_after=2secs > > > Thanks, > > Alexander Rukletsov > > --===============5308852467496088829==--