urlOption = Option("-u", "--url", dest="url", default=None, help="Specify a venue url on the command line.") app.AddCmdLineOption(urlOption) fileOption = Option("-f", "--file", dest="file", default=None, help="Specify a file that contains a venue url.") app.AddCmdLineOption(fileOption) args = app.Initialize() venueUrl = app.GetOption("url") fileName = app.GetOption("file") print "URL: ", venueUrl print "FILE: ", fileName """ There are four valid command line possibilities: GoToVenue3.py --url url GoToVenue3.py --url url --file fileName (use url) GoToVenue3.py --file fileName GoToVenue3.py Mime-Encoded.vv3d file (from web link) Anything else is invalid
nvcOption = Option("-n", "--num-clients", dest="nc", type="int", default=1, help="number of clients to use.") app.AddCmdLineOption(nvcOption) rtOption = Option("-t", "--traverse", dest="rt", type="int", default=10, help="number of venues each client will traverse.") app.AddCmdLineOption(rtOption) try: app.Initialize("ClientSwarm") except: print "Application initialize failed, exiting." sys.exit(-1) print "Getting default venue" venueUri = app.GetOption('url') vcList = list() print "Spawning venue clients" for id in range(app.GetOption("nc")): client = threading.Thread(target=RunClient, name="Venue Client %s" % id, kwargs = {'id':id, 'url': venueUri, 'app' : app, 'verbose' : verbose }) client.start() while 1: numdaemonthreads = 0 threads = threading.enumerate() numthreads = len(threads)
#!/usr/bin/python # import sys from optparse import Option from AccessGrid.Toolkit import CmdlineApplication from AccessGrid.VenueServer import VenueServerIW app = CmdlineApplication() urlOption = Option("-u", "--url", dest="url", default=None, help="URL to the server you want to shut down.") app.AddCmdLineOption(urlOption) try: args = app.Initialize("StopServer") except Exception, e: print "Exception initializing toolkit:", e sys.exit(-1) url = app.GetOption("url") server = VenueServerIW(url) server.Shutdown(0)
app.AddCmdLineOption( Option("--display", type="string", dest="display", default=":9", metavar="DISPLAY", help="Set the display the VNC server should run on. (linux only)") ) app.AddCmdLineOption( Option("-g", "--geometry", type="string", dest="geometry", default="1024x768", metavar="GEOMETRY", help="Set the geometry of the VNC server. (linux only)") ) app.AddCmdLineOption( Option("--depth", type="int", dest="depth", default=24, metavar="DEPTH", help="Set the bit depth to use for the server. (linux only)") ) app.Initialize("VenueVNCServer") log = app.GetLog() # Log options in debug mode if app.GetOption('debug'): log.info("Options:") for opt in ['venueUrl','name','vncserverexe','display','geometry','depth']: log.info(' %s = %s' % (opt,str(app.GetOption(opt)))) # Verify venue url option if not app.GetOption('venueUrl'): msg = "VenueURL must be specified; exiting." print msg log.info(msg) sys.exit(1) # Use the vnc executable specified on the command line, or... vncserverexe = app.GetOption('vncserverexe') if vncserverexe and not os.path.exists(vncserverexe): msg = "Couldn't find vnc server executable %s ; exiting." % (vncserverexe,)
doc = """ This program creates a fictional shared app in a venue then removes it. """ # Initialize app = CmdlineApplication() urlOption = Option("-u", "--url", dest="url", default=None, help="Specify a venue url on the command line.") app.AddCmdLineOption(urlOption) args = app.Initialize() venueUrl = app.GetOption("url") print "URL: ", venueUrl if venueUrl is None: print "Exiting, no url specified." sys.exit(0) venueClient = VenueIW(venueUrl) # Enter the specified venue print "Creating shared application." appDesc = venueClient.CreateApplication( "Charles and Ed's Model Editor", "Bio Shared Model Editory", "application/x-ag-shared-bio-model-editor")
def main(): """ The main routine. """ # Instantiate the app app = CmdlineApplication() caOption = Option( "-C", "--ca", action="store_true", dest="is_ca_mode", default=0, help="Use CA mode for this invocation of the certificate manager.") idOption = Option( "-I", "--id", action="store_false", dest="is_ca_mode", default=0, help="Use ID mode for this invocation of the certificate manager.") forceOption = Option("-f", "--force", action="store_true", dest="force_overwrite", default=0, help="Overwrite existing files.") app.AddCmdLineOption(caOption) app.AddCmdLineOption(idOption) app.AddCmdLineOption(forceOption) try: args = app.Initialize("CertificateManager") except Exception: sys.exit(0) cmd = CertMgrCmdProcessor(app.GetCertificateManager(), app.GetLog()) # # If no args were passed, start up the command-driver # cert mgr. # if app.GetOption("is_ca_mode"): cmd.setCAMode() if len(args) == 0: cmd.cmdloop() else: # # Otherwise, process a single command from teh command line. # cmd.setInteractive(0) cmd.setForceOverwrite(app.GetOption("force_overwrite")) mycmd = args[0] + " " + " ".join(map(lambda a: '"' + a + '"', args[1:])) print mycmd cmd.onecmd(mycmd)