예제 #1
0
    def testPrepareJob(self):

        from Ganga.GPI import Job, LocalFile, prepareGaudiExec

        import os
        if os.path.exists(TestExternalGaudiExec.tmpdir_release):
            os.system("rm -rf %s/*" % TestExternalGaudiExec.tmpdir_release)

        j = Job(application=prepareGaudiExec(
            'DaVinci', latestDaVinci(), TestExternalGaudiExec.tmpdir_release))

        myHelloOpts = path.join(TestExternalGaudiExec.tmpdir_release,
                                'hello.py')

        FileBuffer('hello.py', 'print("Hello")').create(myHelloOpts)

        assert path.isfile(myHelloOpts)

        j.application.options = [LocalFile(myHelloOpts)]

        j.prepare()

        assert j.application.is_prepared.name

        assert path.isdir(j.application.is_prepared.path())
예제 #2
0
    def test_A_Construction(self):
        from Ganga.GPI import Job
        j = Job()

        assert (j.application.is_prepared == None)

        j.prepare()

        assert (j.application.is_prepared != None)

        TestShared.shared_area_location = j.application.is_prepared.path()
        assert (path.isdir(TestShared.shared_area_location))
예제 #3
0
    def testPrepareJob(self):

        from Ganga.GPI import Job, LocalFile, prepareGaudiExec

        j = Job(application=prepareGaudiExec('DaVinci', latestDaVinci(), TestExternalGaudiExec.tmpdir_release))

        myHelloOpts = path.join(TestExternalGaudiExec.tmpdir_release, 'hello.py')

        FileBuffer('hello.py', 'print("Hello")').create(myHelloOpts)

        assert path.isfile(myHelloOpts)

        j.application.options=[LocalFile(myHelloOpts)]

        j.prepare()
예제 #4
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)
예제 #5
0
    def test_A_Construction(self):
        from Ganga.GPI import Job, LocalFile
        j = Job()

        assert(j.application.is_prepared == None)
        
        j.prepare()

        assert(j.application.is_prepared != None)
        
        TestShared.shared_area_location = j.application.is_prepared.path()
        assert(path.isdir(TestShared.shared_area_location))

        TestShared.a_file_location = path.join(j.application.is_prepared.path(), 'a.txt')
        TestShared.b_file_location = path.join(j.application.is_prepared.path(), 'b.txt')

        open(TestShared.a_file_location, 'w').close()
        open(TestShared.b_file_location, 'w').close()
        j.application.is_prepared.associated_files.append(LocalFile(TestShared.a_file_location))
        j.application.is_prepared.associated_files.append(LocalFile(TestShared.b_file_location))
예제 #6
0
    def testPrepareJob(self):

        from Ganga.GPI import Job, LocalFile, prepareGaudiExec

        import os
        if os.path.exists(TestExternalGaudiExec.tmpdir_release):
            os.system("rm -rf %s/*" % TestExternalGaudiExec.tmpdir_release)
            
        j = Job(application=prepareGaudiExec('DaVinci', latestDaVinci(), TestExternalGaudiExec.tmpdir_release))

        myHelloOpts = path.join(TestExternalGaudiExec.tmpdir_release, 'hello.py')

        FileBuffer('hello.py', 'print("Hello")').create(myHelloOpts)

        assert path.isfile(myHelloOpts)

        j.application.options=[LocalFile(myHelloOpts)]

        j.prepare()

        assert j.application.is_prepared.name

        assert path.isdir(j.application.is_prepared.path())
예제 #7
0
    def test_A_Construction(self):
        from Ganga.GPI import Job, LocalFile
        j = Job()

        assert (j.application.is_prepared == None)

        j.prepare()

        assert (j.application.is_prepared != None)

        TestShared.shared_area_location = j.application.is_prepared.path()
        assert (path.isdir(TestShared.shared_area_location))

        TestShared.a_file_location = path.join(
            j.application.is_prepared.path(), 'a.txt')
        TestShared.b_file_location = path.join(
            j.application.is_prepared.path(), 'b.txt')

        open(TestShared.a_file_location, 'w').close()
        open(TestShared.b_file_location, 'w').close()
        j.application.is_prepared.associated_files.append(
            LocalFile(TestShared.a_file_location))
        j.application.is_prepared.associated_files.append(
            LocalFile(TestShared.b_file_location))