Hi Eric,
Though I am not an STAF/Python/Windows expert, I have some experience of
handling some problems you have mentioned here. My two cents are here.
You have 3 options:
1. Send kill to your primary slave process. Trap this signal in that slave
process so that it can terminate all the spawned children itself. I have
never trapped signals in windows using Perl, but Perl seems to support it.
Python might have a way too.
2. If signals and termination dont work on windows, you can perhaps use some
shared memory data relay among all these parent and children processed on
the slave machine. For eg. parent quits and sets a shared memory flag which
each child is programmed to check and exit if found set.
3. Relay back the spawned process information to the master machine and use
some windows command/tool to kill the processes with matching pids. (I dont
know of any windows command like linux "kill").
HTH.
-Nikunj
non ac
On Wed, Jan 14, 2009 at 5:46 AM, Eric Kadison <ekadi...@istor.com> wrote:
> Can someone please help with a STAF process problem?
>
> Within an application we've written, we start a process on a slave host
> from a master host, all running Win2K3. The process on the slave host
> will, then, start 2 processes on that same host. (There can actually be
> several slave hosts, all running the same way). Normally, when the test
> ends, all the processes end by themselves. But, in case of an error, we
> want to abort all processes, so I wrote a Python method to kill all
> slave processes.
>
> All processes are Python (2.5.1). STAF start & stop requests are made
> by calling the submit method in the STAFHandle class of the PYSTAF
> module (STAF 3.2.5). The STAF request used to start a process is:
> START COMMAND "python path\\InitiatorHostProcess.py arguments" VAR "xxx"
> USEPROCESSVARS WORKDIR "path" TITLE "xxx" STDOUT "filename"
> STDERRTOSTDOUT NOTIFY ONEND NAME "xxx" KEY "xxx"
>
> The STAF requests used to stop a process is:
> STOP HANDLE "xxx" USING WM_CLOSE
>
> Starting processes works fine. Normal termination of processes is also
> fine (even the notification on end). But, I've encountered two problems
> will the abnormal kill all method:
>
> 1. From my Linux experience, I had expected that stopping the parent
> process on a Windows slave host would also stop the two child processes.
> This proved wrong. The parent seems be able to terminate leaving the
> two children running. Are there settings that will allow a STAF Process
> request from the master host to terminate all my spawned processes on a
> slave host?
>
> 2. Sometimes, the STAF call to stop a slave process just hangs. It
> appears the slave process just won't terminate. What could cause this?
> What Windows calls does STAF make on the slave host to "STOP" a process?
>
> Thanks,
> Eric
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> staf-users mailing list
> staf-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/staf-users
>
--
Thanks,
-Nikunj
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users