I don't think I'm in this case : I do not open files, just do a lot of file movement with some FileTransferTasks. I use some subprocesses, but not with Popen as I don't need the output, just the return code.
I use the old API call() func (
https://docs.python.org/3/library/subprocess.html#older-high-level-api). I guess it closes the file descriptor after execution ...
The script which has caused the error (too many open files) is just a dummy script task echoing that the workflow execution has completed :
def get_dummy_end_fw():
# get caller module name
caller = inspect.currentframe().f_back
caller_name = caller.f_globals['__name__']
# create dummy end fw
ft = ScriptTask.from_str("echo \"ending %s workflow\"" % caller_name)
task_name = "dummy end: %s" % caller_name
fw_end = Firework([ft], name=task_name)
return fw_end
The only part in the code where I do an explicit open is into a with construct :
with open(param_path, "w") as paramfile:
paramfile.write("%s" % param_content)
I'm an experienced programmer (C, C++, Fortran & Perl mainly), but pretty new to Python...
Maybe have I missed something ... for example, I use the psycopg2 lib to connect to a PgSQL DB
So when I create a cursor like this in a funct :
cursor = db_connector.cursor()
I suppose it is destroyed at the end of the function, since no more reference points to this object ...
the number of fireworks in all the workflows in the launchpad when it crashed was greater than 1024 (more than 1300 actually).
I will launch further testes and check with lsof command which process open which file. Not this week, because I'm in travel, but next week I will tell you more.
Best,
David