Exemplo n.º 1
0
    def testOutputEqualsInput(self):
        """Tests that setting outputdir == inputdir fails always"""
        from Ganga.GPI import TextMerger

        self.runJobSlice()
        tm = TextMerger(overwrite=True)
        tm.files = ['out.txt']

        for j in self.jobslice:
            with pytest.raises(PostProcessException):
                tm.merge(self.jobslice, outputdir=j.outputdir)
Exemplo n.º 2
0
    def testOutputEqualsInput(self):
        """Tests that setting outputdir == inputdir fails always"""
        from Ganga.GPI import TextMerger

        self.runJobSlice()
        tm = TextMerger(overwrite=True)
        tm.files = ['out.txt']

        for j in self.jobslice:
            with pytest.raises(PostProcessException):
                tm.merge(self.jobslice, outputdir=j.outputdir)
Exemplo n.º 3
0
    def testStructureOfMerger(self):
        """Test that structure in the output sandbox is recreated in the merge"""
        from Ganga.GPI import TextMerger
        self.runJobSlice()

        tm = TextMerger()
        tm.files = ['out.txt', 'subdir/out.txt']

        tmpdir = tempfile.mktemp()
        os.mkdir(tmpdir)

        assert tm.merge(self.jobslice, tmpdir), 'Merge must run correctly'
        assert os.path.exists(os.path.join(tmpdir, 'out.txt')), 'Merge must produce the file'
Exemplo n.º 4
0
    def testStructureOfMerger(self):
        """Test that structure in the output sandbox is recreated in the merge"""
        from Ganga.GPI import TextMerger
        self.runJobSlice()

        tm = TextMerger()
        tm.files = ['out.txt', 'subdir/out.txt']

        tmpdir = tempfile.mktemp()
        os.mkdir(tmpdir)

        assert tm.merge(self.jobslice, tmpdir), 'Merge must run correctly'
        assert os.path.exists(os.path.join(
            tmpdir, 'out.txt')), 'Merge must produce the file'
Exemplo n.º 5
0
    def test_h_PostProcessors(self):

        from Ganga.GPI import Job, RootMerger, TextMerger, CustomMerger, SmartMerger, RootFileChecker, FileChecker, \
            Notifier, CustomChecker

        j = Job()

        # -- POSTPROCESSORS APPEND START
        j.postprocessors.append(
            RootMerger(files=['thesis_data.root'],
                       ignorefailed=True,
                       overwrite=True))
        # -- POSTPROCESSORS APPEND STOP

        # -- POSTPROCESSORS TEXTMERGER START
        TextMerger(compress=True)
        # -- POSTPROCESSORS TEXTMERGER STOP

        # -- POSTPROCESSORS ROOTMERGER START
        RootMerger(args='-T')
        # -- POSTPROCESSORS ROOTMERGER STOP

        # -- POSTPROCESSORS CUSTOMMERGER START
        CustomMerger().module = '~/mymerger.py'
        # -- POSTPROCESSORS CUSTOMMERGER STOP

        # -- POSTPROCESSORS SMARTMERGER START
        SmartMerger(files=['thesis_data.root', 'stdout'], overwrite=True)
        # -- POSTPROCESSORS SMARTMERGER STOP

        # -- POSTPROCESSORS SMARTMERGERAPPEND START
        j.postprocessors.append(
            SmartMerger(files=['thesis_data.root', 'stdout'], overwrite=True))
        # -- POSTPROCESSORS SMARTMERGERAPPEND STOP

        # -- POSTPROCESSORS SMARTMERGERAPPEND2 START
        j.postprocessors.append(TextMerger(files=['stdout'], overwrite=True))
        j.postprocessors.append(
            RootMerger(files=['thesis_data.root'], overwrite=False))
        # -- POSTPROCESSORS SMARTMERGERAPPEND2 STOP

        # -- POSTPROCESSORS FILECHECKER START
        fc = FileChecker(files=['stdout'], searchStrings=['Segmentation'])
        # -- POSTPROCESSORS FILECHECKER STOP

        # -- POSTPROCESSORS FILECHECKERMUSTEXIST START
        fc.filesMustExist = True
        # -- POSTPROCESSORS FILECHECKERMUSTEXIST STOP

        # -- POSTPROCESSORS FILECHECKEROPTS START
        fc.searchStrings = ['SUCCESS']
        fc.failIfFound = False
        # -- POSTPROCESSORS FILECHECKEROPTS STOP

        # -- POSTPROCESSORS FILECHECKEROPTS START
        rfc = RootFileChecker(files=["*.root"])
        rfc.files = ["*.root"]
        j.postprocessors.append(rfc)
        # -- POSTPROCESSORS FILECHECKEROPTS STOP

        # -- POSTPROCESSORS CUSTOMCHECKER START
        cc = CustomChecker(module='~/mychecker.py')
        # -- POSTPROCESSORS CUSTOMCHECKER STOP

        # -- POSTPROCESSORS NOTIFIER START
        n = Notifier(address='myaddress.cern.ch')
        # -- POSTPROCESSORS NOTIFIER STOP

        # -- POSTPROCESSORS NOTIFIEROPTS START
        n.verbose = True
        # -- POSTPROCESSORS NOTIFIEROPTS STOP

        # -- POSTPROCESSORS MULTIPLE START
        tm = TextMerger(files=['stdout'], compress=True)
        rm = RootMerger(files=['thesis_data.root'], args='-f6')
        fc = FileChecker(files=['stdout'], searchStrings=['Segmentation'])
        cc = CustomChecker(module='~/mychecker.py')
        n = Notifier(address='myadress.cern.ch')

        j.postprocessors = [tm, rm, fc, cc, n]
        # -- POSTPROCESSORS MULTIPLE STOP

        # -- POSTPROCESSORS MULTIPLE2 START
        j.postprocessors.append(fc)
        j.postprocessors.append(tm)
        j.postprocessors.append(rm)
        j.postprocessors.append(cc)
        j.postprocessors.append(n)
        # -- POSTPROCESSORS MULTIPLE2 STOP

        j.postprocessors.remove(FileChecker())