Return-Path: X-Original-To: apmail-apex-dev-archive@minotaur.apache.org Delivered-To: apmail-apex-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 9699A19FD0 for ; Thu, 28 Apr 2016 18:23:38 +0000 (UTC) Received: (qmail 12776 invoked by uid 500); 28 Apr 2016 18:23:38 -0000 Delivered-To: apmail-apex-dev-archive@apex.apache.org Received: (qmail 12705 invoked by uid 500); 28 Apr 2016 18:23:38 -0000 Mailing-List: contact dev-help@apex.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@apex.incubator.apache.org Delivered-To: mailing list dev@apex.incubator.apache.org Received: (qmail 12693 invoked by uid 99); 28 Apr 2016 18:23:38 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Apr 2016 18:23:38 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id B6B14C03DB for ; Thu, 28 Apr 2016 18:23:37 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.279 X-Spam-Level: * X-Spam-Status: No, score=1.279 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-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: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=datatorrent-com.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id MGL95FZgeb8d for ; Thu, 28 Apr 2016 18:23:35 +0000 (UTC) Received: from mail-qk0-f178.google.com (mail-qk0-f178.google.com [209.85.220.178]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 291BF5F241 for ; Thu, 28 Apr 2016 18:23:35 +0000 (UTC) Received: by mail-qk0-f178.google.com with SMTP id r184so35591861qkc.1 for ; Thu, 28 Apr 2016 11:23:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datatorrent-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=aKYiWh+Dz/m+Km/LGrz3XksD8euYFx29HFR/9REZ2Fc=; b=PInHTciBaxFzgqNfJHc98Q+qxEFJg92URJBACsd1sCvLTvC83zgpaEufQSvnq5RyMV Nu5W3XWImD2u7q31xSiXBlpE9GbbRHaP05cj8k1cAd/GKVTFcvdR0luGvBhAO+w/uyCR wW2EWV26+AWKIX+hzyj2RrDm7HvjZJgS4Df9uER/3wSJ7ZujnKMsoptbt7ASeqlv5an1 0fCX2pPP6Ff84xA7rCWt4X8Kp9ZBfQbP6SmGleCFkygrzhTOBL8YqSBxPfpxoFdZOAke k1eg6q0Aq3/Kpw1I/efsF6woQGLd5G0UxVZoTaLkEUnlzJJkviNYu6fjXA96IEaJ6Q2C iZVw== 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=aKYiWh+Dz/m+Km/LGrz3XksD8euYFx29HFR/9REZ2Fc=; b=ZrWsI0fQuVBukQhTaX3eC6D57rW/P82i6qP6pb02iEprZBOwMgBQzrtM+mYNqfv5Gb BITH8irPC3om2qBFJsQ+XJrG7nw3hxtrzfmBcMGimgM96CvN5QD504bjLePAKziBOA29 nQ5AkyXvvPGauQ9GWfsFYpLrAoUUsEKUjnVTau11qvY4LSePwaw7oEqVTXuXCJbtRQ8u RCWTtA2Tg/RJbE70e5UFvI5i1ae5ZmkuadS+J+403mlx0Izfdha+PdHetdlq/TYK7391 zURsmfgize0UClXtvX9qrKLAM+gvJwCnv73rVjpNZht0rTxE3iLKHGrJtuyZ4S6qon+Q lG3Q== X-Gm-Message-State: AOPr4FWQwYEFMEe7dmfopoadDI5FxvjB6tDEqDlDZe88+tgTIkdUm5LS/4Om5kEFdVoCdr/2JYhleoHX1a+NIm7l MIME-Version: 1.0 X-Received: by 10.55.88.5 with SMTP id m5mr15768007qkb.134.1461867814500; Thu, 28 Apr 2016 11:23:34 -0700 (PDT) Received: by 10.237.35.88 with HTTP; Thu, 28 Apr 2016 11:23:34 -0700 (PDT) In-Reply-To: References: <3373380032047352570@unknownmsgid> Date: Thu, 28 Apr 2016 23:53:34 +0530 Message-ID: Subject: Re: [APEXCORE-107] Adding modules in DAG through property and json file. From: Tushar Gosavi To: dev@apex.incubator.apache.org Content-Type: multipart/alternative; boundary=94eb2c0bacb0cadde505318f9f0d --94eb2c0bacb0cadde505318f9f0d Content-Type: text/plain; charset=UTF-8 Hi Thomas, I have updated existing PR with new changes. Regards, -Tushar. On Thu, Apr 28, 2016 at 7:08 PM, Thomas Weise wrote: > Tushar, > > You can replace the existing PR. > > Thanks > > -- > sent from mobile > On Apr 27, 2016 11:57 PM, "Tushar Gosavi" wrote: > > > Hi Pramod, > > > > Do you want me to close the current pull request, and open a new pull > > request with this change? > > > > - Tushar. > > > > > > On Thu, Apr 28, 2016 at 11:46 AM, Pramod Immaneni < > pramod@datatorrent.com> > > wrote: > > > > > Tushar, > > > > > > Can you create an alternate pull request with this change. > > > > > > Thanks > > > > > > > On Apr 26, 2016, at 1:09 PM, Tushar Gosavi > > > wrote: > > > > > > > > Hi All, > > > > > > > > We could achieve this by adding a common interface between Operator > and > > > > Module without backward compatibility issue. I did a quick prototype > > with > > > > this approach and was able to run > > > > PiDemo application from Malhar built against previous version of > Apex. > > > With > > > > this changes > > > > module writer don't have to override lifecycle methods required by > > > Operator. > > > > > > > > Let me know if this approach is workable. I will update the pull > > request > > > > #313 with more polished > > > > changes. > > > > > > > > Regards, > > > > - Tushar. > > > > > > > > > > > > On Wed, Apr 6, 2016 at 1:52 AM, Tushar Gosavi < > tushar@datatorrent.com> > > > > wrote: > > > > > > > >> Hi Thomas, > > > >> > > > >> I agree with you that module is a composite operator except its not > > > >> present at the execution time. Actually I feel that there should be > > > another > > > >> Interface `Node` which specifies a node in the DAG, from which > > Operator > > > and > > > >> Module interfaces are extended. This way we may support > transformation > > > at > > > >> logicalPlan level in future. Adding this will break the > compatibility > > > with > > > >> current code. Hence my suggestion was to extend Module form Operator > > as > > > it > > > >> is considered as composite operator. > > > >> > > > >> Another motivation is avoid code duplication and work duplication to > > > >> support modules in json format, in high level api or new future > api's > > > that > > > >> will support adding module and operator to DAG. > > > >> > > > >> Currently we extract the port information using reflection, which > can > > > work > > > >> regardless of interface hierarchy, but meta object associated with > > Port > > > has > > > >> reference to OperatorMeta. Changing it would result in many changes > in > > > >> LogicalPlan without any common interface. > > > >> > > > >> Thanks, > > > >> -Tushar. > > > >> > > > >> > > > >> On Tue, Mar 29, 2016 at 8:37 PM, Thomas Weise < > thomas@datatorrent.com > > > > > > >> wrote: > > > >> > > > >>> Tushar, > > > >>> > > > >>> I agree with the motivation of #2 but not with the specific changes > > you > > > >>> suggest. "Module" is a composite operator from a users perspective, > > but > > > >>> the > > > >>> operator interface defines callbacks for the execution layer that > are > > > not > > > >>> applicable to "Module". > > > >>> > > > >>> Also, ports are fields, they can be discovered regardless of > > interface > > > >>> hierarchy. > > > >>> > > > >>> Thomas > > > >>> > > > >>> On Wed, Mar 23, 2016 at 3:55 AM, Tushar Gosavi < > > tushar@datatorrent.com > > > > > > > >>> wrote: > > > >>> > > > >>>> Hi All, > > > >>>> > > > >>>> I am planning provide support for adding modules into the json and > > > >>> property > > > >>>> file specification of DAG. We will go with the same syntax as > > > discussed > > > >>> in > > > >>>> following mail thread. > > > >>> > > > > > > https://mail-archives.apache.org/mod_mbox/incubator-apex-dev/201512.mbox/%3C565D0E2C.2000805%40datatorrent.com%3E > > > >>>> > > > >>>> > > > >>>> There are multiple choices for the design and I want some > suggestion > > > >>> from > > > >>>> the community aboutg how to go about adding this support. To > support > > > >>>> json/property format, Module should support following > functionality > > > >>>> - Property format uses setSource, addSink methods of StreamMeta, > > which > > > >>> were > > > >>>> not properly supported by Module. > > > >>>> - Module need capability of extracting port object given names. > > > Operator > > > >>>> provides this functionality through Operators.describe. > > > >>>> > > > >>>> Approach 1) > > > >>>> As module meta and operator meta shares common fields such as > name, > > > port > > > >>>> information. We can separate this out in a common class NodeMeta > and > > > >>> derive > > > >>>> OperatorMeta and ModuleMeta from it. This class will handle > > extracting > > > >>> port > > > >>>> information form the object. The changes involve are > > > >>>> - Split OperatorMeta object > > > >>>> - PortMeta objects will contain NodeMeta references than > > > >>> OperatorMeta, > > > >>>> in some places we will have to perform unchecked cast from > NodeMeta > > to > > > >>>> OperatorMeta. where code was expecting OperatorMeta from the > > > >>>> PortMeta. > > > >>>> - Support setSource and addSink methods. > > > >>>> - Change Operators.describe to accept Module or Operator and > > return > > > >>>> port mapping. > > > >>>> - Need instanceof call at few places to check if object is > Module > > > or > > > >>>> Operator, before calling specific API while working with property > > and > > > >>> json > > > >>>> file. > > > >>>> - change signature of few method which accepts Operator to > > Object. > > > >>> as > > > >>>> Module and Operator do not share a common parent but requires > > > >>>> common processing > > > >>>> - Replace OperatorMeta with NodeMeta in most of the classes. > > > >>>> > > > >>>> > > > >>>> Approach 2) > > > >>>> Make Module extends Operator and make ModuleMeta extends > > OperatorMeta. > > > >>> The > > > >>>> changes involved will be > > > >>>> - Change Module interface to extend Operator > > > >>>> - add support for setSource and addSink for Modules. > > > >>>> - addOperator will inspect type of object and call addModule if > > > >>> operator > > > >>>> is a module. > > > >>>> > > > >>>> Disadvantage > > > >>>> - This will break compatibility but this should not be a problem > as > > > >>> Module > > > >>>> is still an evolving API. > > > >>>> - Operator lifecyle methods will not get executed for module and > we > > > can > > > >>>> document this. > > > >>>> > > > >>>> Advantages > > > >>>> - This will avoid code duplication at multiple places where there > is > > > >>>> similarity between Module and Operator, and there is lot of > > similarity > > > >>>> while defining logical DAG. > > > >>>> - This will also automatically add support for Module in api being > > > >>>> developed for operator. For example high level api. > > > >>>> - This will make module and operator interchangeable in > application. > > > >>>> > > > >>>> I will prefer Approach 2. > > > >>>> > > > >>>> Regards, > > > >>>> -Tushar. > > > >> > > > >> > > > > > > --94eb2c0bacb0cadde505318f9f0d--