Esempio n. 1
0
    def test_find_job(self):  # asaroka
        from Ganga.GPI import jobtree, Job
        jobtree.cd()
        jobtree.mkdir('a')
        jobtree.mkdir('b')

        j1 = Job(name='j1')
        j2 = Job(name='j2')

        jobtree.add(j1, 'a')
        jobtree.add(j2, 'a')
        jobtree.add(j2, 'b')

        # Make sure we find correct locations
        assert ('/a' in jobtree.find(j1))
        assert ('/a' in jobtree.find(j2))
        assert ('/b' in jobtree.find(j2))

        # Look for rubbish
        assert (jobtree.find(j1.application) == [])

        jobtree.rm('b')
        jobtree.rm('a')

        jobtree.rm('/*')
Esempio n. 2
0
    def test_find(self):  # uegede
        from Ganga.GPI import jobtree, Job
        jobtree.cd()
        jobtree.mkdir('a')
        jobtree.mkdir('b')

        j1 = Job(name='j1')
        j2 = Job(name='j2')

        jobtree.listdirs()
        jobtree.add(j1, 'a')
        jobtree.add(j2, 'a')
        jobtree.add(j2, 'b')

        # Make sure we find correct locations
        assert ('/a' in jobtree.find(str(j1.id)))
        assert ('/a' in jobtree.find(str(j2.id)))
        assert ('/b' in jobtree.find(str(j2.id)))

        # Look for rubbish
        assert (jobtree.find(-1) == [])

        jobtree.rm('b')
        jobtree.rm('a')

        jobtree.rm('/*')
Esempio n. 3
0
    def test_find(self):  # uegede
        from Ganga.GPI import jobtree, Job
        jobtree.cd()
        jobtree.mkdir('a')
        jobtree.mkdir('b')

        j1 = Job(name='j1')
        j2 = Job(name='j2')

        jobtree.listdirs()
        jobtree.add(j1, 'a')
        jobtree.add(j2, 'a')
        jobtree.add(j2, 'b')

        # Make sure we find correct locations
        assert('/a' in jobtree.find(str(j1.id)))
        assert('/a' in jobtree.find(str(j2.id)))
        assert('/b' in jobtree.find(str(j2.id)))

        # Look for rubbish
        assert(jobtree.find(-1) == [])

        jobtree.rm('b')
        jobtree.rm('a')

        jobtree.rm('/*')
Esempio n. 4
0
    def test_find_job(self):  # asaroka
        from Ganga.GPI import jobtree, Job
        jobtree.cd()
        jobtree.mkdir('a')
        jobtree.mkdir('b')

        j1 = Job(name='j1')
        j2 = Job(name='j2')

        jobtree.add(j1, 'a')
        jobtree.add(j2, 'a')
        jobtree.add(j2, 'b')

        # Make sure we find correct locations
        assert('/a' in jobtree.find(j1))
        assert('/a' in jobtree.find(j2))
        assert('/b' in jobtree.find(j2))

        # Look for rubbish
        assert(jobtree.find(j1.application) == [])

        jobtree.rm('b')
        jobtree.rm('a')

        jobtree.rm('/*')
Esempio n. 5
0
    def test_clean(self):  # asaroka
        from Ganga.GPI import jobtree, Job
        jobtree.cd()
        jobtree.mkdir('testdir')
        jobtree.add(Job())
        print("%s" % jobtree)
        jobtree.add(Job(), 'testdir')

        jobtree.rm('/*')
        assert (jobtree.listjobs('/') == [])
        assert (jobtree.listdirs('/') == [])
Esempio n. 6
0
    def test_clean(self):  # asaroka
        from Ganga.GPI import jobtree, Job
        jobtree.cd()
        jobtree.mkdir('testdir')
        jobtree.add(Job())
        print("%s" % jobtree)
        jobtree.add(Job(), 'testdir')

        jobtree.rm('/*')
        assert(jobtree.listjobs('/') == [])
        assert(jobtree.listdirs('/') == [])
Esempio n. 7
0
    def test_i_MiscellaneousFunctionality(self):
        from Ganga.GPI import JobTemplate, Local, Job, templates, jobtree

        # -- MISCFUNCTIONALITY TEMPLATE1 START
        j = JobTemplate()
        j.name = 'LsExeLocal'
        j.application.exe = 'ls'
        j.backend = Local()
        # -- MISCFUNCTIONALITY TEMPLATE1 STOP

        # -- MISCFUNCTIONALITY TEMPLATE2 START
        templates
        # -- MISCFUNCTIONALITY TEMPLATE2 STOP

        # -- MISCFUNCTIONALITY TEMPLATE3 START
        j = Job(templates[0], name = 'JobFromTemplate')
        j.submit()
        # -- MISCFUNCTIONALITY TEMPLATE3 STOP

        # -- MISCFUNCTIONALITY JOBTREE START
        # show the current job tree (empty to start with)
        jobtree

        # make some dirs and subdirs
        jobtree.mkdir('test_old')
        jobtree.mkdir('test')
        jobtree.mkdir('prod')
        jobtree.mkdir('/test/jan')
        jobtree.mkdir('/prod/full')

        # have a look at the tree
        jobtree.printtree()

        # remove a dir
        jobtree.rm('test_old')

        # create some jobs and add them
        jobtree.cd('/test/jan')
        jobtree.add( Job() )
        jobtree.cd('/prod/full')
        jobtree.add(Job())
        jobtree.add(Job())

        # look at the tree again
        jobtree.printtree()

        # submit the some jobs
        jobtree.getjobs().submit()
Esempio n. 8
0
    def test_i_MiscellaneousFunctionality(self):
        from Ganga.GPI import JobTemplate, Local, Job, templates, jobtree

        # -- MISCFUNCTIONALITY TEMPLATE1 START
        j = JobTemplate()
        j.name = 'LsExeLocal'
        j.application.exe = 'ls'
        j.backend = Local()
        # -- MISCFUNCTIONALITY TEMPLATE1 STOP

        # -- MISCFUNCTIONALITY TEMPLATE2 START
        templates
        # -- MISCFUNCTIONALITY TEMPLATE2 STOP

        # -- MISCFUNCTIONALITY TEMPLATE3 START
        j = Job(templates[0], name='JobFromTemplate')
        j.submit()
        # -- MISCFUNCTIONALITY TEMPLATE3 STOP

        # -- MISCFUNCTIONALITY JOBTREE START
        # show the current job tree (empty to start with)
        jobtree

        # make some dirs and subdirs
        jobtree.mkdir('test_old')
        jobtree.mkdir('test')
        jobtree.mkdir('prod')
        jobtree.mkdir('/test/jan')
        jobtree.mkdir('/prod/full')

        # have a look at the tree
        jobtree.printtree()

        # remove a dir
        jobtree.rm('test_old')

        # create some jobs and add them
        jobtree.cd('/test/jan')
        jobtree.add(Job())
        jobtree.cd('/prod/full')
        jobtree.add(Job())
        jobtree.add(Job())

        # look at the tree again
        jobtree.printtree()

        # submit the some jobs
        jobtree.getjobs().submit()
Esempio n. 9
0
    def Savannah74531(self):
        from Ganga.GPI import Job, jobs, jobtree

        index = 10
        while index > 0:
            Job()
            index -= 1

        testSlice = jobs[0:4]
        testList1 = jobs.select(4, 7)
        testList2 = [jobs[8], jobs[9]]

        jobtree.cd()
        jobtree.mkdir('testTreeOne')

        jobtree.add(testSlice, 'testTreeOne')
        jobtree.add(testList1, 'testTreeOne')
        jobtree.add(testList2, 'testTreeOne')

        jobtree.rm('testTreeOne')
Esempio n. 10
0
    def Savannah74531(self):
        from Ganga.GPI import Job, jobs, jobtree

        index = 10
        while index > 0:
           Job()
           index -= 1

        testSlice = jobs[0:4]
        testList1 = jobs.select(4, 7)
        testList2 = [jobs[8], jobs[9]]

        jobtree.cd()
        jobtree.mkdir('testTreeOne')

        jobtree.add(testSlice, 'testTreeOne')
        jobtree.add(testList1, 'testTreeOne')
        jobtree.add(testList2, 'testTreeOne')

        jobtree.rm('testTreeOne')
Esempio n. 11
0
    def test_directory(self):
        from Ganga.GPI import jobtree, Job
        jobtree.cd()
        assert (jobtree.pwd() == '/')

        jobtree.mkdir('testdir')

        # it is OK to mkdir an existing directory
        jobtree.mkdir('testdir')

        assert ('testdir' in jobtree.ls()['folders'])

        jobtree.cd('testdir')
        assert (jobtree.pwd() == '/testdir')

        j = Job()
        jobtree.add(j)
        assert (str(j.id) in jobtree.ls()['jobs'])
        assert (str(j.id) in jobtree.ls('/testdir')['jobs'])

        jobtree.cd('..')
        assert (jobtree.pwd() == '/')

        assert (str(j.id) in jobtree.ls('/testdir')['jobs'])

        assert (str(j.id) not in jobtree.ls()['jobs'])

        jobtree.rm('/*')
Esempio n. 12
0
    def test_directory(self):
        from Ganga.GPI import jobtree, Job
        jobtree.cd()
        assert(jobtree.pwd() == '/')

        jobtree.mkdir('testdir')

        # it is OK to mkdir an existing directory
        jobtree.mkdir('testdir')

        assert('testdir' in jobtree.ls()['folders'])

        jobtree.cd('testdir')
        assert(jobtree.pwd() == '/testdir')

        j = Job()
        jobtree.add(j)
        assert(str(j.id) in jobtree.ls()['jobs'])
        assert(str(j.id) in jobtree.ls('/testdir')['jobs'])

        jobtree.cd('..')
        assert(jobtree.pwd() == '/')

        assert(str(j.id) in jobtree.ls('/testdir')['jobs'])

        assert(str(j.id) not in jobtree.ls()['jobs'])

        jobtree.rm('/*')
Esempio n. 13
0
    def test_addremove(self):
        from Ganga.GPI import jobtree, Job
        jobtree.cd()

        # make sure the job is really added
        j = Job()
        jobtree.add(j)
        assert (str(j.id) in jobtree.ls()['jobs'])

        # make sure the addition is not automatic
        j2 = Job()
        assert (not str(j2.id) in jobtree.ls()['jobs'])

        try:
            jobtree.rm(j2.id)
        except TreeError as x:
            pass

        # make sure the job may be deleted
        jobtree.rm(j.id)

        jobtree.rm('/*')
Esempio n. 14
0
    def test_addremove(self):
        from Ganga.GPI import jobtree, Job
        jobtree.cd()

        # make sure the job is really added
        j = Job()
        jobtree.add(j)
        assert(str(j.id) in jobtree.ls()['jobs'])

        # make sure the addition is not automatic
        j2 = Job()
        assert(not str(j2.id) in jobtree.ls()['jobs'])

        try:
            jobtree.rm(j2.id)
        except TreeError as x:
            pass

        # make sure the job may be deleted
        jobtree.rm(j.id)

        jobtree.rm('/*')