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 3FF4119299 for ; Mon, 28 Mar 2016 17:01:35 +0000 (UTC) Received: (qmail 44404 invoked by uid 500); 28 Mar 2016 17:01:35 -0000 Delivered-To: apmail-apex-dev-archive@apex.apache.org Received: (qmail 44337 invoked by uid 500); 28 Mar 2016 17:01:35 -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 44326 invoked by uid 99); 28 Mar 2016 17:01:35 -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; Mon, 28 Mar 2016 17:01:35 +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 A8418CD0E0 for ; Mon, 28 Mar 2016 17:01:34 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.016 X-Spam-Level: X-Spam-Status: No, score=-3.016 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=2, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.996] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id yfgAKAv-nXxw for ; Mon, 28 Mar 2016 17:01:32 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 7725A5F572 for ; Mon, 28 Mar 2016 17:01:31 +0000 (UTC) Received: (qmail 44270 invoked by uid 99); 28 Mar 2016 17:01:30 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Mar 2016 17:01:30 +0000 Received: from mail-qg0-f54.google.com (mail-qg0-f54.google.com [209.85.192.54]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 5A60A1A0278 for ; Mon, 28 Mar 2016 17:01:30 +0000 (UTC) Received: by mail-qg0-f54.google.com with SMTP id c67so79887728qgc.1 for ; Mon, 28 Mar 2016 10:01:30 -0700 (PDT) X-Gm-Message-State: AD7BkJJCTULQCJgjvLZzBLaI60itxqaegg49uOd3WhCs730gb7Zj2Zpms5rIEnKKuMW4T+X8JXukHFroFb7a2E+i MIME-Version: 1.0 X-Received: by 10.140.39.138 with SMTP id v10mr36624898qgv.82.1459184489427; Mon, 28 Mar 2016 10:01:29 -0700 (PDT) Received: by 10.233.216.4 with HTTP; Mon, 28 Mar 2016 10:01:29 -0700 (PDT) Received: by 10.233.216.4 with HTTP; Mon, 28 Mar 2016 10:01:29 -0700 (PDT) In-Reply-To: References: Date: Mon, 28 Mar 2016 22:31:29 +0530 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [APEXCORE-107] Adding modules in DAG through property and json file. From: Chinmay Kolhatkar To: dev@apex.incubator.apache.org Content-Type: multipart/alternative; boundary=001a11c130ba278d7e052f1edd04 --001a11c130ba278d7e052f1edd04 Content-Type: text/plain; charset=UTF-8 +1 for approach 2. --- Sent from mobile. On 23 Mar 2016 4:25 p.m., "Tushar Gosavi" 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. > --001a11c130ba278d7e052f1edd04--