The scope of python variables are local within a STAX job thread (or 
within function if the function defined as local).

What is the use case for sharing the file python object?  Note that you 
can share the 'filepath' in many ways. A simple way is to use STAF VAR 
service.

Perhaps you can try using STAXGlobal class, see  
http://staf.sourceforge.net/current/STAX/staxug.html

STAX-Threads
When the STAX Service executes elements in parallel, rather than using 
real system threads (and thereby potentially creating an overabundance of 
system threads), the STAX Service will simulate the threading capabilities 
via a thread pool which will utilize a manageable number of real system 
threads.  These simulated threads are called STAX-Threads. 
Whenever a new STAX-Thread is created, existing variables are cloned from 
the parent STAX-Thread. To create a global variable that can be accessed 
across STAX-Threads, use the STAXGlobal class described in "STAXGlobal 
Class" section. STAX elements that can create STAX-Threads include the 
following: <parallel>, <paralleliterate>, <process-action>, <job-action>, 
and <function> elements with a local scope. 

--
Regards,
Mike Tran




From:   Sunny Arora <sunnyaror...@gmail.com>
To:     Sharon Lucas/Austin/IBM@IBMUS
Cc:     staf-users@lists.sourceforge.net
Date:   12/15/2011 01:34 AM
Subject:        Re: [staf-users] STAX script query



hi, 

is there any way to share file objects in STAF in differen files using the 
environment variable functionality. 

E.g.  File = open( filepath, 'w') 
i want to share the '' File '' object over the system, can it be done as I 
am only aware about sharing strings. 

Thanks 

----- Original message ----- 
> STAF provides variables that contains the physical memory on a machine 
> (in   bytes, KB, or MB).   You can get a STAF variable's value by 
> submitting a   RESOLVE request to the STAF VAR service.   For example: 
> 
> C:\>STAF local VAR RESOLVE STRING {STAF/Config/Mem/Physical/Bytes} 
> Response 
> -------- 
> 2128842752 
> 
> C:\>STAF local VAR RESOLVE STRING {STAF/Config/Mem/Physical/KB} 
> Response 
> -------- 
> 2078948 
> 
> C:\>STAF local VAR RESOLVE STRING {STAF/Config/Mem/Physical/MB} 
> Response 
> -------- 
> 2030 
> 
> Via a STAX job, you would do this using a <stafcmd> element to submit 
> the   RESOLVE request to the VAR service.   For example: 
> 
> <stafcmd> 
>     <location>machine</location> 
>     <service>'VAR'</service> 
>     <request>'RESOLVE STRING {STAF/Config/Mem/Physical/Bytes}'</request> 

> </stafcmd> 
> 
> <if expr="RC == 0"> 
>     <log message="1">'Physical memory in bytes on machine %s is %s' % 
> (machine, STAFResult)</log> 
> </if> 
> 
> STAF does not provide a way to directly get the number of processes 
> running or CPU usage.   But you could use a <process> element to run an 
> operating system command or whatever command to get this information. 
> 
> -------------------------------------------------------------- 
> Sharon Lucas 
> IBM Austin,     luc...@us.ibm.com 
> (512) 286-7313 or Tieline 363-7313 
> 
> 
> 
> 
> From:     Sunny Arora <sunnyaror...@gmail.com> 
> To:         staf-users@lists.sourceforge.net, 
> Date:     12/13/2011 04:38 AM 
> Subject:               [staf-users] STAX script query 
> 
> 
> 
> Hi, 
> 
> Is there any method to find number of process running,cpu usage and 
> physical memory using STAX scripts. 
> 
> 
> Thanks, 
> Sunny 
> 
------------------------------------------------------------------------------ 

> Systems Optimization Self Assessment 
> Improve efficiency and utilization of IT resources. Drive out cost and 
> improve service delivery. Take 5 minutes to use this Systems 
> Optimization   Self Assessment. 
> http://www.accelacomm.com/jaw/sdnl/114/51450054/ 
> _______________________________________________ staf-users mailing list 
> staf-users@lists.sourceforge.net 
> https://lists.sourceforge.net/lists/listinfo/staf-users 
> 
------------------------------------------------------------------------------
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs. 
But none more important than the need to reduce IT complexity 
while improving strategic productivity.  Learn More! 
http://www.accelacomm.com/jaw/sdnl/114/51507609/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

------------------------------------------------------------------------------
10 Tips for Better Server Consolidation
Server virtualization is being driven by many needs.  
But none more important than the need to reduce IT complexity 
while improving strategic productivity.  Learn More! 
http://www.accelacomm.com/jaw/sdnl/114/51507609/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to