Good afternoon. I have a python script I would like to run from
ExecuteScript. Since my script can run from either a command line in debug
mode or from the ES processor, I'd like to set up initial logic to
determine which command line parms i have, and direct actions in the script
accordingly.

At the command line I'll execute like this:  myScript.py [configFile_nifi]
[loggingOutput as either of NIFI | SCRIPT] - two arguments.

>From Matt B's helpful post here...
https://community.hortonworks.com/articles/77739/executescript-cookbook-part-3.html
...I know that I can feed the script these arguments from ExecuteScript by
creating two new properties within ExecuteScript and setting their values.
In the script I can read those into the script like this:
configFile = configFile_nifi.getValue()
targetOutput = loggingOutput.getValue()

But i need to read these arguments in one way if they are from the command
line, and using the above syntax if they are from the ExecuteScript call of
the script. If set by the NiFi ES processor, can i refer to these parms as
len(sys.argv), sys.argv[1], and sys.argv[2]?

If not, how can I direct the setting of my script variables based on
whether the arguments come from the command line or from the NiFi processor
configuration?

Jim

Reply via email to