SE_ROOT = pfnRoot[ : pfnRoot.find("=")+1]
            print "\n[WARNING]: "+out[1].strip("\n")
            print "[WARNING] check the directory content wit the command:"
            print "[WARNING]      srmls "+pfnRoot
            print "[WARNING] you may want to maually clean up the directory, e.g. with a similar command:"
            print "[WARNING]    for i in `srmls "+pfnRoot+" | awk '{print $2}'`; do srmrm "+SE_ROOT+"$i ; done"
            print "[WARNING] and then delete the parent directory/ies with srmrmdir\n"
        else: print "\n[WARNING]: ", out

    print "\n---Removing the dataset from DBS for SE: " +site
    # List all storage elements
    print "\nDeleting block replica from "+site
    for block in Blocks:
        try:
            if not IS_CMSSW4:
                api.deleteReplicaFromBlock( block["Name"], str(SiteToSe[site]) )
            else:
                deleteReplicaFromBlock( api, block["Name"], str(SiteToSe[site]) )
            print "Block replica "+block["Name"]+" removed"
        
        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()
            

### invalidate dataset after deletion has been performed for all sites
if options.ALL:
    print "\n----- Invalidating dataset"
    command = "DBSInvalidateDataset.py --DBSURL="+DBS_SERVER[options.DBS]+" --datasetPath="+DATASET+" --files"
    out = popen(command).readlines()
예제 #2
0
#
# 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 storage elements
    print ""
    print "deleting storage element (replica from Block)  ...."
    print api.deleteReplicaFromBlock(
        "/QCD_Pt_120_170/CMSSW_1_2_3-Spring07-JetMet-1174666666/GEN-SIM#a7ae4f12-9af9-4d2a-9bec-cfa047cc488e",
        "sc.cr.cnaf.infn.it")

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"
예제 #3
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 storage elements
  print ""
  print "deleting storage element (replica from Block)  ...."
  print api.deleteReplicaFromBlock("/QCD_Pt_120_170/CMSSW_1_2_3-Spring07-JetMet-1174666666/GEN-SIM#a7ae4f12-9af9-4d2a-9bec-cfa047cc488e", "sc.cr.cnaf.infn.it")
  
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"

예제 #4
0
except getopt.GetoptError:
    print "Please specify --dataset"
    sys.exit(2)

for myopt, myarg in myopts :
    if myopt == "--dataset" :
        datasetpath = myarg

if datasetpath == None:
    print "Please specify --dataset"
    sys.exit(2)

cern_se          = 'srm.cern.ch'

try:
    api = DbsApi(dbsargs)
    try:
        blocks = api.listBlocks(dataset=datasetpath,block_name="*",storage_element_name="*");
    except:
        blocks = []
    for block in blocks:
        for se in block['StorageElementList'] :
            if se['Name'] != cern_se :
                api.deleteReplicaFromBlock(block['Name'],se['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()