I think you probably only want to have the STAX service running on the
Master machine (not on the slave machines). So, I don't think you really
want to copy the STAX XML job file to the slave machines. I think you
only need to configure the STAX service on the Master machine and then run
a STAX job that submits STAF requests to the various slave machines within
a <paralleliterate> element. This way, the Master machine where the STAX
service is running will always be running, but the slave machines can be
rebooted.
The paralleliterate element performs the task for each value in a list.
The iterations of the contained task element are executed in parallel
(unlike the iterate element whose tasks are performed serially). Each
iteration will be executed on a separate STAX-Thread and existing
variables are cloned for each thread. The paralleliterate element is
considered to be complete when all its iterations of the task element have
completed.
Note that if a testcase running on a slave machine reboots the machine,
then you can wait for STAF to become available again after the machine has
been rebooted by importing and then calling the STAXUtilWaitForSTAF
function provided in libraries/STAXUtil.xml from your STAX job. For
documentation on the STXUtilWaitForSTAF function in STAXUtil.xml, see
http://staf.sourceforge.net/current/STAXLibraries/index.html and the STAX
User's Guide.
Here's an example of a STAX job that runs a list of tests on slave
machines that you could use as a starting point and customize as you
wanted.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<stax>
<defaultcall function="Main"/>
<script>
# Assign the slave machines where you want tests run
machineList = [ 'slave1', 'slave2', 'slave3' ]
# Assign the directory where the tests reside on the local
# STAX service machine
localTestcaseDir = 'C:/myTests'
# Assign the directory where you want to copy the test
# directory to on the slave machines
testcaseDir = '{STAF/DataDir}/tmp'
# Assign the tests you want to run on the slave machiens
testList = [
{ 'name': 'TestA', 'command': 'java TestA', 'classpath': '%s/testA' %
(testcaseDir) },
{ 'name': 'TestB', 'command': 'java TestB', 'classpath': '%s/testB' %
(testcaseDir) }
]
</script>
<function name="Main">
<sequence>
<paralleliterate var="machName" in="machineList">
<sequence>
<script>
# Replace any '.'s in machine name with '-'s so that this
# modified machine name can be used in block and testcase
names
# without creating a hierarchy of blocks and testcases
machName_NoDots = machName.replace('.', '-')
</script>
<block name="machName_NoDots">
<testcase name="machName_NoDots">
<sequence>
<call function="'Setup'"/>
<if expr="RC == 0">
<sequence>
<!-- Use the iterate element to run test(s) on a
slave machine sequentially -->
<iterate var="testMap" in="testList">
<call function="'RunTests'"/>
</iterate>
</sequence>
</if>
<!-- If needed, could call a Cleanup function here -->
</sequence>
</testcase>
</block>
</sequence>
</paralleliterate>
<!-- You won't get here until all the tests have completed
on all of the machines in machinesList -->
</sequence>
</function>
<function name="Setup">
<sequence>
<log message="1">
'Setting up to run tests on machine %s' % (machName)
</log>
<!-- Use the stafcmd element to copy any test case files from the
local master machine to the slave machine -->
<script>
request = 'COPY DIRECTORY %s TODIRECTORY %s TOMACHINE %s RECURSE'
% \
(localTestcaseDir, testcaseDir, machName)
</script>
<stafcmd name="'Copy Testcase Files'">
<location>'local'</location>
<service>'FS'</service>
<request>request</request>
</stafcmd>
<if expr="RC != 0">
<sequence>
<script>
msg = 'Setup failed on machine %s.' % (machName) + \
'\nCommand: STAF local FS %s' % (request) + \
'\nFailed with RC: %s, Result: %s' % (RC, STAFResult)
</script>
<tcstatus result="'fail'">msg</tcstatus>
<log message="1">msg</log>
<return>RC</return>
</sequence>
</if>
<return>0</return>
</sequence>
</function>
<function name="RunTests">
<sequence>
<log message="1">
'Run test %s on machine %s' % (testMap['name'], machName)
</log>
<!-- Use the process element to run a test on a slave
machine -->
<process name="testMap['name']">
<location>machName</location>
<command mode="'shell'">testMap['command']</command>
<env>'CLASSPATH=%s{STAF/Config/Sep/Path}{STAF/Env/CLASSPATH}' %
(testMap['classpath'])</env>
<stderr mode="'stdout'"/>
<returnstdout/>
</process>
<if expr="RC == 0">
<sequence>
<script>
msg = 'Test %s completed successfully on machine %s' % \
(testMap['name'], machName)
</script>
<log message="1">msg</log>
<tcstatus result="'pass'"/>
</sequence>
<else>
<sequence>
<script>
msg = 'Test %s failed on machine %s.' % (testMap['name'],
machName)
msg += '\nCommand: %s' % (testMap['command'])
msg += '\nRC: %s, STAFResult: %s, STAXResult:\n%s' % (RC,
STAFResult, STAXResult)
</script>
<log message="1">msg</log>
<tcstatus result="'fail'">msg</tcstatus>
</sequence>
</else>
</if>
</sequence>
</function>
</stax>
--------------------------------------------------------------
Sharon Lucas
IBM Austin, [EMAIL PROTECTED]
(512) 838-8347 or Tieline 678-8347
"Gurpreet Anand" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
01/08/2008 04:01 AM
To
"'STAF'" <staf-users@lists.sourceforge.net>, Sharon Lucas/Austin/[EMAIL
PROTECTED]
cc
Subject
[staf-users] master and slave approach - STAF/STAX on all the master and
slave machines.
Hello All,
In my application I want to run a set of test-cases on different
topologies(machines)..For this I will create the STAX XML job on one
machine and will push it on all the other topologies.
1) Master will Push using FS service to all other topologies..
2) Master will then give this to the STAX engine on the different
topologies, so that these test cases will be executed on these topologies.
3) Master need to synchronize as to when these test cases are done
?so that when all the test cases are done on all the topologies, the
master will generate a report?..[NOTE: these test-cases might re-start the
VM?s on which they are running]
Please, can anyone share a prototype or a way in which these test cases
will be distributed on different machines, to feed these STAX JOB on the
engine present on these machines, to synchronize with MASTER machine when
they are done and to solve the issue of machine re-start (we will make
STAF as a service, so that it will be started automatically on re-start).
Let me know your vies/suggestion on it.
Many Thanks,
Gurpreet Anand
DISCLAIMER ========== This e-mail may contain privileged and confidential
information which is the property of Persistent Systems Ltd. It is
intended only for the use of the individual or entity to which it is
addressed. If you are not the intended recipient, you are not authorized
to read, retain, copy, print, distribute or use this message. If you have
received this communication in error, please notify the sender and delete
all copies of this message. Persistent Systems Ltd. does not accept any
liability for virus infected mails.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users