Home python script, run multi script
Reply: 0

python script, run multi script

zablah zalata
1#
zablah zalata Published in 2018-02-13 22:23:28Z

I tried to run python script multiple time depending on data got from the database as an argument, and I tried several ways to run the script but on every time not all my script run perfectly.

1-

for x in range(0,number_of_rows):
      proc = subprocess.Popen(["python3","runner.py",final_result[x]],hell=False,stdin=None, stdout=None, stderr=None, close_fds=True)
      time.sleep(0.2)

2-

for x in range(0,number_of_rows):
         os.system("python3 runner.py %s &"%(final_result[x]))
         time.sleep(0.2)
         #and i tried 
         #os.system(" nohup python3 runner.py %s &"%(final_result[x]))

also i tied to create a bash script contains the run command and i run the bash script but some porcess not responding.

as following

3-

for x in range(0,number_of_rows):
     myString=myString+"nohup python3 runner.py "+final_result[x]+" & "
with open("runofBash.sh", "w") as text_file:
       text_file.write(myString)

then from the terminal I run the bash script but not all process was responding and if i run the python script from the terminal with the argemant all the posible argument are working fine.

the final_result list contains more the 30 elements so the script needs to run more the 30 process.

i can see all my process running with:

ps aux | grep runner.py

but not all process was responding

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.297112 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO