CMS 3D CMS Logo

addToDatasets.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # Colin
3 # additional layer, on top of cmsBatch.py
4 
5 from __future__ import absolute_import
6 import os
7 
8 from .castorBaseDir import getUserAndArea
9 
10 def addToDatasets(sampleAndTier, user=os.getlogin()):
11  user, _ = getUserAndArea(user) #for if we have a magic user name
12  notThere = os.system( 'grep %s ~%s/public/DataSets.txt' % (sampleAndTier,user) )
13  if notThere:
14  os.system('echo %s >> ~%s/public/DataSets.txt' % (sampleAndTier,user) )
15  return not notThere
16 
17 
18 if __name__ == '__main__':
19  import sys
20  addToDatasets(sys.argv[1], sys.argv[2])
addToDatasets
Definition: addToDatasets.py:1
addToDatasets.addToDatasets
def addToDatasets(sampleAndTier, user=os.getlogin())
Definition: addToDatasets.py:10
castorBaseDir.getUserAndArea
def getUserAndArea(user)
Definition: castorBaseDir.py:7