labscript-suite / blacs

𝗯𝗹𝗮𝗰𝘀 supervises the execution of experiments controlled by the 𝘭𝘢𝘣𝘴𝘤𝘳𝘪𝘱𝘵 𝘴𝘶𝘪𝘵𝘦. It manages experiment queuing and hardware-timed execution, and provides manual control over devices between shots.
http://labscriptsuite.org
Other
4 stars 47 forks source link

AppID stuff not set correctly after compile and restart #5

Open philipstarkey opened 9 years ago

philipstarkey commented 9 years ago

Original report (archived issue) by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


After compile and restart, BLACS gets grouped together with runamanger in the taskbar in Windows 7.

philipstarkey commented 7 years ago

Original comment by Shaun Johnstone (Bitbucket: shjohnst, GitHub: shjohnst).


On our new Windows 10 machine it gets grouped with lyse (which was previously not pinned to the taskbar)

philipstarkey commented 7 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Ah, that's silly. I've noticed this on windows 7 too, I think.

The restart behaviour should be changed to be a bit "fresher" than the current method, which replaces the currently running process. It should instead launch a new one. I'll probably make zprocess grow a "restart current process" function to that runs the command that started the current process, after a delay, as a new process, that way the restart behaviour should be the same as the normal-start behaviour.

philipstarkey commented 7 years ago

Original comment by Philip Starkey (Bitbucket: pstarkey, GitHub: philipstarkey).


Isn't that what it already tries to do? It relaunches with subprocess.POpen [code]

philipstarkey commented 7 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Oh, so it does! I think that changed at some point, I think it used to be os.execv or something, but maybe I'm mistaken.

I can test on Windows at NIST, and try a few things, but if anyone else wants to have a go at this, I'd suspect a few things: One, that the parent process doesn't die before its child process starts - this means there are two BLACS processes running at the same time, although, to be sure, the second one is delayed and so should not be calling the AppID functions until the first one is dead.

You might have some luck settings the DETACHED_PROCESS flag, which I've used for things like launching a zlock server automatically without wanting it to be a child process of the current process (example here). But this would mean that the new process would not inherit the old one's terminal, which would be unfortunate if you are running from a terminal for debugging.