Esempio n. 1
0
    def test_Savannah8009(self):
        from Ganga.GPI import Executable, Job, jobs, templates

        from GangaTest.Framework.utils import sleep_until_completed

        j = Job()
        j.submit()

        self.assertEqual(len(jobs), 1)
        self.assertEqual(len(templates), 0)

        if not sleep_until_completed(j, timeout=120):
            assert not "Timeout on job submission: job is still not finished"

        t = j.copy()

        # make sure that copy creates a new job (and not the template)
        self.assertEqual(len(jobs), 2)
        self.assertEqual(len(templates), 0)

        # make sure that output parameters are not carried forward
        self.assertNotEqual(j.backend.id, t.backend.id)
        self.assertNotEqual(j.backend.exitcode, t.backend.exitcode)

        # make sure that input parameters are carried forward
        self.assertEqual(j.application.exe, t.application.exe)
Esempio n. 2
0
    def test_Savannah8111(self):
        from Ganga.GPI import Job

        j1 = Job()
        j1.name = 'Gauss Job'
        jj = j1.copy()
        self.assertEqual(jj.name, 'Gauss Job')
Esempio n. 3
0
    def test_Savannah8009(self):
        from Ganga.GPI import Executable, Job, jobs, templates

        from GangaTest.Framework.utils import sleep_until_completed

        j = Job()
        j.submit()

        self.assertEqual(len(jobs), 1)
        self.assertEqual(len(templates), 0)

        if not sleep_until_completed(j, timeout=120):
            assert(not "Timeout on job submission: job is still not finished")

        t = j.copy()

        # make sure that copy creates a new job (and not the template)
        self.assertEqual(len(jobs), 2)
        self.assertEqual(len(templates), 0)

        # make sure that output parameters are not carried forward
        self.assertNotEqual(j.backend.id, t.backend.id)
        self.assertNotEqual(j.backend.exitcode, t.backend.exitcode)

        # make sure that input parameters are carried forward
        self.assertEqual(j.application.exe, t.application.exe)
    def test_Savannah8111(self):
        from Ganga.GPI import Job

        j1 = Job()
        j1.name = 'Gauss Job'
        jj = j1.copy()
        self.assertEqual(jj.name, 'Gauss Job')
Esempio n. 5
0
    def Savannah88651(self):
        from Ganga.GPI import Job, config

        # Feature request 88651 was to allow the behaviour of copying a prepared job to be configurable.
        # Specifically, the user wanted to be able to control whether the job/application was unprepared upon copying.

        # test 1: do not unprepare the job when copying
        a = Job()
        a.prepare()
        config['Preparable']['unprepare_on_copy'] = False
        b = a.copy()

        self.assertNotEqual(b.application.is_prepared, None)

        config['Preparable']['unprepare_on_copy'] = True
        b = a.copy()
        # b's application should now be unprepared when copied from a.
        self.assertEqual(b.application.is_prepared, None)
Esempio n. 6
0
    def Savannah33303(self):
        from Ganga.GPI import Job

        j = Job()
        id = j.id

        for i in xrange(1, 20):
            j = j.copy()
            self.assertEqual(j.id, id + i)
Esempio n. 7
0
    def test_c_JobManipulation(self):

        from Ganga.GPI import runMonitoring, Job, jobs, export, load

        runMonitoring()

        # -- JOBMANIPULATION JOBCOPY START
        j = Job(name='original')
        j2 = j.copy()
        j2.name = 'copy'
        j.submit()
        j3 = Job(j, name='copy2')
        jobs
        # -- JOBMANIPULATION JOBCOPY STOP

        # -- JOBMANIPULATION REPOACCESS START
        jobs(2)
        # -- JOBMANIPULATION REPOACCESS STOP

        # -- JOBMANIPULATION JOBSLICING START
        jobs[2]
        jobs[2:]
        jobs['copy2']
        # -- JOBMANIPULATION JOBSLICING STOP

        jobs(0).kill()
        # -- JOBMANIPULATION RESUBMIT START
        jobs(0).resubmit()
        # -- JOBMANIPULATION RESUBMIT STOP

        # -- JOBMANIPULATION FORCESTATUS START
        jobs(1).force_status('failed')
        # -- JOBMANIPULATION FORCESTATUS STOP

        # -- JOBMANIPULATION JOBREMOVE START
        jobs(2).remove()
        # -- JOBMANIPULATION JOBREMOVE STOP

        # -- JOBMANIPULATION JOBSELECT START
        # can select on ids, name, status, backend, application
        jobs.select(status='new')
        jobs.select(backend='Local')
        jobs.select(ids=[1, 3])

        # can restrict on min/max id
        jobs.select(1, 3, application='Executable')
        # -- JOBMANIPULATION JOBSELECT STOP

        # -- JOBMANIPULATION JOBSELECTOP START
        jobs.select(status='new').submit()
        # -- JOBMANIPULATION JOBSELECTOP STOP

        # -- JOBMANIPULATION EXPORTJOB START
        export(jobs(0), 'my_job.txt')
        jlist = load('my_job.txt')
        jlist[0].submit()
Esempio n. 8
0
    def test_c_JobManipulation(self):

        from Ganga.GPI import runMonitoring, Job, jobs, export, load

        runMonitoring()

        # -- JOBMANIPULATION JOBCOPY START
        j = Job(name = 'original')
        j2 = j.copy()
        j2.name = 'copy'
        j.submit()
        j3 = Job(j, name = 'copy2')
        jobs
        # -- JOBMANIPULATION JOBCOPY STOP

        # -- JOBMANIPULATION REPOACCESS START
        jobs(2)
        # -- JOBMANIPULATION REPOACCESS STOP

        # -- JOBMANIPULATION JOBSLICING START
        jobs[2]
        jobs[2:]
        jobs['copy2']
        # -- JOBMANIPULATION JOBSLICING STOP

        jobs(0).kill()
        # -- JOBMANIPULATION RESUBMIT START
        jobs(0).resubmit()
        # -- JOBMANIPULATION RESUBMIT STOP

        # -- JOBMANIPULATION FORCESTATUS START
        jobs(1).force_status('failed')
        # -- JOBMANIPULATION FORCESTATUS STOP

        # -- JOBMANIPULATION JOBREMOVE START
        jobs(2).remove()
        # -- JOBMANIPULATION JOBREMOVE STOP

        # -- JOBMANIPULATION JOBSELECT START
        # can select on ids, name, status, backend, application
        jobs.select(status='new')
        jobs.select(backend='Local')
        jobs.select(ids=[1,3])

        # can restrict on min/max id
        jobs.select(1,3, application='Executable')
        # -- JOBMANIPULATION JOBSELECT STOP

        # -- JOBMANIPULATION JOBSELECTOP START
        jobs.select(status='new').submit()
        # -- JOBMANIPULATION JOBSELECTOP STOP

        # -- JOBMANIPULATION EXPORTJOB START
        export(jobs(0), 'my_job.txt')
        jlist = load('my_job.txt')
        jlist[0].submit()
Esempio n. 9
0
 def test_job_equality(self):
     """Check that copies of Jobs are equal to each other"""
     from Ganga.GPI import Job
     j = Job()
     j2 = j.copy()
     j3 = Job(j)
     assert j == j2
     assert j2 == j3
     assert stripProxy(j) == stripProxy(j2)
     assert stripProxy(j2) == stripProxy(j3)
Esempio n. 10
0
def test_unprepareTrue(gpi):
    from Ganga.GPI import Job, Executable
    j = Job(application=Executable(exe='/bin/echo', args=['hello']))
    j.submit()

    assert j.application.is_prepared is not None

    j2 = j.copy()

    assert j2.application.is_prepared is None

    j3 = Job(j)

    assert j3.application.is_prepared is None
Esempio n. 11
0
    def test_Savannah8534(self):
        from Ganga.GPI import Job, TestApplication, TestSubmitter

        app = TestApplication()

        j = Job(backend=TestSubmitter(time=30), application=app)
        j.submit()

        self.assertNotEqual(j.status, 'new')

        j2 = j.copy()

        # make sure that the status is reset correctly as well as the output parameters
        self.assertEqual(j2.status, 'new')
        self.assertEqual(j2.backend.start_time, 0)
Esempio n. 12
0
    def test_SubmitAndRemoval(self):
        from Ganga.GPI import Job, TestSubmitter
        
        j = Job()
        j.backend = TestSubmitter(time=1, update_delay=5)
        j.submit()
        all = [j]

        for i in range(10):
            j2 = j.copy()
            j2.submit()
            all.append(j2)

        for j in all:
            j.remove()
Esempio n. 13
0
    def test_SubmitAndRemoval(self):
        from Ganga.GPI import Job, TestSubmitter

        j = Job()
        j.backend = TestSubmitter(time=1, update_delay=5)
        j.submit()
        all = [j]

        for i in range(10):
            j2 = j.copy()
            j2.submit()
            all.append(j2)

        for j in all:
            j.remove()
Esempio n. 14
0
def test_unprepareFalse(gpi):

    from Ganga.GPI import Job, Executable
    k = Job(application=Executable(exe='/bin/echo', args=['hello']))
    k.submit()

    assert k.application.is_prepared is not None

    k2 = k.copy()

    assert k2.application.is_prepared is not None

    k3 = Job(k)

    assert k.application.is_prepared is not None
Esempio n. 15
0
    def test_unprepareTrue(self):

        from Ganga.Utility.Config import setConfigOption
        from Ganga.GPI import Job, Executable
        setConfigOption('Preparable', 'unprepare_on_copy', 'True')
        j = Job(application=Executable(exe='/bin/echo', args=['hello']))
        j.submit()

        assert (j.application.is_prepared != None)

        j2 = j.copy()

        assert (j2.application.is_prepared == None)

        j3 = Job(j)

        assert (j3.application.is_prepared == None)
Esempio n. 16
0
    def test_unprepareFalse(self):

        from Ganga.Utility.Config import setConfigOption
        from Ganga.GPI import Job, Executable
        setConfigOption('Preparable', 'unprepare_on_copy', 'False')
        k = Job(application=Executable(exe='/bin/echo', args=['hello']))
        k.submit()

        assert(k.application.is_prepared != None)

        k2 = k.copy()

        assert(k2.application.is_prepared != None)

        k3 = Job(k)

        assert(k.application.is_prepared != None)
Esempio n. 17
0
    def test_unprepareTrue(self):

        from Ganga.Utility.Config import setConfigOption
        from Ganga.GPI import Job, Executable
        setConfigOption('Preparable', 'unprepare_on_copy', 'True')
        j = Job(application=Executable(exe='/bin/echo', args=['hello']))
        j.submit()

        assert(j.application.is_prepared != None)

        j2 = j.copy()

        assert(j2.application.is_prepared == None)

        j3 = Job(j)

        assert(j3.application.is_prepared == None)
Esempio n. 18
0
    def test_unprepareFalse(self):

        from Ganga.Utility.Config import setConfigOption
        from Ganga.GPI import Job, Executable
        setConfigOption('Preparable', 'unprepare_on_copy', 'False')
        k = Job(application=Executable(exe='/bin/echo', args=['hello']))
        k.submit()

        assert (k.application.is_prepared != None)

        k2 = k.copy()

        assert (k2.application.is_prepared != None)

        k3 = Job(k)

        assert (k.application.is_prepared != None)
Esempio n. 19
0
    def testJobCopy(self):
        """Test that a job copy copies everything properly"""
        from Ganga.GPI import Job, ARC, GenericSplitter, GangaDataset, LocalFile, FileChecker
        from Ganga.GPIDev.Base.Proxy import isType

        j = Job()
        j.application.exe = "sleep"
        j.application.args = ['myarg']
        j.backend = ARC()
        j.backend.CE = "my.ce"
        j.inputdata = GangaDataset()
        j.inputdata.files = [ LocalFile("*.txt") ]
        j.inputfiles = [ LocalFile("*.txt") ]
        j.name = "testname"
        j.outputfiles = [ LocalFile("*.txt") ]
        j.postprocessors = FileChecker(files=['stdout'], searchStrings = ['my search'])
        j.splitter = GenericSplitter()
        j.splitter.attribute = "application.args"
        j.splitter.values = ['arg 1', 'arg 2', 'arg 3']
        j2 = j.copy()

        # test the copy has worked
        self.assertTrue( isType(j2, Job) )
        self.assertEqual( j2.application.exe, "sleep" )
        self.assertEqual( j2.application.args, ["myarg"] )
        self.assertTrue( isType(j2.backend, ARC) )
        self.assertEqual( j2.backend.CE, "my.ce" )
        self.assertTrue( isType(j2.inputdata, GangaDataset) )
        self.assertEqual( len(j2.inputdata.files), 1 )
        self.assertTrue( isType(j2.inputdata.files[0], LocalFile) )
        self.assertEqual( j2.inputdata.files[0].namePattern, "*.txt" )
        self.assertEqual( len(j2.inputfiles), 1 )
        self.assertTrue( isType(j2.inputfiles[0], LocalFile) )
        self.assertEqual( j2.inputfiles[0].namePattern, "*.txt" )
        self.assertEqual( j2.name, "testname" )
        self.assertEqual( len(j2.outputfiles), 1 )
        self.assertTrue( isType(j2.outputfiles[0], LocalFile) )
        self.assertEqual( j2.outputfiles[0].namePattern, "*.txt" )
        self.assertEqual( len(j2.postprocessors), 1 )
        self.assertTrue( isType(j2.postprocessors[0], FileChecker) )
        self.assertEqual( j2.postprocessors[0].files, ["stdout"] )
        self.assertEqual( j2.postprocessors[0].searchStrings, ["my search"] )
        self.assertTrue( isType(j2.splitter, GenericSplitter) )
        self.assertEqual( j2.splitter.attribute, "application.args" )
        self.assertEqual( j2.splitter.values, ['arg 1', 'arg 2', 'arg 3'])
Esempio n. 20
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