I have an example (albeit a trivial one) of this in my ExecuteScript Cookbook post [1]. As far as a separate workaround, I can't tell from the description what you need to do differently than ListFile. It starts with no state, lists all the files, saves the time of the newest file in state, then only sends files in that directory with a timestamp later than the timestamp in state. Are you trying to store the current time in state, versus the time of the newest file?
Regards, Matt [1] https://community.hortonworks.com/articles/77739/executescript-cookbook-part-3.html On Fri, Oct 20, 2017 at 10:14 AM, James McMahon <[email protected]> wrote: > Does anyone have an example where setState and getState are called from a > python script? I need to run the script in an ExecuteScript processor, > initializing a datetime to some initial zero condition as ListFile might do, > saving the time I do a listing of files to state, and recalling that value > when I do subsequent iterations through ExecuteScript. > > My Execute Script will create a JSON object that is a list of all files in > directory with DT stamp later than the value in state. I'll pass that result > to SplitJSON. My intention is for the resulting flowfiles to be used by > FetchFile. > > Normally I would let ListFile do this for me, but in my situation I must > iterate, and as far as I can see ListFile allows no input connections. I > can't see how it can be used in any iterative fashion. Am trying to come up > with a reasonable workaround. > >
