Return-Path: X-Original-To: apmail-reef-dev-archive@minotaur.apache.org Delivered-To: apmail-reef-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5FB2D18CD8 for ; Wed, 24 Feb 2016 23:40:31 +0000 (UTC) Received: (qmail 69268 invoked by uid 500); 24 Feb 2016 23:40:31 -0000 Delivered-To: apmail-reef-dev-archive@reef.apache.org Received: (qmail 69234 invoked by uid 500); 24 Feb 2016 23:40:31 -0000 Mailing-List: contact dev-help@reef.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@reef.apache.org Delivered-To: mailing list dev@reef.apache.org Received: (qmail 69218 invoked by uid 99); 24 Feb 2016 23:40:31 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Feb 2016 23:40:31 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 90C561804AB for ; Wed, 24 Feb 2016 23:40:30 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.72 X-Spam-Level: X-Spam-Status: No, score=-0.72 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=weimo-de.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id UEjlnGvgVDVB for ; Wed, 24 Feb 2016 23:40:29 +0000 (UTC) Received: from mail-ig0-f170.google.com (mail-ig0-f170.google.com [209.85.213.170]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id CAC655FAC9 for ; Wed, 24 Feb 2016 23:40:28 +0000 (UTC) Received: by mail-ig0-f170.google.com with SMTP id y8so2289751igp.1 for ; Wed, 24 Feb 2016 15:40:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=weimo-de.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=or+WuezyK1cYJUqmiRdMGvvtcApeMtPz3IpqqfxVrmI=; b=JCJt33sd3EbHCGyniVLsBB0U1CPXiE1POUiXB2/6OPXM7wEi5SACNiJKeibkMdTDRF XBsCeiWNRVGOTcvQh8uehrA6dmGx+dqqAbd0KZcH8fJSzHhyW/2WD/G2fFRYd87m5Kfl LiYd5h+OierVn8iMwHJ4Y7yKppn7okrYIrrbLtoYYXuWkzSWoGwynMMmdoHS48MydqUZ CKJlvu60JT0+mZRVTgryHLhVGCjG26ytFhMOBsJ5rAtQpSuPFjnN81XqzzwgBt63Pb3w CKdXXSUZCRYr738jvUu7/p2rK+oRQ8hQ2Yg6KdCSPADMtq47Nw/bpaBvDf+OOexGdnma Dkhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=or+WuezyK1cYJUqmiRdMGvvtcApeMtPz3IpqqfxVrmI=; b=SrQyrsazmJ7HMZmlgN2jvwH3EtOFAAR8YRIPL0aoazymnQO4SyWqLq9da/1/u2ALY3 4csJA7aqcvTSDEiZmDLwNtX/j5r+91zKNS8C2hZHlXMwusUCFG4ojIgoYD18lgQm8EAp kmZi9lZKpRE1q7PMDA3lBKxU8PP6orj3HGvaq1w2Cuv7ap1RDrgvhcmRI0O+tBSD7ESl LRN/pz/+DbTo5vzN4Opum5bEm3pkdCSDdJUwDVYQQNnuFZ6fuHmqkmgMbYuGrAUQahJ5 HJ8SZ+qd+ymjxrRWWN4g/JLJ1VQCHaYYA78D5mOhDI6h3muIzUIe2UwGrTnMWDrMrPHg oqlw== X-Gm-Message-State: AG10YOSQy3XzlEYizdN5VQtYRgzojMBik95PNhOcZ3kjd4NtVnxEjm7nTQ/0zGvbd/wUg3SEgO4ZN4O7KbgcWQ== X-Received: by 10.50.155.37 with SMTP id vt5mr362184igb.30.1456357228022; Wed, 24 Feb 2016 15:40:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.20.67 with HTTP; Wed, 24 Feb 2016 15:40:08 -0800 (PST) X-Originating-IP: [50.251.238.98] In-Reply-To: References: <56B0F0BB.9090503@weimo.de> <56C358B0.1040001@weimo.de> From: Markus Weimer Date: Wed, 24 Feb 2016 15:40:08 -0800 Message-ID: Subject: Re: REEF Services To: dev@reef.apache.org Content-Type: text/plain; charset=UTF-8 If we do that, we'd loose the flexibility of stacking contexts. In the current design, there is no difference between root and other contexts, which is more general. Markus On Wed, Feb 24, 2016 at 3:32 PM, Julia Wang (QIUHE) wrote: > We can have handlers attached to RootContext level so that they can be inherited by all the sub-contexts, and individual Context level handlers. How about: > > RootContextStart/StopHandler > ContextStart/StopHandler > > Thanks, > Julia > > -----Original Message----- > From: Markus Weimer [mailto:markus@weimo.de] > Sent: Wednesday, February 24, 2016 3:04 PM > To: dev@reef.apache.org > Subject: Re: REEF Services > > Yes, that could work. Especially for .NET,where we don't have a legacy problem with that. > > However, we still need two configurations: One which is inherited by sub-contexts and one which isn't. What would be good names for these? > > Markus > > On Wed, Feb 24, 2016 at 2:50 PM, Shravan Matthur Narayanamurthy wrote: >> How about we abandon the Service notion and use the ContextStart/Stop >> handlers for what we wanted to achieve with Services. If you want the >> functionality of a Service, when you configure the Context add all the >> configuration and also implement ContextStart/Stop handlers for >> implementing lifecycle of the Service with the required objects >> getting injected into the constructors of the Start handler. This is >> actually what I see in all the implementations I see today. >> --Shravan >> >> On Tue, Feb 16, 2016 at 9:13 AM, Markus Weimer wrote: >> >>> On 2016-02-12 11:40, Andrew Chung wrote: >>> >>>> My understanding is that they are just a set of injectable objects >>>> that don't necessarily have anything in common. >>>> >>> >>> Correct. That name is misleading, not my finest hour in naming things >>> :) As the introduction of Services pre-dates the Open Source release >>> of REEF, let me add a bit of back story: >>> >>> Services are meant to be the extension hooks the API of the Driver >>> and the Evaluators. Tang solves much of this, as one can just merge >>> `Configuration` for additional libraries to the Driver / Evaluator >>> `Configuration` and then depend on instances from those libraries. >>> >>> On the Driver, this is really all we need, as there is only one >>> Driver and the life cycle of the Service completely matches the one of the Driver. >>> >>> On the Evaluator, the story got more tricky: The Evaluator's life >>> cycle is decoupled from the Task life cycle. There is no guarantee >>> that subsequent Tasks will need the same Services. Some Services may >>> be detrimental to the performance of one Task, while required by another. >>> Think of caching layers which occupy lots of memory as an example. >>> Even worse, some Services are incompatible with one another (version hell). >>> Hence, we can't bind Services to the Evaluator's life cycle. >>> >>> But we can't bind them to the Task life cycle either: There is no >>> guarantee that subsequent Tasks on the same Evaluator do not need the >>> same Services either. And important state might be lost if we cleared >>> out the Services in between Tasks. >>> >>> Hence, we need a way to control the life cycle of these Services >>> independently of the Evaluator and the Task: Contexts. Mind you, >>> Services on the Evaluator are just what they are on the Driver: >>> injectable instances. >>> >>> However, we now need to control the singleton property of these objects. >>> Logically, a Service should be a singleton for the duration of a >>> Context. In order to make that happen, we need to instantiate them >>> before the Task gets instantiated. In order to do this, we need an >>> enumeration of the classes considered part of the Service, hence the >>> `ServiceConfiguration`: Its main purpose is to tell the Evaluator >>> which objects it shall instantiate before the Task and hang onto in >>> between tasks. That is the only thing distinguishing a Service from >>> any other injectable object. >>> >>> Long story short: There is no need for them to all implement a common >>> base interface. Or that need hasn't come up yet :) >>> >>> Markus >>>