I have a automated jenkins job which runs msiexec.exe installation out of a python script . Multiple instances of the same script can be initiated with different parameters on the same machine. Since msiexec.exe can handle only 1 installation at a time, any parallel installation which starts throws an error and jenkins job hangs!
To avoid parallel installation i added a while loop to check if any msiexec task is running and wait while it is completed. But this still is not failproof as i see some race condition issues.
step that needs to be serialized:
subprocess.check_call('msiexec /a 'install.msi')
while loop already implemented:
while "msiexec.exe" in os.popen('tasklist /FI "IMAGENAME eq msiexec.exe"').read().strip():
I believe creating a process lock will yield better results than a a while loop on checking if the msiexec task has completed. Any ideas on how it can be achieved? Please note it has to be using stock modules part of python 2.7.3. Installing new modules is not a option.