Nov-28-2019, 03:49 PM
./PoreDy is the command I want to execute, and jobname and 1001 is the argument it required.
My code is as follows:
1: the command has many outputs, I don't want to see its stdout which usually shows on screen when I manually run it.
2: looks this code doesn't fully use my all threads, actually only 4 or 5 of them are used simultaneously.
Please help out, this stuck me for a long time.
My code is as follows:
TotalThread=24 CheckInterval=2 for i in range(CasesCount): jobname=Name(FolderName+'_', i) cmd='cp -f'+SettingMatch+' '+jobname subprocess.call(cmd, shell=True) # Pay Attention print('executed ', cmd) cmd='./PoreDy '+jobname+' 1001' job=subprocess.Popen(cmd, shell=True) # Pay Attention Runs.append(int(job.pid)+1) print('executing ', cmd, ' Job ID: ', int(job.pid)+1) print(Runs) time.sleep(1) while len(Runs)>=TotalThread: for run in Runs: if Running(run)==False: print('PID ', run, ' Finished!') Runs.remove(run) time.sleep(CheckInterval)I got two problems:
1: the command has many outputs, I don't want to see its stdout which usually shows on screen when I manually run it.
2: looks this code doesn't fully use my all threads, actually only 4 or 5 of them are used simultaneously.
Please help out, this stuck me for a long time.