May be it is Python's multiprocessing then?. The script does a LOOP calling integrate command.
But it does each call in separate process, using Python's MP.
Each command seems to create few folders. I just did one command
and saw these created:
rwx------ 2 me me 4096 Aug 15 09:53 tmpmyvujuyg
drwx------ 2 me me 4096 Aug 15 09:53 tmpd14tubax
drwx------ 2 me me 4096 Aug 15 09:53 tmpmp7uvinu
drwx------ 2 me me 4096 Aug 15 09:53 tmpe7tycr65
drwx------ 2 me me 4096 Aug 15 09:53 tmpg0mt3zb4
Since the script runs for 10's of thousands of integrals, and I have 3 running at same time, my TMP
fills up and Linux runs short of file nodes and get warning that desk space is short (even though
the folder are empty, it is the file nodes causing this). See
I use multiprocessing, since that is only way I know to set a timeout on the
integrate command, since sagemath has no build in support for timeout on
function call.
Here is the basic flow of the script: (this is not the real script but
a stripped down version)
----------------------------------------------------------------
#!/usr/bin/env sage
import os, sys, time, datetime, ntpath
import multiprocessing as mp
from sage.all import *
def doTheIntegration(q1,q2):
problem = q1.get()
integrand = SR(problem[0])
theVar = SR(problem[1])
anti = integrate(integrand,theVar)
q2.put(anti)
if __name__ == "__main__":
integrandAsString = "cos(x)"
mp.set_start_method('spawn')
q1= mp.Queue()
q2= mp.Queue()
q1.put([integrandAsString,"x"]) #integrand, variable
process = mp.Process(target=doTheIntegration, args=(q1,q2,))
process.start()
print("after process start()..waiting to finish")
try:
anti = q2.get(True,4*60) #4 minutes timeout
except Exception as ee:
print("Exception in call to queue.get ",ee)
print("type(exception).__name__=",type(ee).__name__)
del(q1)
del(q2)
process.terminate()
------------------------------------------------
I run this using
sage ./script.sage
And see these tmp folders created. Since real script runs in a loop, the tmp folders
remain there until the script is done, which takes days.
Is there a way not to create these tmp folders?
Thanks
--Nasser