Name="/test_primary_001" + mytime + "/TestProcessedDS002" + mytime + "/GEN-SIM#3333" ) block3 = DbsFileBlock ( StorageElement=['test1', 'test3'], Name="/test_primary_001" + mytime + "/TestProcessedDS003" + mytime + "/GEN-SIM#3333" ) 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 "...done" else: print "...primary dataset exists already" # ------------------ # processed data set print "inserting processed dataset..." # algorithm psetId = DbsQueryableParameterSet(Hash = "NO_PSET_HASH2", Content = "") algo = DbsAlgorithm(ExecutableName = appName, ApplicationVersion = appVer, ApplicationFamily = appFam, ParameterSetID = psetId) print "... created algorithm" dbsApi.insertAlgorithm(algo) 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:
(opts, args) = optManager.getOpt() api = DbsApi(opts.__dict__) algo = DbsAlgorithm( ExecutableName="TestExe01", ApplicationVersion="TestVersion01", ApplicationFamily="AppFamily01", ParameterSetID=DbsQueryableParameterSet( Hash="001234565798685", Name="MyFirstParam01", Version="V001", Type="test", Annotation="This is test", Content="int a= {}, b={c=1, d=33}, f={}, x, y, x", ), ) print "Creating an algorithm %s" % algo try: api.insertAlgorithm(algo) print "Result: %s" % algo 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"
primary = DbsPrimaryDataset(Name="test_primary_001", Type="TEST") api.insertPrimaryDataset(primary) #Algorithm used by Parent and Child Datasets for our test algo = DbsAlgorithm(ExecutableName="TestExe01", ApplicationVersion="TestVersion01", ApplicationFamily="AppFamily01", ParameterSetID=DbsQueryableParameterSet( Hash="001234565798685", Name="MyFirstParam01", Version="V001", Type="test", 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(