Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B1AFE200B66 for ; Thu, 4 Aug 2016 04:16:26 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B0464160A8C; Thu, 4 Aug 2016 02:16:26 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 02216160A86 for ; Thu, 4 Aug 2016 04:16:25 +0200 (CEST) Received: (qmail 64728 invoked by uid 500); 4 Aug 2016 02:16:25 -0000 Mailing-List: contact dev-help@apex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@apex.apache.org Delivered-To: mailing list dev@apex.apache.org Received: (qmail 64717 invoked by uid 99); 4 Aug 2016 02:16:25 -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, 04 Aug 2016 02:16:25 +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 B9B991812C0 for ; Thu, 4 Aug 2016 02:16:24 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.646 X-Spam-Level: X-Spam-Status: No, score=-4.646 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, 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=-1.426] autolearn=disabled Received: from mx1-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 EbTvjyyfDD7S for ; Thu, 4 Aug 2016 02:16:22 +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 7087B60D7A for ; Thu, 4 Aug 2016 02:16:21 +0000 (UTC) Received: (qmail 64704 invoked by uid 99); 4 Aug 2016 02:16:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Aug 2016 02:16:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 820C12C027F for ; Thu, 4 Aug 2016 02:16:20 +0000 (UTC) Date: Thu, 4 Aug 2016 02:16:20 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@apex.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (APEXCORE-448) Make operator name available in OperatorContext MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 04 Aug 2016 02:16:26 -0000 [ https://issues.apache.org/jira/browse/APEXCORE-448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15407004#comment-15407004 ] ASF GitHub Bot commented on APEXCORE-448: ----------------------------------------- Github user chandnisingh commented on a diff in the pull request: https://github.com/apache/apex-core/pull/364#discussion_r73453391 --- Diff: engine/src/test/java/com/datatorrent/stram/engine/OperatorContextTest.java --- @@ -0,0 +1,99 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.datatorrent.stram.engine; + +import java.util.Collection; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import org.junit.Assert; +import org.junit.Test; + +import org.apache.hadoop.conf.Configuration; + +import com.google.common.base.Preconditions; + +import com.datatorrent.api.AutoMetric; +import com.datatorrent.api.Context; +import com.datatorrent.api.DAG; +import com.datatorrent.api.DefaultOutputPort; +import com.datatorrent.api.InputOperator; +import com.datatorrent.api.LocalMode; +import com.datatorrent.api.StreamingApplication; +import com.datatorrent.common.util.BaseOperator; + +public class OperatorContextTest +{ + + @Test + public void testInjectionOfOperatorName() throws Exception + { + final LocalMode lma = LocalMode.newInstance(); + final CountDownLatch latch = new CountDownLatch(1); + StreamingApplication testApp = new StreamingApplication() + { + @Override + public void populateDAG(DAG dag, Configuration conf) + { + MockInputOperator input = dag.addOperator("input", new MockInputOperator()); + input.countDownLatch = latch; + GenericNodeTest.GenericOperator output = dag.addOperator("output", new GenericNodeTest.GenericOperator()); + + dag.addStream("stream", input.output, output.ip1); + } + }; + + lma.prepareDAG(testApp, new Configuration()); + LocalMode.Controller lc = lma.getController(); + lc.runAsync(); + latch.await(2, TimeUnit.SECONDS); + lc.shutdown(); + } + + private static class MockInputOperator extends BaseOperator implements InputOperator, AutoMetric.Aggregator + { + private transient CountDownLatch countDownLatch; + + @AutoMetric + String operatorName; + + public final transient DefaultOutputPort output = new DefaultOutputPort<>(); + + @Override + public void setup(Context.OperatorContext context) + { + operatorName = Preconditions.checkNotNull(context.getName(), "operator name"); --- End diff -- Yes, this line is still same that is why but the assignment is happening to a static variable. > Make operator name available in OperatorContext > ----------------------------------------------- > > Key: APEXCORE-448 > URL: https://issues.apache.org/jira/browse/APEXCORE-448 > Project: Apache Apex Core > Issue Type: Improvement > Reporter: Chandni Singh > Assignee: Chandni Singh > > Need name of the logical operator in the OperatorContext which can be used by WindowDataManager to create a unique path per logical operator . -- This message was sent by Atlassian JIRA (v6.3.4#6332)