CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 import os
6 
7 from castorBaseDir import getUserAndArea
8 
9 def addToDatasets(sampleAndTier, user=os.getlogin()):
10  user, _ = getUserAndArea(user) #for if we have a magic user name
11  notThere = os.system( 'grep %s ~%s/public/DataSets.txt' % (sampleAndTier,user) )
12  if notThere:
13  os.system('echo %s >> ~%s/public/DataSets.txt' % (sampleAndTier,user) )
14  return not notThere
15 
16 
17 if __name__ == '__main__':
18  import sys
19  addToDatasets(sys.argv[1], sys.argv[2])