So I'm a little late to the party here, but I have had success using
ExceuteScript processors which are using the Facebook Marketing API,
which in turn references requests.
All I had to do was install the appropriate libraries using `pip` in the
system site-packages directory (`sudo pip install xxx`) and then add the
system's site-packages directory in the "Module Directory" property of
ExecuteScript:
Script Engine: python
Script File: /path/to/my_script_filename.py
Script Body: (empty)
Module Directory: /usr/lib/python2.7/site-packages
I don't remember doing anything special beyond this to get it to work.
Am I just lucky?
- Scott
Mike Harding <mailto:[email protected]>
Saturday, May 6, 2017 5:41 AM
..just to follow up @Andre - your solution worked for me - thankyou.
Mike
Mike Harding <mailto:[email protected]>
Saturday, May 6, 2017 5:22 AM
Thanks for all the suggestions. Regards using Groovy I did try and use
it to solve my problem but just couldn't get it to work correctly. I
tried to implement something similar to the following solution given
here
(http://stackoverflow.com/questions/24827855/groovy-httpbuilder-issues-with-cookies)
to address a cookie authentication issue but the cookie didn't seem to
attach/work with follow-on requests and still gave me 401 but I
managed to get something working in python hence why I was trying to
use that.
I'm wondering whether I should just use
ExecuteProcess/ExecuteStreamCommand as a quick fix?
Mike
Giovanni Lanzani <mailto:[email protected]>
Saturday, May 6, 2017 3:29 AM
Please do not remove the Python scripting facilities.
I believe most people experience it as very slow because (ok, Python
is slow) they only get a flow file at a time.
I think Matt pointed out in this ML once that you can use
flowfiles = session.get(1000)
for flowfile in filter(None, flowfiles):
# do things
In that case Jython will be kept alive much longer. Or am I missing
something?
Giovanni
Joe Witt <mailto:[email protected]>
Friday, May 5, 2017 6:12 PM
It is worth discussing whether there is sufficient value to warrant
keeping jython/python support in the processors or whether we should
pull it. It is certainly something we can document as being highly
limited but we don't really know how limited. Frankly given the
performance I've seen with it I'd be ok removing it entirely. One is
better off calling the script via a system call. Groovy is one that
I've seen perform very well and be fully featured.
Russell Bateman <mailto:[email protected]>
Friday, May 5, 2017 5:38 PM
We really want to use /ExecuteScript/ because our end users are
Pythonistas. They tend to punctuate their flows with the equivalent of
/PutFile/ and /GetFile/ with Python scripts doing stuff on flowfiles
that pass out of NiFi before returning into NiFi.
However, we find it nearly impossible to replace even the tamest of
undertakings. If there were a good set of NiFi/Python shims that, from
PyCharm, etc., gave us the ability to prototype, test and debug before
copying and pasting into /ExecuteScript/, that would be wonderful. It
hasn't worked out that way. Most of our experience is copying, pasting
into the processor property, only to find something wrong, sometimes
syntax, sometimes something runtime.
On their behalf, I played with this processor a few hours a while
back. Another colleague too. Googling this underused tool hasn't been
helpful, so the overall experience is negative so far. I can get most
of the examples out there to work, but as soon as I try to do "real"
work from my point of view, my plans sort of cave in.
Likely the Groovy and/or Ruby options are better? But, we're not
Groovy or Ruby guys here. I understand the problems with this tool and
so I understand what the obstacles are to it growing stronger. The
problems won't yield to a few hours one Saturday afternoon. Better
problem-logging underneath and better- and more lenient Python support
on top. The second one is tough, though.
My approach is to minimize those black holes these guys put into their
flows by creating custom processors for what I can't solve using
standard processors.
Trying not to be too negative here...
On 05/05/2017 04:09 PM, Andre wrote: