Example #1
0
def addToDatasets(sampleAndTier, user=os.getlogin()):
    user, _ = getUserAndArea(user)  #for if we have a magic user name
    notThere = os.system('grep %s ~%s/public/DataSets.txt' %
                         (sampleAndTier, user))
    if notThere:
        os.system('echo %s >> ~%s/public/DataSets.txt' % (sampleAndTier, user))
    return not notThere
Example #2
0
    if len(args) != 1:
        parser.print_help()
        sys.exit(1)

    # Get user comment if one is left
    comment = ""
    if options.commented:
        comment = raw_input("Please enter your comment here:")
    # Store full dataset name
    dirOrFile = args[0]

    # Castor base directory for specified user
    baseDir = castortools.lfnToCastor(castorBaseDir.castorBaseDir(
        options.user))
    #get the user, after taking account of the user_area hack
    user, _ = castorBaseDir.getUserAndArea(options.user)

    # Locations of Logger(.tgz) and containing folder on Castor
    targetDir = baseDir + "/" + args[0].lstrip("/").rstrip("/")
    targetTgz = targetDir + "/Logger.tgz"

    # Get array containing 1) Primary dataset name; 2) Dataset Name; 3+) Tiers
    details = dirOrFile.lstrip("/").split("/")

    # If element is not Primary dataset of dataset name, add to the Tiers array
    count = 0
    tiers = []
    for i in details:
        if count > 1:
            tiers.append(i)
        count += 1
Example #3
0
def addToDatasets(sampleAndTier, user=os.getlogin()):
    user, _ = getUserAndArea(user) #for if we have a magic user name
    notThere = os.system( 'grep %s ~%s/public/DataSets.txt' % (sampleAndTier,user) )
    if notThere:
        os.system('echo %s >> ~%s/public/DataSets.txt' % (sampleAndTier,user) ) 
    return not notThere
Example #4
0
                  dest="listLevel", 
                  help="list level",
                  default=False)

(options,args) = parser.parse_args()

if len(args)!=1:
    parser.print_help()
    sys.exit(1)


castorDir = ""
localDir = ""

# opions.user could be of the form user_area
user,area = cBaseDir.getUserAndArea(options.user)

dataSets = '/afs/cern.ch/user/{first}/{user}/public/DataSets.txt'.format(
    first = user[0], # first letter of the username
    user = user
    )

ifile=open(dataSets,'r')

pattern = re.compile( args[0] )

castorBaseDir = castortools.lfnToCastor(cBaseDir.castorBaseDir( options.user ))

for line in ifile.readlines():
    line = line.rstrip()
    if len(line)==0 or line[0]!='/': continue 
Example #5
0
    # Allow no more than one argument
    if len(args)!=1:
        parser.print_help()
        sys.exit(1)

    # Get user comment if one is left
    comment = ""
    if options.commented:
        comment = raw_input("Please enter your comment here:")
    # Store full dataset name
    dirOrFile = args[0]

    # Castor base directory for specified user
    baseDir = castortools.lfnToCastor(castorBaseDir.castorBaseDir(options.user))
    #get the user, after taking account of the user_area hack
    user, _ = castorBaseDir.getUserAndArea(options.user)

    # Locations of Logger(.tgz) and containing folder on Castor
    targetDir = baseDir + "/" + args[0].lstrip("/").rstrip("/")
    targetTgz = targetDir + "/Logger.tgz"

    # Get array containing 1) Primary dataset name; 2) Dataset Name; 3+) Tiers
    details = dirOrFile.lstrip("/").split("/")

    # If element is not Primary dataset of dataset name, add to the Tiers array
    count = 0
    tiers = []
    for i in details:
        if count>1:
            tiers.append(i)
        count +=1
Example #6
0
                  "--listLevel",
                  dest="listLevel",
                  help="list level",
                  default=False)

(options, args) = parser.parse_args()

if len(args) != 1:
    parser.print_help()
    sys.exit(1)

castorDir = ""
localDir = ""

# opions.user could be of the form user_area
user, area = cBaseDir.getUserAndArea(options.user)

dataSets = '/afs/cern.ch/user/{first}/{user}/public/DataSets.txt'.format(
    first=user[0],  # first letter of the username
    user=user)

ifile = open(dataSets, 'r')

pattern = re.compile(args[0])

castorBaseDir = castortools.lfnToCastor(cBaseDir.castorBaseDir(options.user))

for line in ifile.readlines():
    line = line.rstrip()
    if len(line) == 0 or line[0] != '/': continue
    if pattern.search(line):