block21 = DbsFileBlock ( StorageElement=['test1', 'test3'], 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)
from DBSAPI.dbsAlgorithm import DbsAlgorithm from DBSAPI.dbsPrimaryDataset import DbsPrimaryDataset from DBSAPI.dbsRun import DbsRun from DBSAPI.dbsQueryableParameterSet import DbsQueryableParameterSet from DBSAPI.dbsProcessedDataset import DbsProcessedDataset try: optManager = DbsOptionParser() (opts,args) = optManager.getOpt() api = DbsApi(opts.__dict__) import pdb ##Primary Dataset 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" ) )
from DBSAPI.dbsAlgorithm import DbsAlgorithm from DBSAPI.dbsPrimaryDataset import DbsPrimaryDataset from DBSAPI.dbsRun import DbsRun from DBSAPI.dbsQueryableParameterSet import DbsQueryableParameterSet from DBSAPI.dbsProcessedDataset import DbsProcessedDataset try: optManager = DbsOptionParser() (opts, args) = optManager.getOpt() api = DbsApi(opts.__dict__) import pdb ##Primary Dataset 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)
if len(primName)==0 or len(procName)==0 or len(tier) == 0: badDataSetPath(badDataSetPath) print "primary dataset name: ", primName print "processed dataset name: ", procName print "tier name: ", tier print "application name: ", appName print "application version: ", appVer print "se: ", seName print "#################################################################################################" # ------------------ # primary dataset print "inserting new primary dataset..." primary = DbsPrimaryDataset (Name = primName, Type='test') if len(dbsApi.listPrimaryDatasets(primName)) == 0: dbsApi.insertPrimaryDataset (primary) 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"
#Content="int a= {}, b={c=1, d=33}, f={}, x, y, x" ) ) try: api.insertAlgorithm (algo) print "## Inserted Algorithm: %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() #Create all the primary DS for primary in priDSDic.keys(): try: api.insertPrimaryDataset (DbsPrimaryDataset (Name = primary, Type="COSMIC")) print "##Inserted Primary: %s ##" % primary 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() #create all the processed DS & blocks in db for processed in psDSDic.keys(): algoList=[] primaryName = processed.split('/')[0] processedName = processed.split('/')[1] versions = verPsDSDic[processed] versionList = versions.split(':') for v in versionList: