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 99073200B48 for ; Mon, 18 Jul 2016 19:10:48 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 978AD160A65; Mon, 18 Jul 2016 17:10:48 +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 BA1B0160A5D for ; Mon, 18 Jul 2016 19:10:47 +0200 (CEST) Received: (qmail 76696 invoked by uid 500); 18 Jul 2016 17:10:41 -0000 Mailing-List: contact dev-help@nifi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@nifi.apache.org Delivered-To: mailing list dev@nifi.apache.org Received: (qmail 76685 invoked by uid 99); 18 Jul 2016 17:10:41 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jul 2016 17:10:41 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 4582EC0376 for ; Mon, 18 Jul 2016 17:10:41 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.299 X-Spam-Level: * X-Spam-Status: No, score=1.299 tagged_above=-999 required=6.31 tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id kSPkKk5zEivH for ; Mon, 18 Jul 2016 17:10:39 +0000 (UTC) Received: from mail-pf0-f182.google.com (mail-pf0-f182.google.com [209.85.192.182]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 9185E60D3D for ; Mon, 18 Jul 2016 17:10:38 +0000 (UTC) Received: by mail-pf0-f182.google.com with SMTP id x72so7269415pfd.2 for ; Mon, 18 Jul 2016 10:10:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date :message-id:references:to; bh=Qk/b9ddyHw2DjkWiQEuET7M2UYxA3amBlSVNo1kB1L8=; b=hJRXtWgeHdA3ehtliTSYFkdKiJ9akK41fJFKr+sUEMpuypYwaI3vjd1eil7F0jX0dy eOsAAjRBEiWA6C4LBuojlNrR9WfWAjwuvZOChW8RR6Z5OHQgFEPu1hkuyEsErIi8VjCS z4IQE2wQmF7e38hHxhvxp4rukYLVq/8uL5L9HsYhztquZ7bmTMfXVeuYsuE6pJJAkjDk VvYBjD8bpYNjdBQnQS4RdLHwvBH48jnJ1aHld5H84Wpuo+rMZrxxhZUalyaEghYmSBxS /f+EjvH5sYnI7K6tFany+odPB08kVLftocm/lPJOuVh+2pvxjwABakXl6C9L6k4zLhRH xM9w== X-Gm-Message-State: ALyK8tKP9lAQzoA++I6w+FlnfY3SZ4tz1I8n4tJgb7tLUfeqoCWo6aSyTdizmaMMDlQNrw== X-Received: by 10.66.233.38 with SMTP id tt6mr57092404pac.99.1468861830761; Mon, 18 Jul 2016 10:10:30 -0700 (PDT) Received: from [192.168.1.3] (cpe-172-91-141-241.socal.res.rr.com. [172.91.141.241]) by smtp.gmail.com with ESMTPSA id 84sm6341577pfp.59.2016.07.18.10.10.28 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Jul 2016 10:10:29 -0700 (PDT) Content-Type: multipart/signed; boundary="Apple-Mail=_6BB12559-5E27-4166-9CF5-D3AACA3DC017"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: ExecuteScript and flowfiles X-Pgp-Agent: GPGMail From: Andy LoPresto In-Reply-To: <1468859447.85620.YahooMailAndroidMobile@web28704.mail.ir2.yahoo.com> Date: Mon, 18 Jul 2016 10:10:30 -0700 Message-Id: References: <1468859447.85620.YahooMailAndroidMobile@web28704.mail.ir2.yahoo.com> To: dev@nifi.apache.org X-Mailer: Apple Mail (2.3124) archived-at: Mon, 18 Jul 2016 17:10:48 -0000 --Apple-Mail=_6BB12559-5E27-4166-9CF5-D3AACA3DC017 Content-Type: multipart/alternative; boundary="Apple-Mail=_E4FF24AC-3D7B-456F-888C-4F02247A8724" --Apple-Mail=_E4FF24AC-3D7B-456F-888C-4F02247A8724 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 Dave, Either option is plausible, but the first is probably preferable. I = would recommend the Python script should add an attribute to each = flowfile with some flag or indicator (i.e. which virtual relationship it = would follow) and have a single connection out of the ExecuteScript = processor for success connected to a RouteOnAttribute processor. This = processor is designed to have multiple outgoing connections and will = route the incoming flowfiles based on attributes, as the name would = indicate. Doing this the second way would require additional coding in the Python = script to reference new relationships, and this can be tricky. Matt Burgess has some good examples of using Python scripts in the = ExecuteScript processor on his blog [1]. [1] = https://funnifi.blogspot.com/2016/03/executescript-json-to-json-revisited_= 14.html = Andy LoPresto alopresto@apache.org alopresto.apache@gmail.com PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4 BACE 3C6E F65B 2F7D EF69 > On Jul 18, 2016, at 9:30 AM, DAVID SMITH = wrote: >=20 > Hi >=20 > I have a question from a colleague who is using nifi 0.5.1, he has = some files coming in which he needs to break up into 3 constituent = parts. > He has a python script which should do this but what he wants to know = is can he either >=20 > 1) send all three parts down one relationship as three separate = flowfiles, from his python script, or > 2) can he create three relationships from within his python script, to = send a flowfile down each? >=20 > Does anyone have any examples of doing either option or can advise how = to do this. >=20 > Many thanks > Dave >=20 > Sent from Yahoo! Mail on Android >=20 --Apple-Mail=_E4FF24AC-3D7B-456F-888C-4F02247A8724 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=iso-8859-1 Dave,

Either option is plausible, but the first is probably = preferable. I would recommend the Python script should add an attribute = to each flowfile with some flag or indicator (i.e. which virtual = relationship it would follow) and have a single connection out of the = ExecuteScript processor for success connected to a RouteOnAttribute = processor. This processor is designed to have multiple outgoing = connections and will route the incoming flowfiles based on attributes, = as the name would indicate. 

Doing this the second way would require = additional coding in the Python script to reference new relationships, = and this can be tricky. 

Matt Burgess has some good examples of = using Python scripts in the ExecuteScript processor on his blog = [1]. 



Andy = LoPresto
PGP Fingerprint: 70EC = B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

On Jul 18, 2016, at 9:30 AM, DAVID SMITH <davidrsmith@btinternet.com> wrote:

Hi

I have a question from a colleague who is = using nifi 0.5.1, he has some files coming in which he needs to break up = into 3 constituent parts.
He has a python script which = should do this but what he wants to know is can he either

1)   send all three parts down one = relationship as three separate flowfiles, from his python script, or
2) can he create three relationships from within his python = script, to send a flowfile down each?

Does = anyone have any examples of doing either option or can advise how to do = this.

Many thanks
Dave

Sent from Yahoo! Mail on Android


= --Apple-Mail=_E4FF24AC-3D7B-456F-888C-4F02247A8724-- --Apple-Mail=_6BB12559-5E27-4166-9CF5-D3AACA3DC017 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJXjQ2HAAoJEDxu9lsvfe9piK8P/2JpV+KPwTnQOhEsRQLhgf+1 dGN79AvWm9WvCpRSNUuMh3Tfw779vykFrcBNS4dxTxtsxOKlGS2kL3s37GlIKTXh 2VtIExG/gwJRPxaROX+FGzFVyyvJ9ircvQZeXHgC5tD9mblyL009bo5ZrUjgmMGu R7LDhKdDFF6nVLqJ/KOr/0ATHDBOWqpe0CD/aopfW9ZoUwdsrdJ77nliLrvOxSzK ga0h2D/UrNW1Z/002BL3+Yn3w8autX7feCXTMt9Bq2UVjBTfaSCGJ0d5g/A6w9ei NwJA2S4RRzB8Jz7UavFEPZ1ujrb3mM7UoCFPDruRgTraMaZkzlZI/OIWw1yChTp2 CYA2JhnHoes3/g/vEmTbL+qimAU4idRDIa4yherXSxTWjwYypNMUkaGkA0Hg149Y qpar1Xb+popl+LVSz52sACWiEqrWPAjK/HwzcQXIVowAHkyDC1UF2jq739eCVszQ Jt47NeR/f4SW0pdwsPKKtvNwNil7Ehvq/9sAbfCelkI2Kvydb79TCTy+MUje30aF dHIGH6Ma6lFZTojlbDUIxYVZa3Y8tQKY+wpx1AMCcayJmtTX6hdoq2+UWTDb9db7 g0nDwmS2dWhWcQrT6nop6x6ipHzPAz6hg4Dv0KNrN3DI/e4ZC0ZevbpO2tHnVt1v +U0F4LYlvSHQLUdgVXjx =rtl4 -----END PGP SIGNATURE----- --Apple-Mail=_6BB12559-5E27-4166-9CF5-D3AACA3DC017--