When you run "dirlist = os.listdir(path)", it is always executed on the
STAX service machine (in its Python interpreter).

Instead, you should use the FS service to get the directory listings.  For
example:

   <iterate var="machine" in="machines">

     <sequence>

       <stafcmd>
         <location>machine</location>
         <service>'FS'</service>
         <request>'LIST DIRECTORY C:\\test'</request>
       </stafcmd>

       <script>dirlist = STAFResult</script>

       <message>'Sub Job completed Result:%s' % dirlist</message>

     </sequence>

   </iterate>

Also note that in your <iterate> element, you incorrectly specified the var
attribute as a literal string:


      <iterate var="'machine'" in="machines">

It should be:


      <iterate var="machine" in="machines">

Thanks,
David


                                                                       
 David Bender          11501 Burnet Rd.   Phone (T/L): 1-512-286-5315  
 STAF/STAX Development Bldg. 903-5B002    (363-5315)                   
                       Austin, TX         ITN: 23635315                
 IBM Software Group,   78758-3400         Email: bda...@us.ibm.com     
 WPLC                                                                  
                                                                       
                                                                       






                                                                       
  From:       Sunny A <sunn...@tcs.com>                                
                                                                       
  To:         staf-users@lists.sourceforge.net                         
                                                                       
  Date:       05/22/2010 03:49 AM                                      
                                                                       
  Subject:    [staf-users] (no subject)                                
                                                                       





Hi,

I am totally new to STAF/STAX.

I want to run a sub-job from my main XML file in both local and remote
machines.

here are my Main job and Sub-job files.


Main-Job.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<stax>
   <defaultcall function="StartHere"/>
   <function name="StartHere">
          <sequence>
   <job name="'Test'" monitor="1">
    <job-file machine="'local'">'C:\\testcase\\test.xml'</job-file>
   </job>
             <if expr="RC ==0">
                <message log="1">'Sub Job %s completed , Status :%s
Result:%s' % (STAXSubJobID,STAXSubJobStatus,STAXResult)</message>
                <else>
                   <message log="1" level="'Error'">
     'Sub Job %s failed , RC:%s ,Result:%s' %
(STAXSubJobID,RC,STAFResult)</message>
                </else>
               </if>
          </sequence>
   </function>
</stax>


Sub-Job.Xml


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<stax>
 <defaultcall function = "Main"/>
  <script>
   machines= ['local','xyz12345']
   import os
   for machine in machines :
      path = "C:\\test"
      dirlist = os.listdir(path)
  </script>
 <function name = "Main">
      <iterate var="'machine'" in="machines">
            <sequence>
               <message>'Sub Job completed Result:%s' % dirlist</message>
            </sequence>
       </iterate>
 </function>

</stax>



My query is that when iam running my main job from stax monitor, i get the
files in the specified directory of my local machine only for both
iterates,
whereas the folder test is in both remote and local machine at the
specified path.

Can any1 let me know where i am going wrong or do i need to iterate over
machines in my Main-Job.xml also.



--
Thanks


=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you

------------------------------------------------------------------------------


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





<<inline: graycol.gif>>

<<inline: ecblank.gif>>

------------------------------------------------------------------------------

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

Reply via email to