Development Intro



API reference can be found at http://www.mcs.anl.gov/fl/research/accessgrid/documentation/developer/api_2_4

Example 1 - Run the GetClients.py program

 

  1. Download GetClients.py.
  2. Run the program:

    python GetClients.py https://vv2.mcs.anl.gov:9000/Venues/default

    Note:  OSX users will first need to source the file /Applications/AccessGridToolkit.app/Contents/Resources/setupenv.sh
  3. Examine the GetClients.log file

    Windows:  %APPDATA%\AccessGrid\Logs\GetClients.log
    Otherwise: ~/.AccessGrid/Logs/GetClients.log

Exercise 1 - Retrieve streams from a Venue

 

  1. Copy GetClients.py to GetStreams.py
  2. Modify GetStreams.py to get streams from Venue instead of clients (review Venue.VenueIW API)
  3. Run the program:

    python GetStreams.py https://vv2.mcs.anl.gov:9000/Venues/default

  4. Modify the code to print only the important parts of the returned StreamDescriptions:
    - stream.capability.type, stream.location.host, stream.location.port
  5. Run the program:

    python GetStreams.py https://vv2.mcs.anl.gov:9000/Venues/default

Solution: GetStreams.py 

Exercise 2 - Retrieve streams from a VenueClient

 

  1. Copy GetClients.py to GetUsers.py
  2. Modify code to retrieve list of users from the VenueClient instead of clients from Venue (review VenueClient.VenueClientIW API)
  3. Make sure you have a VenueClient running, and you have entered a venue
  4. Run the program:

    python GetUsers.py https://localhost:11000/VenueClient

Solution: GetUsers.py

Exercise 3 – Build web facade to VenueServer

 

  1. Download VenueServerHTTPFacade.py
  2. Run the program:

    python VenueServerHTTPFacade.py

  3. Access http://localhost:8080 in a web browser; note minimal return.

  4. Modify code to retrieve Venues from VenueServer and return venue names and URLs, on incoming GET request

  5. (optional) Modify server to return additional Venue data: streams, clients, connections, data

  6. (optional) Modify server to return .vv2d files for the listed Venues, which can be used to launch VenueClient from webpage

Solution: VenueServerHTTPFacade_Solution.py

Additional Example - Add Argument Processing

 

  1. Download GetUsers_Args.py
  2. Run the program:

    python GetUsers_Args.py --url=https://localhost:11000/VenueClient

Additional Example - Locate running VenueClient

 

  1. Download GetUsers_Locate.py
  2. Run the program:

    python GetUsers_Locate.py –locate

Additional Example - Add Logging

 

  1. Download GetUsers_Logging.py
  2. Run the program:

    python GetUsers_Logging.py