1 from __future__
import print_function
2 from __future__
import absolute_import
3 from optparse
import OptionParser
4 import sys,os, re, subprocess, datetime
6 from .
import eostools
as castortools
9 '''COLIN: do something cleaner with tagPackage''' 14 dirLocalOrTgzDirOnCastor = dirLocalOrTgzDirOnCastor.rstrip(
'/')
16 if self.
isDirLocal( dirLocalOrTgzDirOnCastor ):
17 self.
dirLocal = dirLocalOrTgzDirOnCastor
21 raise ValueError( dirLocalOrTgzDirOnCastor +
' is neither a tgz directory on castor (provide a LFN!) nor a local directory')
25 if os.path.isdir( file ):
31 '''Checks if file is a .tgz file in an eos dir''' 32 if not castortools.isCastorDir( file ):
33 file = castortools.castorToLFN(file)
35 if castortools.isLFN( file ):
36 tgzPattern = re.compile(
'.*\.tgz$')
37 m = tgzPattern.match( file )
45 isTgzDirOnCastor = isTgzDirOnEOS
57 os.system(
'cp %s %s' % (file, self.
dirLocal) )
60 showtagsLog =
'logger_showtags.txt' 61 diffLog =
'logger_diff.txt' 69 nJobs =
'logger_jobs.txt' 71 out.write(
'NJobs: %i\n' % n)
77 os.chdir( os.getenv(
'CMSSW_BASE') +
'/src/' )
78 diffCmd =
'git diff -p --stat --color=never > %s/%s 2> /dev/null' % (oldPwd, log)
85 os.chdir( os.getenv(
'CMSSW_BASE') +
'/src/' )
86 cmd =
'echo "Test Release based on: $CMSSW_VERSION" > %s/%s 2> /dev/null' % (oldPwd, log)
88 cmd =
'echo "Base Release in: $CMSSW_RELEASE_BASE" >> %s/%s 2> /dev/null' % (oldPwd, log)
90 cmd =
'echo "Your Test release in: $CMSSW_BASE" >> %s/%s 2> /dev/null' % (oldPwd, log)
92 cmd =
'git status --porcelain -b | head -n 1 >> %s/%s 2> /dev/null' % (oldPwd, log)
94 cmd =
'git log -n 100 --format="%%T %%ai %%s %%d" >> %s/%s 2> /dev/null' % (oldPwd, log)
103 os.system( cmsStage )
106 os.system(
'tar -zxvf ' + tgzDir)
107 os.system(
'rm ' + tgzDir )
108 (root, ext) = os.path.splitext(tgzDir)
111 print(
'cannot stage in, the log had not been staged out')
115 castorDir = castortools.eosToLFN( castorDir )
116 if not castortools.isLFN( castorDir ):
117 print(
'cannot stage out, you need to provide an LFN as a destination directory, beginning with /store .')
122 tgzCmd =
'tar -zcvf ' + tgzDir +
' ' + self.
dirLocal 125 cmsStage =
'cmsStage -f %s %s' % (tgzDir, castorDir )
127 os.system( cmsStage )
128 os.system(
'rm ' + tgzDir )
131 print(
'cannot stage out, the log is not staged in')
S & print(S &os, JobReport::InputFile const &f)
def isDirLocal(self, file)
def stageOut(self, castorDir)
def isTgzDirOnEOS(self, file)
def __init__(self, dirLocalOrTgzDirOnCastor)