Thnx for the great info really felt happy with your info. thnx a lot.
will go through the documentation and come back if i need any clarification

On Wed, Jul 20, 2011 at 1:08 AM, Sharon Lucas <luc...@us.ibm.com> wrote:

> You can get a list of internal STAF services (that are provided as part of
> the STAF download/install) from "Appendix B: Service Command Reference" in
> the STAF User's Guide at
> http://staf.sourceforge.net/current/STAFUG.htm#HDRCMDREF and a detailed
> description of each of these services in section "8.0 Service Reference" in
> the STAF  User's Guide at
> http://staf.sourceforge.net/current/STAFUG.htm#HDRSERVICEREF.
>
> We also provide some external STAF services (written in Java) that you can
> download separate from STAF itself and then register in the STAF.cfg file).
>  The external STAF services are listed and described at
> http://staf.sourceforge.net/getservices.php.  This web page also provides
> links to the User Guide for each of these external services.
>
> You can also write a custom STAF service yourself.  The STAF Service
> Developer's Guide at http://staf.sourceforge.net/getservices.php explains
> how to do this.
>
> Yes, you can use STAF to run a python script (or any other command) and
> collect logs on the same machine.  To do this you just specify "local" for
> the machine instead of a remote machine's host name or IP address.
>
> All of the documentation for STAF is available via the STAF/STAX
> Documentation web page at http://staf.sourceforge.net/docs.php.
>
> Also, I think you would find it helpful to go through at least Part 1 of
> the STAF Education provided at http://staf.sourceforge.net/education.php.
>  Part1 goes over the basic STAF concepts and how you can leverage using
> STAF.  The "Leveraging STAF" section also lists and describes all of the
> STAF services that are available.
>
> --------------------------------------------------------------
> Sharon Lucas
> IBM Austin,   luc...@us.ibm.com
> (512) 286-7313 or Tieline 363-7313
>
>
>
>
> From:        santosh hs <santosh.tron...@gmail.com>
> To:        Sharon Lucas/Austin/IBM@IBMUS
> Cc:        staf-users@lists.sourceforge.net
> Date:        07/19/2011 02:18 PM
> Subject:        Re: Fw: [staf-users] Can some one tell me as how can i use
> STAF in python.
> ------------------------------
>
>
>
> Thanks for the detailed explanation, now i got how can i use STAF. i wen
> through the documentation in the official site but i feel its not for novice
> . Your explanation really helped me.
> Where can i get list of services that  STAF supports and some explanation
> about these services as how they are useful.
> Can i use STAF for running the python script and collecting the logs on the
> same machine
>
> thanks a lot
>
> /santosh
>
> On Mon, Jul 18, 2011 at 11:10 PM, Sharon Lucas 
> <*luc...@us.ibm.com*<luc...@us.ibm.com>>
> wrote:
> Or, maybe you wanted to log the result from your database select to a file
> on another machine.  You could use the STAF LOG service and submit the
> request within your Python script.  For example, you could update your
> Python script as follows to do this:
>
> from PySTAF import *
> import sys
>
> # Create a STAF handle works to use to submit STAF service requests
>
> try:
>     handle = STAFHandle("Test1")
> except STAFException, e:
>     print "Error registering with STAF, RC: %d" % e.rc
>     sys.exit(e.rc)
>
> # Connect to a database on get a phone number for sam
>
> import MySQLdb
> db = MySQLdb.Connect("localhost","root","san123","phone")
> cursor = db.cursor()
> cursor.execute("SELECT * FROM phonebook WHERE Name ='san'")
> get_contact = cursor.fetchall()
> print get_contact
> db.close
>
> # Log the phone number in a log on machine machine1
>
> message = "Phone# for San: %s" % (get_contact)
> request = 'LOG GLOBAL LOGNAME Test1 LEVEL Info MESSAGE "%s"' % (message)
> result = handle.submit("machine1", "LOG", request)
>
> if (result.rc != STAFResult.Ok):
>     print "Error on STAF machine1 LOG %s" % (request)
>     print "Expected RC: 0"
>     print "Received RC: %d, Result: %s" % (result.rc, result.result)
>     sys.exit(1)
>
> print "\n*** Test successful ***"
>
> # Un-register the STAF handle
>
> result = handle.unregister()
>
> if (result != STAFResult.Ok):
>     print "Error unregistering with STAF, RC: %d" % result
>     sys.exit(result)
>
> sys.exit(0)
>
> --------------------------------------------------------------
> Sharon Lucas
> IBM Austin,   *luc...@us.ibm.com* <luc...@us.ibm.com>
> (512) 286-7313 or Tieline 363-7313
>
> ----- Forwarded by Sharon Lucas/Austin/IBM on 07/18/2011 12:20 PM -----
>
> From:        Sharon Lucas/Austin/IBM
> To:        santosh hs <*santosh.tron...@gmail.com*<santosh.tron...@gmail.com>
> >
> Cc:        
> *staf-users@lists.sourceforge.net*<staf-users@lists.sourceforge.net>
> Date:        07/18/2011 12:19 PM
> Subject:        Re: [staf-users] Can some one tell me as how can i use
> STAF in python.
>  ------------------------------
>
>
>
> What is it that you want to do via STAF?  It's difficult to answer how you
> can use STAF if we don't know what it is that you are trying to accomplish
> via test automation.
>
> For example, you could use STAF's PROCESS service to run your Python script
> on a different machine (or on many different machines) if you wanted.  For
> example, perhaps from machine1 you wanted to be able to run this Python
> script on machine2.  You could use STAF's FS (File System) service to copy
> your sample script file from machine1 to machine2 and then use STAF's
> PROCESS service to run this script.  Here are STAF command line line
> examples of how to do this:
>
> STAF machine1 FS COPY FILE "/tmp/test.py" TOFILE /tmp/test.py" TOMACHINE
> machine2
> STAF machine2 PROCESS START SHELL COMMAND "/tmp/test.py" RETURNSTDOUT
> STDERROTSTDOUT WAIT
>
> STAF also provides APIs for submitting STAF service requests via Java,
> C/C++, Python, Perl, and Tcl or you can use STAX.
>
> --------------------------------------------------------------
> Sharon Lucas
> IBM Austin,   *luc...@us.ibm.com* <luc...@us.ibm.com>
> (512) 286-7313 or Tieline 363-7313
>
>
>
>
> From:        santosh hs 
> <*santosh.tron...@gmail.com*<santosh.tron...@gmail.com>
> >
> To:        
> *staf-users@lists.sourceforge.net*<staf-users@lists.sourceforge.net>
> Date:        07/18/2011 10:42 AM
> Subject:        [staf-users] Can some one tell me as how can i use STAF in
> python.
>  ------------------------------
>
>
>
> Can some one tell me as how can i use STAF in python.
> suppose i have script which connects to DB and fetches the data , in this
> case how can i use STAF.
>
> below is sample script
>
> import MySQLdb
> db=MySQLdb.Connect("localhost","root","san123","phone")
> cursor=db.cursor()
> cursor.execute("SELECT * FROM phonebook WHERE Name ='san')
> get_contact=cursor.fetchall()
> print get_contact
> db.close()
>
>
> please let me know how ca i use STAF here, any other simple example for
> STAF usage other than the above script is also appreciated.
>
>
> ------------------------------------------------------------------------------
> AppSumo Presents a FREE Video for the SourceForge Community by Eric
> Ries, the creator of the Lean Startup Methodology on "Lean Startup
> Secrets Revealed." This video shows you how to validate your ideas,
> optimize your ideas and identify your business strategy.*
> **http://p.sf.net/sfu/appsumosfdev2dev*<http://p.sf.net/sfu/appsumosfdev2dev>
> _______________________________________________
> staf-users mailing list*
> **staf-users@lists.sourceforge.net* <staf-users@lists.sourceforge.net>*
> **https://lists.sourceforge.net/lists/listinfo/staf-users*<https://lists.sourceforge.net/lists/listinfo/staf-users>
>
>
>
------------------------------------------------------------------------------
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to