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 B307018E7A for ; Thu, 25 Feb 2016 00:14:47 +0000 (UTC) Received: (qmail 53200 invoked by uid 500); 25 Feb 2016 00:14:44 -0000 Delivered-To: apmail-reef-dev-archive@reef.apache.org Received: (qmail 53164 invoked by uid 500); 25 Feb 2016 00:14:44 -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 53152 invoked by uid 99); 25 Feb 2016 00:14:44 -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; Thu, 25 Feb 2016 00:14:44 +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 EB2F11805CE for ; Thu, 25 Feb 2016 00:14:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id W_rUYc3YccRi for ; Thu, 25 Feb 2016 00:14:41 +0000 (UTC) Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id 6E0D45F3A1 for ; Thu, 25 Feb 2016 00:14:24 +0000 (UTC) Received: by mail-wm0-f45.google.com with SMTP id g62so5597261wme.0 for ; Wed, 24 Feb 2016 16:14:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=qryGPNNvqJ7+aNtJi+oPbwywqUD2k68YQ4+0IKzWYEw=; b=RZ5CpAe63s6Kj7IrkR30bXyXgWRCOavgWs2MDSzRbcvK0A85wE9tvfvgvDmKFXYm19 k8GrC+FcQe6higdTwzUQi1RorCFgOFk0cQamYE+ABVA1fKEgmCnMyINBoKupUmQ1bN5Q 3E9g6beXm/LZ6qtyAkPnOLKrowuY8O0F9lrpOcKQHZfxMiMsC3xnL4g6D/PKUsoCM8HV rolXZDpWo5N1GndKwyw57RFAPwJXQsDkukQyR5XwRTxfEU/XKAUiTexLIDFX86YJHGDn O+57EtZ2HKvIel2VSBh7PnFWVRoNe5diaX+ZPJhkXB2BE0esAml6x01CyUu1zJ+HLy95 EflQ== 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:date :message-id:subject:from:to; bh=qryGPNNvqJ7+aNtJi+oPbwywqUD2k68YQ4+0IKzWYEw=; b=SkQk4lLPbwcZi0EGWqpjAckZinvhw/+kdPYXIBBofFwqFB7bX1j4fc8kjr3o7maBUq Q2n2YRg4nHAciq/iIiU3Oq2eMl1x7eX1pAorvzQO/vj0uPWNPh+PT7+fC9iZt837w13R AGDbZEHzmHqMNa/FO/W++zDlKZzJmHkacWyKCaUJzSbvv58vpgoRREuCP/abboL/4aju tKW9eFF/uXI8CeiCUwU5dl6Yp3RY/0hB/XGO0dwlG764qnFpArvInPiEk1vpdqwBqCNt TO78xfKCRZWI/hPFJOySU0N+FU5JZeseUuWDXf/OFSY978envTJ6C5RTvYLL9qdB8u9L NfuA== X-Gm-Message-State: AG10YORDmo7wNJDycJm/uohxHAWTNiKIW57z3HeSL43sVUcdk3vMX4KBkzp0K+Oyz/kmqF6fDGrN02f8Rwtk+Q== MIME-Version: 1.0 X-Received: by 10.28.188.195 with SMTP id m186mr246402wmf.64.1456359000978; Wed, 24 Feb 2016 16:10:00 -0800 (PST) Received: by 10.28.51.72 with HTTP; Wed, 24 Feb 2016 16:10:00 -0800 (PST) In-Reply-To: References: <56B0F0BB.9090503@weimo.de> <56C358B0.1040001@weimo.de> Date: Wed, 24 Feb 2016 16:10:00 -0800 Message-ID: Subject: Re: REEF Services From: Shravan Matthur Narayanamurthy To: dev@reef.apache.org Content-Type: multipart/alternative; boundary=001a114b0beceb3f52052c8d00f8 --001a114b0beceb3f52052c8d00f8 Content-Type: text/plain; charset=UTF-8 Why do we need this distinction? Can we not have only inherited? It will only be extra references anyway right? If there is some state in the your hierarchy that is not shared, it is not possible to get rid of the storage for that anyways. --Shravan On Wed, Feb 24, 2016 at 3:04 PM, Markus Weimer wrote: > 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 > >> > --001a114b0beceb3f52052c8d00f8--