260 likes | 353 Views
Understand the core architecture and basics of Access Grid Toolkit development, including application initialization, argument processing, logging, and module overviews. Learn how to create, initialize, and interact with AG applications. Dive into interface wrappers, argument options, and logging integration. Explore the API documentation and examples of AG client applications.
E N D
Agenda • Architecture • AG Application Basics • AccessGrid module overview • Example application • Exercises
Technologies • Python • wxPython • pyGlobus • SOAP (SOAPpy) • pyOpenSSL
AG Application Basics An Access Grid client application will perform (at least) these steps: • Create an application instance • Initialize application • Create an interface wrapper • Call methods on the interface wrapper
AG Application Basics • The core of an AG application is an instance of AccessGrid.Toolkit.Application AppBase Application Service CmdlineApplication WXGUIApplication
AG Application Basics • Distinguished between GUI and non-GUI applications to generalize user interactions (for example, prompt for passphrase, error reporting) • CmdlineApplication • Examples: BridgeServer, VenueServer, AGNodeService • WXGUIApplication • Examples: VenueClient, VenueManagement, NodeManagement
Application Initialization • Create AG application instance • Initialize application • Verify certificate repository • Load default certificate • Create proxy certificate • Configure Globus environment app = CmdlineApplication.instance() app.Initialize(appName) • appName is used in logfile name
Argument Processing • Standard Python module optparse is integrated into toolkit • Add option to application before initialization • Access options post-initialization app.AddCmdLineOption( optparse.Option(‘-u’,’—url’, dest=‘url’)) app.Initialize(‘SampleApp’) url = app.GetOption(‘url’)
Standard Toolkit Arguments • The toolkit adds some options to all applications • Available options can be viewed with ‘-h’ or –help • Examples -d (turn on debug) -l <logFileName> --logfilesize <size> --numlogfiles <num> (rollover log files)
Logging • Standard Python module logging is integrated into AccessGrid toolkit • Multiple logging levels are defined (see logging module documentation) • CRITICAL, ERROR, WARNING, INFO, DEBUG • Logging levels can be controlled for individual components in an application • Application will create appName.log (appName is from app.Initialize) in Log directory: • Windows: %APPDATA%\AccessGrid\Logs • Linux/OSX: $HOME/.AccessGrid/Logs • Logging calls in code will appear in logfile, according to call and current logging level • log.debug(‘this is debug logging text’)
AccessGrid Module Overview • AccessGrid • Core toolkit code • AccessGrid.Security • CertificateManager, CertificateRepository, etc. • AuthorizationManager, Role, Action, etc. • AccessGrid.Platform • Platform-specific code • Config.{SystemConfig,UserConfig,etc.} • ProcessManager • AccessGrid.hosting • SOAP implementation adapters
Interfaces and InterfaceWrappers • Described in online API documentation • Interface wrappers are defined in individual modules • For example, AccessGrid.Venue.VenueIW • IW (and I) class methods handle serialization/deserialization of data types from SOAP implementation domain to AG application domain
Available InterfaceWrappers • VenueIW • VenueServerIW • VenueClientIW • AGNodeServiceIW • AGServiceManagerIW • AGServiceIW • AuthorizationManagerIW • SharedApplicationIW • NetworkServiceIW
Types • Many types are found in Descriptions.py • StreamDescription • ApplicationDescription • Others are found in their own modules • ClientProfile • AGParameter • Capability
AG Applications An Access Grid client application will perform (at least) these steps: • Create an application instance • Initialize application • Create an interface wrapper • Call methods on the interface wrapper
Example: GetClients.py #!/usr/bin/python2 import sys from AccessGrid.Toolkit import CmdlineApplication from AccessGrid.Venue import VenueIW url = sys.argv[1] # Create and initialize application app = CmdlineApplication() app.Initialize('qwe') # Create venue interface wrapper venue = VenueIW(url) # Get clients from venue and process clientList = venue.GetClients() for client in clientList: print client
Example: GetClients.py python GetClients.py https://vv2.mcs.anl.gov:9000/Venues/default Profile Type: user Name: Tom Uram Email: turam@mcs.anl.gov Phone Number: Location: Chicago, IL Venue Client URL: https://wormtongue.mcs.anl.gov:11000/VenueClient Public ID: 00000102220e6208008c00dd0022004754d Home Venue: https://vv2.mcs.anl.gov:9000/Venues/default
Example: GetClients.py • Check logfile GetClients.log
Notes • Online workshop materials: http://www.mcs.anl.gov/fl/research/accessgrid/documentation/tutorial/AGTk_2.4 • Online developer documentation (including API reference): http://www.mcs.anl.gov/fl/research/accessgrid/software/developer.html • OSX users will need to source an environment file to run code in a terminal • /Applications/AccessGridToolkit.app/Contents/Resources/setupenv.sh
Exercise: GetStreams.py • Modify GetClients.py to call GetStreams instead of GetClients • Return value is a list of Descriptions.StreamDescription
Exercise: GetUsers.py • Modify GetClients.py to call VenueClientIW.GetUsers • Return value is a list of ClientProfile