I don't understand why you have to have one process open a file and having
other 2 processes access the same file descriptor.
Can you try something like :
<script>
filename = '/tmp/testdata.txt'
</script>
<stafcmd>
<location>'local'</location>
<service>'VAR'</service>
<request>'SET SHARED VAR TEST_DATA_FILE=%s' % (filename)
</request>
</stafcmd>
When you need access the file
<stafcmd>
<location>'local'</location>
<service>'VAR'</service>
<request>'GET SHARED VAR TEST_DATA_FILE'</request>
</stafcmd>
<script>
filename = STAFResult
buffer = 'test strings...'
FILE = open(filename,"a")
FILE.write(buffer)
FILE.close()
</script>
--
Regards,
Mike Tran
From: sunny arora <sunnyaror...@gmail.com>
To: Mike Tran/Austin/IBM@IBMUS
Cc: staf-users@lists.sourceforge.net
Date: 12/15/2011 11:23 AM
Subject: Re: [staf-users] STAX script query
Hi ,
Actually what I need is that for example, I have 3 STAX scripts.
Now if I open a file in one of the main scripts and then using that file
object need to write some data in the file in the other two scripts and
finally close the file in the main script.
Also, I can't open and close the file again nd again as the processes
defined in other scripts are running in paraalel which is the main
problem.
Can this be done??
Thanks
On Thu, Dec 15, 2011 at 10:34 PM, Mike Tran <miket...@us.ibm.com> wrote:
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
--
Thanks and Regards,
Sunny
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users