Bodo,
You need to understand that the <finally> block has some special rules as
I mentioned that are described in the STAX User's Guide to ensure that the
finally task is always run. Mainly, you need to make sure that the
finally task completes (e.g. by terminating the block that is the first
element within the finally element) before you can terminate a higher
level block containing the <finally> block. These rules are needed to
ensure that the<finally> block is always run.
Yes, I understand it is awkward when using the STAX Monitor if someone
tries to terminate a parent block that contains a finally element that is
held, as you should not do this as described in the STAX User's Guide (and
maybe we could do something to improve this so that the block doesn't
"disappear" and require you to exit monitoring and then re-monitor the
job, but I'm not sure that this will be possible, though perhaps we could
add a "Refresh" option or something like that to the STAX Monitor). Note
that you can always see the currently running blocks by submitting a "STAF
local STAX LIST JOB <JobID> BLOCKS" request and you can submit a "STAF
local STAX TERMINATE JOB <JobID> BLOCK <FinallyBlock> request. Perhaps
you could specify a special block name for the block within your <finally>
element so that people know they have to terminate that finally block
first.
Or, perhaps it would be better if you implement your STAX job differently
so that the <finally> block does not do a <hold/>. Could you do whatever
post-processing you need to do within the <finally> block (to ensure that
the post-processing is always done), but don't do a <hold/> within the
finally block. Move the <hold/> to after the <try> block. If needed,
within your finally block's post-processing, you could set a variable that
indicates whether or not to do a hold. For example:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<stax>
<defaultcall function="StartHere"/>
<function name="StartHere">
<block name="'RunTests Block'">
<sequence>
<script>
testsFailed = 0 # Success
</script>
<block name="'Test1 Block'">
<try>
<sequence>
<log message="1">
'In Test1 Block in "try" body'
</log>
</sequence>
<finally>
<block name="'FinallyBlock'">
<sequence>
<log message="1">'In FinallyBlock'</log>
<!--
Perform Post-Processing to determine if tests
succeeded.
Set a variable to indicate if tests succeeded or not.
-->
<log message="1">'Performing post-processing for
Test1'</log>
<script>
testsFailed = 1 # Failed
</script>
<log message="1">'FinallyBlock completed'</log>
</sequence>
</block>
</finally>
</try>
</block>
<if expr="testsFailed">
<sequence>
<log message="1">
"""Hold job while determine if want to continue running.
Release RunTests block if want to continue running.
Terminate RunTests block if don't want to continue."""
</log>
<hold if="testsFailed"/>
</sequence>
</if>
<block name="'Test2 Block'">
<sequence>
<log message="1">'In Test2 Block'</log>
<stafcmd name="'Delay for 5 seconds'">
<location>'local'</location>
<service>'DELAY'</service>
<request>'DELAY 5s'</request>
</stafcmd>
</sequence>
</block>
</sequence>
</block>
</function>
</stax>
--------------------------------------------------------------
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:48 AM
To
Sharon Lucas/Austin/i...@ibmus
cc
"'staf-users@lists.sourceforge.net'" <staf-users@lists.sourceforge.net>
Subject
RE: [staf-users] Wrong picture on STAXMon when terminating a block
Sharon,
I do not want to terminate the task in <finally>. Let me try to explain:
My STAX Job performs some tests. If it sees some specific errors, it
has to perform some postprocessing. That is done in a <finally> element
as it must be processed under all circumstances. After that, the job
stops using <hold/>.
Now the user may check the test environment and decide to simply
release the test. Or it may be necessary to terminate some greater
part or even the entire test. This would be done by terminating one of
the parent blocks of the held block from STAXMon. The goal is to have
the <finally> part run completely but after that a jump to the end of the
terminated block. But terminating the parent block unfortunately does
not release the <finally> task in the held block.
On the other hand, as soon as the parent block is termnated, STAXMon
no longer displays the lower blocks including the held block. So, to
release the held block, monitoring of the STAX job must be closed and
re-opened for the held block to be displayed again.
So, I think STAX should release the held block when the parent block is
killed or STAXMon should not kill the held block from display.
Bodo
From: Sharon Lucas [mailto:luc...@us.ibm.com]
Sent: Wednesday, July 08, 2009 6:26 PM
To: Strösser, Bodo
Cc: 'staf-users@lists.sourceforge.net'
Subject: RE: [staf-users] Wrong picture on STAXMon when terminating a
block
Bodo,
After looking into this issue some more, I don't believe this is a bug.
The STAX User's Guide, in the section on the <finally> element, describes
the situation you are seeing as follows:
Note that if you want to have a guaranteed way to stop a finally task, you
should have the first element contained in your finally task be a block or
timer element. For example, if you submit a request to terminate the job,
it will not terminate the job until the finally task(s) complete. But if
you submit a request to terminate a block that is currently running which
is contained within a finally task, then the block will be terminated (it
will not wait until that finally task completes).
So, you should change your STAX job so that the first element contained in
your finally task is a <block> or a <timer> element. If you add a <block>
as the first element in your finally task, then you can terminate that
block to terminate the finally task. For example:
<block name="'Block2'">
<try>
<log message="1">
'In Block2 in "try" body'
</log>
<finally>
<block name="'FinallyBlock'">
<sequence>
<log message="1">
'In Block2 before hold (in "finally")'
</log>
<hold/>
<log message="1">
'After hold in Block2. Should not be logged if Block1
or Block2 is terminated before Block2 is released'
</log>
</sequence>
</block>
</finally>
</try>
</block>
Now you will be able to terminate the "FinallyBlock" block so that you
have a guaranteed way to stop a finally task (so that the STAX job will be
able to complete).
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
Strösser, Bodo <bodo.stroes...@ts.fujitsu.com>
06/26/2009 03:39 PM
To
Sharon Lucas/Austin/i...@ibmus
cc
Subject
RE: [staf-users] Wrong picture on STAXMon when terminating a block
Hi Sharon,
could you please open the bug? I never did it before and it's very late
here in Europe.
I would prefer to go home now.
Thanks in advance!
Bodo
From: Sharon Lucas [mailto:luc...@us.ibm.com]
Sent: Friday, June 26, 2009 10:14 PM
To: Strösser, Bodo
Cc: 'staf-users@lists.sourceforge.net'
Subject: Re: [staf-users] Wrong picture on STAXMon when terminating a
block
Thanks for providing a recreation scenario for this problem. Please open
a bug via http://staf.sourceforge.net. Or, if you prefer, I can open a
bug for you.
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
Strösser, Bodo <bodo.stroes...@ts.fujitsu.com>
06/26/2009 03:06 PM
To
Sharon Lucas/Austin/i...@ibmus, "'staf-users@lists.sourceforge.net'"
<staf-users@lists.sourceforge.net>
cc
Subject
Re: [staf-users] Wrong picture on STAXMon when terminating a block
Hi Sharon,
thank you for your fast reply.
I tried your job and it works fine, but not my job. So I did some more
testing
to find the difference. Here it is: I am using </hold> in the <finally>
part of a <try>.
The following modified "block2", reproduces the problem as I describedit
in my
irst mail:
<block name="'Block2'">
<try>
<log message="1">
'In Block2 in "try" body'
</log>
<finally>
<sequence>
<log message="1">
'In Block2 before hold (in "finally")'
</log>
<hold/>
<log message="1">
'After hold in Block2. Should not be logged if Block1 or
Block2 is terminated before Block2 is released'
</log>
</sequence>
</finally>
</try>
</block>
Knowing the reason for the problem, I probably can work around it. At
least it
should be written to the known bugs, I Think.
Best regards
Bodo
From: Sharon Lucas [mailto:luc...@us.ibm.com]
Sent: Friday, June 26, 2009 7:41 PM
To: 'staf-users@lists.sourceforge.net'
Cc: Strösser, Bodo
Subject: Re: [staf-users] Wrong picture on STAXMon when terminating a
block
When a block is terminated, that block and all of its child blocks are
terminated. So if you terminate a black that has a held child block, the
terminate should override the held block and terminate the entire block
that you asked to be terminated. Note that the STAX Monitor simply
submits HOLD, TERMINATE, RELEASE, etc requests to the STAX service, so its
the STAX service, not the STAX Monitor that handles holding, terminating,
and releasing blocks. The STAX Monitor simply gets messages (via the
Event service) to update it on what actions have taken place in the job).
The following STAX job demonstrates this. If you run this job, it will
hold Block2. If you terminate Block1 (Block2's parent) or Block2 without
first releasing Block2, then message "After hold in Block2. Should not
be logged if Block1 or Block2 is terminated before Block2 is released"
will not be logged and the job will then run Block 3. This is working as
designed. Post again if this did not answer your question.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<stax>
<defaultcall function="StartHere"/>
<script>
machine = 'local'
</script>
<function name="StartHere">
<sequence>
<block name="'Block1'">
<sequence>
<block name="'Block2'">
<sequence>
<log message="1">
'In Block2 before hold'
</log>
<hold/>
<log message="1">
'After hold in Block2. Should not be logged if Block1 or
Block2 is terminated before Block2 is released'
</log>
</sequence>
</block>
</sequence>
</block>
<block name="'Block3'">
<sequence>
<log message="1">
'Logged by Block3 which is run after Block2 completes'
</log>
<stafcmd name="'Delay for 5 seconds'">
<location>'local'</location>
<service>'DELAY'</service>
<request>'DELAY 5s'</request>
</stafcmd>
</sequence>
</block>
</sequence>
</function>
</stax>
--------------------------------------------------------------
Sharon Lucas
IBM Austin, luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313
Strösser, Bodo <bodo.stroes...@ts.fujitsu.com>
06/26/2009 11:53 AM
To
"'staf-users@lists.sourceforge.net'" <staf-users@lists.sourceforge.net>
cc
Subject
[staf-users] Wrong picture on STAXMon when terminating a block
Hi,
i'm using STAX 3.3.6
I think, there is a bug in STAXMon, that can be reproduced performing the
following
steps:
- A STAX job holds the innermost block of itself using <hold/>.
- Now we kill a parent block, as we want some part of the job to be
skipped when
the block in "hold" is released.
- As soon as the parent block is terminated from STAXMon, STAXMon no
longer
displays the terminated block's childs, which I think is wrong.
- As the block in "hold" no longer is displayed, it can not be released
via STAXMon.
When the Monitor window is closed and started again, the missing blocks
are back.
Best Regards
Bodo
------------------------------------------------------------------------------
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------
_______________________________________________
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