[Tutor] Running subProcesses in parallel for mixed external Windows.exe and Python functions on specified CPUs.

Ian Campbell ian-campbell at shaw.ca
Fri May 1 17:45:04 CEST 2009


Running subProcesses in parallel for mixed external Windows.exe and 
Python functions on specified CPUs.

How  does a newbie start to make this work?

def startMyFiles():        (not real code, this is only for explaining 
my problem)
import OS
import time
import sys
import subprocess
from win32event import WaitForSingleObject, WAIT_TIMEOUT
from win32api import TerminateProcess
import myNewPythonCodeReadWriteSQLite               # my new module
import myNewPythonCodeReadSQLiteShowMatPlotLib      # my new module  
"show"  here?  or "draw"?

    # these two Windows executables  should run in sequence and on CPU_2
    # but  as a group of 2  run in parallel with the next 2   groups  
    p11 = subprocess.Popen("C:\myDdeServer.exe ")              
    # loads DDE Server     
    p12 = subprocess.Popen("c:\ddeClicks.ahk ")                
    # starts dde server with clicks and keyboard strokes
                                                                         
    # these two should run in sequence on CPU_3                        
    # but  as a group of 2  run in parallel with the next   
group              
    p21 = subprocess.Popen("C:\showRawData.xlsm ")             
    # loads Excel spreadsheet to show incoming data in real time
    p22 = subprocess.Popen("c:\xlsClicks.ahk ")                
    # send mouse clicks and keyboard strokes to start Excel
                                                                                 
 
    # these two should run in sequence  on 
CPU_4                             
    # but  as a group of 2  run in parallel with the prior 2   
groups             
    p31 = subprocess.Popen("pw5.exe c:\legacyScript.was")      
    # loads legacy code to read and write from spreadsheet to SQLite 
data base
    p32 = subprocess.Popen("c:\wasClicks.ahk ")                 
    # sends mouse clicks and keyboard strokes to start legacy code
                                                                        
                                                                              
 
    #this new Python code runs  in parallel for ever  on CPU_2            
    readWriteSQLiteDef()          # from 
myNewPythonCodeReadWriteSQLite    Module                             
    # runs for ever to read and write and refresh SQLite in parallel   
what subprocess?
                                                                          
    #this new Python code runs  in parallel for ever  on 
CPU_3                   
    readSQLiteShowMatPlotLibDef()           # from   
myNewPythonCodeReadSQLiteShowMatPlotLib Module               
    # runs for ever to refresh graphics from SQLite    what subprocess?




More information about the Tutor mailing list