Пример #1
0
from DBSAPI.dbsApiException import *
from DBSAPI.dbsOptions import DbsOptionParser

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

    try:
        path = "/TestPrimary_002_20070205_11h52m29s/SIM_20070205_11h52m29s/TestProcessed_20070205_11h52m29s"
        token = path.split("/")
        proc = api.listProcessedDatasets(token[1], token[2], token[3])[0]
        print "proc fetched from DBS %s" % proc
        proc['Name'] = "TestProcessed_20070205_11h52m29s_MERGED"
        proc['ParentList'] = [path]

        print "proc modified to be inserted in DBS %s" % proc
        api.insertProcessedDataset(proc)
        print "Result: %s" % proc

    except DbsDatabaseError, e:
        print e

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"
Пример #2
0
         )

try:
	
    #"""	
    print "\n\nInserting primary %s" % primary
    print api.insertPrimaryDataset (primary)

    print "\n\nInserting Algorithm %s" % algo	
    print api.insertAlgorithm (algo)
    
    print "\n\nInserting Run %s" % run	
    print api.insertRun (run)
    
    print "\n\nInserting Processed %s" % proc	
    print api.insertProcessedDataset (proc)

    print "\n\nInserting Block %s" % block	
    print api.insertBlock (proc, block)
    
    print "\n\nInserting Files %s" % [myfile1, myfile2]	
    print api.insertFiles (proc, [myfile1, myfile2], block)

    print "\n\nInserting Child Processed %s" % procChild
    print api.insertProcessedDataset (procChild)

    print "\n\nInserting Block2 %s" % block2	
    print api.insertBlock (procChild, block2)
 
    print "\n\nInserting Block2 %s" % block21	
    print api.insertBlock (procChild, block21)
                              )
         ) 

   api.insertAlgorithm (algo)

   # Parent Dataset 
   parent_procds = DbsProcessedDataset (
                            PrimaryDataset=primary,
                            Name="TestProcessedDS001-Parent",
                            PhysicsGroup="BPositive",
                            Status="VALID",
                            TierList=['GEN', 'SIM'],
                            AlgoList=[algo],
                            )

   api.insertProcessedDataset(parent_procds) 

   # Lets say child dataset will have two runs
   api.insertRun (DbsRun (
         RunNumber=1,
         NumberOfEvents= 100,
         NumberOfLumiSections= 10,
         TotalLuminosity= 1111,
         StoreNumber= 1234,
         StartOfRun= 'now',
         EndOfRun= 'never',
         ) )

   api.insertRun (  DbsRun (
         RunNumber=2,
         NumberOfEvents= 200,
Пример #4
0
        print "... inserted algorithm"
        
        # processed data set
        processed = DbsProcessedDataset(PrimaryDataset = primary,
                                        AlgoList=[algo],
                                        Name = procName,
                                        TierList = tier.split("-"),
                                        ParentList = [],
                                        PhysicsGroup = "NoGroup",
                                        Status = "VALID",
                                        GlobalTag = "" )
        print "... created processed dataset"
        if len(dbsApi.listProcessedDatasets(patternPrim=primName, patternProc=procName)) != 0:
            print "... processed dataset exists already"
        else:
            dbsApi.insertProcessedDataset(processed)
            print "... inserted processed dataset"
        print "... done"


        # ------------------
        # which files are already there?
        nFilesTot = len(files)
        print "filtering out already published files..."
        publishedDbsFiles = dbsApi.listFiles(path=datasetPath)
        publishedLfn = [x['LogicalFileName'] for x in publishedDbsFiles]
        nPublishedFiles = len(publishedDbsFiles)
        for f in reversed(range(0,len(files))):
            if files[f]["lfn"] in publishedLfn:
                del files[f]
        nFiles = len(files)
Пример #5
0
                            Annotation="This is test",
                            Content="int a= {}, b={c=1, d=33}, f={}, x, y, x"))

    api.insertAlgorithm(algo)

    # Parent Dataset
    parent_procds = DbsProcessedDataset(
        PrimaryDataset=primary,
        Name="TestProcessedDS001-Parent",
        PhysicsGroup="BPositive",
        Status="VALID",
        TierList=['GEN', 'SIM'],
        AlgoList=[algo],
    )

    api.insertProcessedDataset(parent_procds)

    # Lets say child dataset will have two runs
    api.insertRun(
        DbsRun(
            RunNumber=1,
            NumberOfEvents=100,
            NumberOfLumiSections=10,
            TotalLuminosity=1111,
            StoreNumber=1234,
            StartOfRun='now',
            EndOfRun='never',
        ))

    api.insertRun(
        DbsRun(
Пример #6
0
                              )
         )

#primary = DbsPrimaryDataset (Name = "TestPrimary1164750596.79")
primary = DbsPrimaryDataset (Name = "test_primary_001")
proc = DbsProcessedDataset (
                            PrimaryDataset=primary, 
                            Name="TestProcessedDS001", 
                            PhysicsGroup="BPositive",
                            Status="VALID",
                            TierList=['GEN', 'SIM'],
                            AlgoList=[algo],
                            RunsList=[1],   # Provide a Run Number List that goes with this ProcDS
			    #ADSParent="/TestPrimary_001_20080320_13h37m20s/TestProcessed_20080320_13h37m20s/GEN-SIM/TestAnalysisDSDef_005_20080320_13h37m20s"
			    XtCrossSection=1.1
                            )
                             
print "Creating a processed dataset %s" % proc

try:
    api.insertProcessedDataset (proc)
    print "Result: %s" % proc

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"