Esempio n. 1
0
    def test_Savannah9007(self):
        from Ganga.GPI import Job

        j = Job()

        from Ganga.Utility.Config import getConfig
        if not getConfig('Output')['ForbidLegacyInput']:
            j.inputsandbox = ['x']
        else:
            j.inputfiles = ['x']
Esempio n. 2
0
def submitpilots(n=1, doTerm=True):
	"""Submit a number of pilotjobs"""
	if n <= 0: return
	from Ganga.GPI import Job, Executable, File
	j = Job()
	j.application = Executable(exe=File(config['PilotScript']), args=[])
	j.name = 'LGIpilot'
	if not doTerm: j.name = 'LGIpilot@'
	j.inputsandbox = [File(config['PilotDist'])]
	j.application.env['LGI_IS_PILOTJOB'] = '1'

	if doTerm:
		j.application.env['SCHED_WAIT_TERM'] = str(config['WaitTerm'])

	if config['MaxRuntime'] is not None:
		j.application.env['SCHED_TERM_AFTER'] = str(config['MaxRuntime'])

	j.submit()
	for i in range(1, n-1):
		j = j.copy()
		j.submit()
	# returns last job
	return j
Esempio n. 3
0
    def testShortCuts(self):
        """Make sure that shortcuts are called"""
        from Ganga.GPIDev.Base.Proxy import isType, TypeMismatchError
        from Ganga.GPI import Job, LocalFile
        j = Job()

        from Ganga.GPIDev.Lib.File import File as gFile

        from Ganga.Utility.Config import getConfig
        if not getConfig('Output')['ForbidLegacyInput']:

            def testList(_list):
                for l in _list:
                    assert isType(l, gFile), 'All entries must be Files'

            j.inputsandbox = [File(self._makeRandomString())
                              for _ in range(10)]
            assert len(j.inputsandbox) == 10, 'Must be added correctly'
            testList(j.inputsandbox)

            # now create with shortcuts - must still work
            list_one = [self._makeRandomString() for _ in range(10)]
            j.inputsandbox = list_one
            assert len(j.inputsandbox) == 10, 'Must be added correctly'
            testList(j.inputsandbox)

            # now use mutable methods instead
            list_two = [self._makeRandomString() for _ in range(10)]
            j.inputsandbox.extend(list_two)
            assert len(j.inputsandbox) == 20, 'Must be added correctly'
            testList(j.inputsandbox)

            try:
                # no shortcut for this
                j.inputsandbox.append(666)
                assert False, 'Must get an Error here'
            except TypeMismatchError:
                pass
        else:
            def testList(_list):
                for l in _list:
                    print("Testing: '%s' type: '%s'" % (l, type(l)))
                    assert isType(l, IGangaFile), "All entries must be of type IGangaFile"

            list_one = [LocalFile(self._makeRandomString()) for _ in range(10)]
            j.inputfiles = list_one
            assert len(j.inputfiles) == 10, "Must add correctly"
            testList(j.inputfiles)

            list_two = [LocalFile(self._makeRandomString()) for _ in range(10)]
            j.inputfiles = list_two
            assert len(j.inputfiles) == 10, "Must still be added correctly"
            assert j.inputfiles == list_two, "Must have been overloaded"
            testList(j.inputfiles)

            list_third = [LocalFile(self._makeRandomString()) for _ in range(10)]
            j.inputfiles.extend(list_third)
            assert len(j.inputfiles) == 20, "Must be added correctly finally"
            testList(j.inputfiles)

            try:
                j.inputfiles.append(666)
                assert False, "Must get an Error Here!"
            except:
                pass
Esempio n. 4
0
    def testShortCuts(self):
        """Make sure that shortcuts are called"""
        from Ganga.GPIDev.Base.Proxy import isType, TypeMismatchError
        from Ganga.GPI import Job, LocalFile
        j = Job()

        from Ganga.GPIDev.Lib.File import File as gFile

        from Ganga.Utility.Config import getConfig
        if not getConfig('Output')['ForbidLegacyInput']:

            def testList(_list):
                for l in _list:
                    assert isType(l, gFile), 'All entries must be Files'

            j.inputsandbox = [
                File(self._makeRandomString()) for _ in range(10)
            ]
            assert len(j.inputsandbox) == 10, 'Must be added correctly'
            testList(j.inputsandbox)

            # now create with shortcuts - must still work
            list_one = [self._makeRandomString() for _ in range(10)]
            j.inputsandbox = list_one
            assert len(j.inputsandbox) == 10, 'Must be added correctly'
            testList(j.inputsandbox)

            # now use mutable methods instead
            list_two = [self._makeRandomString() for _ in range(10)]
            j.inputsandbox.extend(list_two)
            assert len(j.inputsandbox) == 20, 'Must be added correctly'
            testList(j.inputsandbox)

            try:
                # no shortcut for this
                j.inputsandbox.append(666)
                assert False, 'Must get an Error here'
            except TypeMismatchError:
                pass
        else:

            def testList(_list):
                for l in _list:
                    print("Testing: '%s' type: '%s'" % (l, type(l)))
                    assert isType(
                        l,
                        IGangaFile), "All entries must be of type IGangaFile"

            list_one = [LocalFile(self._makeRandomString()) for _ in range(10)]
            j.inputfiles = list_one
            assert len(j.inputfiles) == 10, "Must add correctly"
            testList(j.inputfiles)

            list_two = [LocalFile(self._makeRandomString()) for _ in range(10)]
            j.inputfiles = list_two
            assert len(j.inputfiles) == 10, "Must still be added correctly"
            assert j.inputfiles == list_two, "Must have been overloaded"
            testList(j.inputfiles)

            list_third = [
                LocalFile(self._makeRandomString()) for _ in range(10)
            ]
            j.inputfiles.extend(list_third)
            assert len(j.inputfiles) == 20, "Must be added correctly finally"
            testList(j.inputfiles)

            try:
                j.inputfiles.append(666)
                assert False, "Must get an Error Here!"
            except:
                pass