Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Process Group to hold several ExecuteScripts, and how to access them with Python.

Highlighted

Process Group to hold several ExecuteScripts, and how to access them with Python.

New Contributor

I have created a group with a couple of variables, each one has a script that does a specific job. ( In this case it uppercases the text )

107722-1554810027584.png


Each variable holds a Value like this :

107643-1554810143894.png


The Process inside the Group has the following configurations


107732-1554810206767.png


I'm making a reference to the PG variable, but i'm unsure about the Script Body, mine is

the following:


107723-1554810279115.png


The code is giving me an error. I'm stuck.


What am I doing wrong.

2 REPLIES 2
Highlighted

Re: Process Group to hold several ExecuteScripts, and how to access them with Python.

Super Guru

I don't think this is possible as written, as the PG variables are strings, but even with Jython "eval" it won't have access to the session, flow file(s), etc. Instead you could have a separate ExecuteScript instance for each script, then use routing logic or whatever to send the flow files to the appropriate script(s).

Re: Process Group to hold several ExecuteScripts, and how to access them with Python.

New Contributor

Thank you @Matt Burgess


What and what If I created an Attribute with the value of the PG variable and try to use that value inside a python function.

Like so,


107813-1554893557560.png


---------------------------


107792-1554893577677.png

My function receives a line from a csv ( coming from the flowfile ) and uppercases a specific column.

And I wanted to use the 'myFlowFileAttr' value ( created above ) has the argument 'c' from my function.

But it says "myAttr" is not defined.

Is it possible to do something like this?

TLDR: I want to create an Attribute and use its value with a function with ExecuteScript


107822-1554893602423.png

Don't have an account?
Coming from Hortonworks? Activate your account here