> On Jan. 28, 2014, 3:32 a.m., Bill Farner wrote: > > src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java, > > line 384 > > <https://reviews.apache.org/r/17430/diff/1/?file=451962#file451962line384> > > > > Thinking out loud, a helper function reduces some duplication, and > > wrapping in a HashMultimap puts the values in a Set for you (so you can > > skip the ImmutableSet.copyOf later): > > > > private static <T> Multimap<String, IJobKey> mapByRole( > > Iterable<T> entities, > > Function<T, IJobKey> keyExtractor) { > > > > return HashMultimap.create( > > Multimaps.index(Iterables.transform(tasks, keyExtractor))); > > } > > > > Then, your calling code is: > > > > Multimap<String, IJobKey> jobsByRole = mapByRole( > > Storage.weaklyConsistentFetchTasks(storage, Query.unscoped()), > > Tasks.SCHEDULED_TO_JOB_KEY); > > Multimap<String, IJobKey> cronJobsByRole = > > mapByRole(cronJobManager.getJobs(), JobKeys.FROM_CONFIG); > > > > (note: you'll want to tweak line wrapping, trying to make it pretty in > > the comment box here)
Done. Changed Multimaps.index(Iterables.transform(tasks, keyExtractor))); to Multimaps.index(Iterables.transform(tasks, keyExtractor), JobKeys.TO_ROLE)); to match the signature. > On Jan. 28, 2014, 3:32 a.m., Bill Farner wrote: > > src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java, > > line 1112 > > <https://reviews.apache.org/r/17430/diff/1/?file=451963#file451963line1112> > > > > Does this test reproduce the bug? I would have expected to see > > something like two tasks in the same job resulting in a job count of 1. Good catch. I added the task, but it got lost among other fixes. Fixed it now. - Suman ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/17430/#review32945 ----------------------------------------------------------- On Jan. 28, 2014, 8:51 p.m., Suman Karumuri wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/17430/ > ----------------------------------------------------------- > > (Updated Jan. 28, 2014, 8:51 p.m.) > > > Review request for Aurora, Kevin Sweeney and Bill Farner. > > > Bugs: AURORA-116 > https://issues.apache.org/jira/browse/AURORA-116 > > > Repository: aurora > > > Description > ------- > > Updated test cases to catch this bug. > > > Diffs > ----- > > > src/main/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterface.java > cf9099f307efa23ca34634e3512d9cdbebfa82f2 > src/main/thrift/org/apache/aurora/gen/api.thrift > 74010379baa2e47cefc228943f766c7b3a8b0d97 > > src/test/java/org/apache/aurora/scheduler/thrift/SchedulerThriftInterfaceTest.java > 6cefdfad469a9b69a5291ad46be1df14b443472e > src/test/resources/org/apache/aurora/gen/api.thrift.md5 > 42fdca2759f15d007bee058485c237268c57597a > > Diff: https://reviews.apache.org/r/17430/diff/ > > > Testing > ------- > > gradle clean build > gradle run - tested in local UI. > > > Thanks, > > Suman Karumuri > >