Matt, thanks very much for all your help. I tried to embed the session.create() and the session.transfer() into the loop that crunches through the files. The ExecuteScript processor that runs my python script does not throw any error, but no flowFiles result in the REL_SUCCESS output queue.
I've replicated my python code here. You can quickly see where I make the flowFile calls. What have I neglected? My goal is that each time I find a file that qualifies, a flowFile will be sent out. I have executed a version of this script from the command line that prints out each file that meets the filtering criteria, and it does indeed find the set of files I expect - so I know it gets into that portion of the code where I attempt to create my flowFiles.
I believe I may be failing to understand either or both of classes I must import or somehow an initialization of the session context.
from datetime import datetime
from datetime import timedelta
from tempfile import mkstemp
from shutil import move
from os import remove
#from java.nio.charset import StandardCharsets
yearList = ["2018","2017"]
monthList = ["12","11","10","09","08","07","06","05","04","03","02","01"]
dayList = ["31","30",...."01"]
year = int(datetime_str[:4])
month = int(datetime_str[5:7])
day = int(datetime_str[8:10])
hour = int(datetime_str[11:13])
minute = int(datetime_str[14:16])
second = int(datetime_str[17:19])
microsecond = int(datetime_str[20:])
if __name__ == "__main__":
#Read key parms that drive the generalized file list from the config file....
with open(configFile, "r+") as f:
rootDir_line = f.readline().strip()
rootDir = rootDir_line[8:].strip()
lastRunDT_str_line = f.readline().strip()
lastRunDT_str = lastRunDT_str_line[10:].strip()
lastRunDT = satetime_from_str(lastRunDT_str)
# We will use the following last run DT to filter out all files with
# last modified dates that precede or are equal to this last run DT...
lastRunDT_secondsSinceEpoch = time.mktime(lastRunDT.timetuple())
#Recurse through directories beneath rootDir for group ABC...
for years in yearList:
for months in monthList:
for days in dayList:
path = "".join(["/mnt/stuff/",rootDir,"/",years,"/",months,"/",days,"/"])
for root, directories, filenames in os.walk(path):
for directory in directories:
for filename in filenames:
fqfname = os.path.join(root,filename)
file_mod_time = os.stat(fqfname).st_mtime
if (file_mod_time > lastRunDT_secondsSinceEpoch):
head, tail = os.path.split(fqfname)
flowFile = session.create()
flowFile = session.putAttribute(flowFile,"absolute.path",head)
flowFile = session.putAttribute(flowFile,"filename",tail)