Exemplo n.º 1
0
#!/usr/bin/env python
#
# Revision: 1.3 $"
# Id: DBSXMLParser.java,v 1.3 2006/10/26 18:26:04 afaq Exp $"
#
# API Unit tests for the DBS JavaServer.
import sys
from DBSAPI.dbsApi import DbsApi
from DBSAPI.dbsException import *
from DBSAPI.dbsApiException import *
from DBSAPI.dbsOptions import DbsOptionParser

try:
  optManager  = DbsOptionParser()
  (opts,args) = optManager.getOpt()
  api = DbsApi(opts.__dict__)
  for dataset in api.listDatasetPaths():
	print "\n %s" %str(dataset)
	print "Dataset parent: %s" %str(api.listPathParents)
  	for block in api.listBlocks(dataset):
		print "block: %s" %str(block['Name'])
  		for parent in api.listBlockParents(block_name=block['Name']):
     			print "Parent:  %s" % str(parent['Name'])

except DbsApiException, ex:
  print "Caught API Exception %s: %s "  % (ex.getClassName(), ex.getErrorMessage() )
  if ex.getErrorCode() not in (None, ""):
    print "DBS Exception Error Code: ", ex.getErrorCode()


Exemplo n.º 2
0
#!/usr/bin/env python
#
# Revision: 1.3 $"
# Id: DBSXMLParser.java,v 1.3 2006/10/26 18:26:04 afaq Exp $"
#
#
import sys
from DBSAPI.dbsApi import DbsApi
from DBSAPI.dbsException import *
from DBSAPI.dbsApiException import *
from DBSAPI.dbsOptions import DbsOptionParser

try:
  optManager  = DbsOptionParser()
  (opts,args) = optManager.getOpt()
  api = DbsApi(opts.__dict__)
  
  # List all parameter sets
  print "Dataset Paths:"
  #for proc in api.listProcessedDatasets("test_primary_001", "*", "TestProcessedDS002"):
  for path in api.listDatasetPaths():
     print "  %s" % path
  
except DbsApiException, ex:
  print "Caught API Exception %s: %s "  % (ex.getClassName(), ex.getErrorMessage() )
  if ex.getErrorCode() not in (None, ""):
    print "DBS Exception Error Code: ", ex.getErrorCode()

print "Done"

Exemplo n.º 3
0
from DBSAPI.dbsApiException import *
from DBSAPI.dbsOptions import DbsOptionParser

dstURL = sys.argv[1]

optManager  = DbsOptionParser()
(opts,args) = optManager.getOpt()
args = {}
args['url'] = dstURL 
args['mode']='POST'
api = DbsApi(args)

try:
	
	print "\n\nListing Datasets "
	paths = api.listDatasetPaths()
	ranIndex = random.randint(1,len(paths))
	#myDataset = paths[ranIndex]
	myDataset = "/Wjets-sherpa/Summer08_IDEAL_V12_v1/GEN-SIM-RAW"
	print "Selected dataset is %s", myDataset

	print "\nListing Blocks "
	blocks = api.listBlocks(myDataset)
	#print blocks
	
	print "\n Listing Files "
	files = api.listFiles(path = myDataset, retriveList=["all"])
	#print files
	#for path in paths:
	#	print path
	
Exemplo n.º 4
0
#!/usr/bin/env python
#
# Revision: 1.3 $"
# Id: DBSXMLParser.java,v 1.3 2006/10/26 18:26:04 afaq Exp $"
#
#
import sys
from DBSAPI.dbsApi import DbsApi
from DBSAPI.dbsException import *
from DBSAPI.dbsApiException import *
from DBSAPI.dbsOptions import DbsOptionParser

try:
    optManager = DbsOptionParser()
    (opts, args) = optManager.getOpt()
    api = DbsApi(opts.__dict__)

    # List all parameter sets
    print "Dataset Paths:"
    #for proc in api.listProcessedDatasets("test_primary_001", "*", "TestProcessedDS002"):
    for path in api.listDatasetPaths():
        print "  %s" % path

except DbsApiException, ex:
    print "Caught API Exception %s: %s " % (ex.getClassName(),
                                            ex.getErrorMessage())
    if ex.getErrorCode() not in (None, ""):
        print "DBS Exception Error Code: ", ex.getErrorCode()

print "Done"