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 44D092009F9 for ; Mon, 23 May 2016 17:52:41 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 43B17160A0E; Mon, 23 May 2016 15:52:41 +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 8BBB8160A05 for ; Mon, 23 May 2016 17:52:40 +0200 (CEST) Received: (qmail 22070 invoked by uid 500); 23 May 2016 15:52:39 -0000 Mailing-List: contact user-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@flink.apache.org Delivered-To: mailing list user@flink.apache.org Received: (qmail 22060 invoked by uid 99); 23 May 2016 15:52:39 -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, 23 May 2016 15:52:39 +0000 Received: from mail-vk0-f54.google.com (mail-vk0-f54.google.com [209.85.213.54]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 619351A0098 for ; Mon, 23 May 2016 15:52:39 +0000 (UTC) Received: by mail-vk0-f54.google.com with SMTP id r140so50670582vkf.0 for ; Mon, 23 May 2016 08:52:39 -0700 (PDT) X-Gm-Message-State: AOPr4FWcWtYdRBY9W6Y342bnAOd5jUAyBL7scTdBul3d0ssBmkJgkXrUq4dOz4riKkB/t7ZZi4BswSPKaXB/BT34 X-Received: by 10.159.32.131 with SMTP id 3mr10010170uaa.75.1464018758474; Mon, 23 May 2016 08:52:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.67.227 with HTTP; Mon, 23 May 2016 08:52:19 -0700 (PDT) In-Reply-To: References: <9953CDAB-0EDD-46CA-9201-0F5C3DE0217A@soom-it.ch> From: Maximilian Michels Date: Mon, 23 May 2016 17:52:19 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Import Configuration File in Flink Cluster To: "user@flink.apache.org" Content-Type: text/plain; charset=UTF-8 archived-at: Mon, 23 May 2016 15:52:41 -0000 Hi Simon, AFAIK this is the way to go. We could add a method to the ParameterTool which loads from a resource to make it more convenient. Cheers, Max On Mon, May 23, 2016 at 4:42 PM, simon peyer wrote: > Hi > > @Max > So for each file in the src/main/resources folder, I first have to create a > new file, copy the file from the resources folder to this new file and then > I'm able to parse it? > > @Stefano > I think the files in src/main/resources are integrated automatically right? > Or am I missing something? > > Cheers > Simon > > > On 23 May 2016, at 16:30, Stefano Baghino > wrote: > > Are you using Maven to package your project? I believe the resources > plugin[1] can suit your needs. > > [1]: > http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html > > > On 23 May 2016, at 16:28, Maximilian Michels wrote: > > Hi Simon, > > You'll have to write the property file to disk first to load it using > the ParameterTool.fromPropertiesFile method. > > For example: > > // copy config from Java resource to a file > File configOnDisk = new File("/path/to/config.properties"); > Files.copy(getClass.getClassLoader.getResourceAsStream("config.properties"), > configOnDisk.toPath()); > // load the new file > ParameterTool.fromPropertiesFile(configOnDisk); > > > Cheers, > Max > > > > On Mon, May 23, 2016 at 3:56 PM, simon peyer wrote: >> >> Hi together >> >> Currently I'm using flink on a docker cluster on AWS. >> I would like to use property files with the integrated >> ParameterTool.fromPropertiesFile function of Flink. >> >> Locally this version works absolutely fine: >> val configuration = >> ParameterTool.fromPropertiesFile("src/main/resources/config.properties") >> >> But on the cluster this didn't work, so we introduced this version, which >> also doesn't work: >> >> val baseParameters = >> ParameterTool.fromPropertiesFile(getClass.getClassLoader.getResource("config.properties").getFile) >> >> gives >> >> java.io.FileNotFoundException: Properties file >> file:/tmp/flink-web-upload-57bcc912-bc98-4c89-b5ee-c5176155abd5/992186c1-b3c3-4342-a5c8-67af133155e4pipeline-0.1.0-all.jar!/config.properties >> does not exist >> >> The property file is located in src/main/resources. >> Do you have any idea of how to integrate such property files into the jar >> package? >> >> -Thanks >> Simon > > > > > -- > BR, > Stefano Baghino > > Software Engineer @ Radicalbit > >