Yes, if you want to check a file being written to by the process while the 
process is running, then you could use a <process-action> to do this. Note 
that if the process is running a remote machine, then the files the 
process is writing to won't reside on the STAX service machine so you 
couldn't simply so this via a <script> element.  But you could use a 
<process> element (within the <process-action> element ) to run command 
"tail -f FILE | grep XXXX" on the remote process machine.  You could do 
this in a loop where you can also use a <stafcmd> element to submit a 
PROCESS QUERY HANDLE STAXProcessHandle reqeust at the end of the loop and 
if it returns RC 48 (does not exist), then you know that the process is no 
longer running and you exit the loop so that the <process-action> task 
completes.

When a block is terminated and the block contains one or more <process> 
elements, STAX submits a PROCESS STOP request to stop a process.  See the 
STAF User's Guide for more information on the PROCESS service's STOP 
request.  Note that it will try to stop the process using the default stop 
method for the process.  STAF provides several different stop methods for 
processes that are documented in the STAF User's Guide at 
http://staf.sourceforge.net/current/STAFUG.htm#HDRPSSTOP and vary 
depending on if the operating system the process is running on is Unix or 
Windows.  You can override the stop method for STAX to use by specifying 
the <stopusing> sub-element for a process.

stopusing - allows you to specify the method by which this process will be 
STOPed, if not overridden on the STOP command. The value is evaluated via 
Python to a string. This element is optional. 

If the process cannot be stopped via the default stop method (or by the 
stop method specified if overridden via the <stopusing> sub-element) then 
the process continues running, but STAX views the <process> element as 
complete and STAX will continue processing the next element.

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




Strösser, Bodo <bodo.stroes...@ts.fujitsu.com> 
07/08/2009 11:18 AM

To
Sharon Lucas/Austin/i...@ibmus
cc
"'staf-users@lists.sourceforge.net'" <staf-users@lists.sourceforge.net>
Subject
RE: [staf-users] How to stop "process-action"






The process itself writes one or more files. I would like to filter the 
files
for relevant messages and print them to STAXMon. So I think about
some lines of Jython that work similar to "tail -f FILE | grep XXXX" and
use Jython 'print' to bring the output to STAXMon. Does it make
sense to do it in <process-action>?
 
 
You said: 
If a block is terminated and the block contains one or more <process> 
elements, then STAX will attempt to stop the process(es) before 
terminating the block (but if a process cannot be terminated, it 
terminates the block anyway).
I tried some small scenarios. There, when a process catched the
termination signal (e.g. SIGINT), STAX waited for the process'
postprocessing and termination. Did I miss something?
What is the criteria for STAX to suppose that the process cannot be
terminated? Does STAX continue processing behind the block while
the process still is running?
 
Bodo
 
 
 

From: Sharon Lucas [mailto:luc...@us.ibm.com] 
Sent: Wednesday, July 08, 2009 5:58 PM
To: Strösser, Bodo
Cc: 'staf-users@lists.sourceforge.net'
Subject: Re: [staf-users] How to stop "process-action"


What is it you want to do within a <process-action> element?  If you told 
me that I think I could answer your questions better. 

The reason you'd want to use the <process-action> element is if you wanted 
to interact with the process while it is running.  To do that you can use 
the STAXProcessHandle variable to obtain the process' handle (if the 
process was not started using the 'shell' mode).  Note that the STAX 
User's Guide contains an example of how to use the <process-action> to 
send a message via the QUEUE service to the process (just an example of 
one thing you can do to interact with a process via a <process-action>). 

Note that if you simply want to know when a process completes, you'll know 
this after the <process> element completes and you don't need a 
<process-action> element. 

If a block is terminated and the block contains one or more <process> 
elements, then STAX will attempt to stop the process(es) before 
terminating the block (but if a process cannot be terminated, it 
terminates the block anyway). 

I think if you simply try using the <process-action> element, you'll 
better understand how it works (if you really have a need to use it).

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313



Strösser, Bodo <bodo.stroes...@ts.fujitsu.com> 
07/08/2009 09:58 AM 


To
"'staf-users@lists.sourceforge.net'" <staf-users@lists.sourceforge.net> 
cc

Subject
[staf-users] How to stop "process-action"








Hi, 
  
I would like to have a Jython-<script> running in parallel to a process 
using <process-action>. 
STAX User Guide tells me 'If the process completes before the task 
completes, the process 
will remain in a non-complete state until the task completes.' 
So, how can the script observe the process to make sure that it exits 
after the process has 
exited? 
And what will happen if the process is killed by a block termination from 
STAXMon? AFAICS, 
STAX waits for the process to exit after sending the signal. Does it also 
wait for termination 
of <process-action>? 
  
Best regards 
Bodo 
  
 
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge 
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full 
prize 
details at: 
http://p.sf.net/sfu/Challenge_______________________________________________

staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to