Пример #1
0
      self.add_option("--url=",action="store", type="string", dest="url", 
           help="specify URL, e.g. --url=http://cmssrv17.fnal.gov:8989/DBS/servlet/DBSServlet, If no url is provided default url from dbs.config is attempted")

      self.add_option("--query", action="store", type="string", dest="query", default="",
                help="query in tag1=value1&tag2=value2... format")


if __name__ == "__main__":

        try:
                optManager  = DbsQueryOptionParser()
                (opts,args) = optManager.parse_args()
                opts = opts.__dict__

                if opts['url'] in ('', None, 'BADURL'):
			configDict = DbsConfig(opts)
			opts['url'] = str(configDict.url())

                if opts['query'] in (None, ""):
                        print "You must specify a query, Use --query=, look at --help"
                        sys.exit(0)

                api = DbsApi(opts)
		print opts['query']
		#print api.executeQuery(opts['query'], 2, 5, "query")
		#print api.executeQuery(opts['query'], 1,5,type="exe")
		#print api.executeQuery(opts['query'], ignoreCase=False)
		print api.executeQuery(opts['query'])
  		#print api.executeQuery("select file,ls where path=/GlobalMar08-Express/Online/RAW")

	except DbsApiException, ex:
Пример #2
0
            "--value",
            action="store",
            type="string",
            dest="value",
            help="Value can be GOOD, BAD and UNKNOWN or a INTEGER value")


if __name__ == "__main__":

    try:
        optManager = DbsDQOptionParser()
        (opts, args) = optManager.parse_args()
        opts = opts.__dict__

        if opts['url'] in ('', None, 'BADURL'):
            configDict = DbsConfig(opts)
            opts['url'] = str(configDict.url())

        #if opts['url'] in ('', None, 'BADURL'):
        #	print "You must specify a valid DBS URL, use --url= or --help"
        #	sys.exit(0)

        if opts['dataset'] in ('', None):
            print "You must specify a valid dataset path, use --run= or --help"
            sys.exit(0)

        if opts['run'] in ('', None):
            print "You must specify a valid run number, use --run= or --help"
            sys.exit(0)

        if opts['flag'] in ('', None):