コード例 #1
0
ファイル: GPIexport.py プロジェクト: pseyfert/ganga
def _addToInterface(interface, name, _object):

    if isType(_object, GangaObject):
        setattr(interface, name, addProxy(_object))
    elif isclass(_object) and issubclass(_object, GangaObject):
        setattr(interface, name, getProxyClass(_object))
    else:
        setattr(interface, name, _object)
コード例 #2
0
ファイル: GPIexport.py プロジェクト: MannyMoo/ganga
def _addToInterface(interface, name, _object):

    if isType(_object, GangaObject):
        setattr(interface, name, addProxy(_object))
    elif isclass(_object) and issubclass(_object, GangaObject):
        setattr(interface, name, getProxyClass(_object))
    else:
        setattr(interface, name, _object)
コード例 #3
0
ファイル: TestCustomMerger.py プロジェクト: MannyMoo/ganga
from __future__ import absolute_import

import os
import tempfile

import pytest

from GangaTest.Framework.utils import write_file
from Ganga.GPIDev.Base.Proxy import getProxyClass
from Ganga.GPIDev.Adapters.IPostProcessor import PostProcessException

from Ganga.testlib.GangaUnitTest import GangaUnitTest
from Ganga.testlib.monitoring import run_until_completed, run_until_state
from .CopySplitter import CopySplitter

CopySplitter = getProxyClass(CopySplitter)


class TestCustomMerger(GangaUnitTest):

    def setUp(self):
        super(TestCustomMerger, self).setUp()
        from Ganga.GPI import Job, Executable, Local, File, LocalFile

        self.jobslice = []
        self.file_name = 'id_echo.sh'

        for i in range(2):

            j = Job(application=Executable(), backend=Local())
コード例 #4
0
ファイル: TestMergeFailures.py プロジェクト: pseyfert/ganga
from __future__ import absolute_import

import os

import pytest

from GangaTest.Framework.utils import sleep_until_state
from Ganga.testlib.monitoring import run_until_completed, run_until_state
from Ganga.GPIDev.Base.Proxy import getProxyClass

from Ganga.testlib.GangaUnitTest import GangaUnitTest
from .MergerTester import MergerTester
from .CopySplitter import CopySplitter

CopySplitter = getProxyClass(CopySplitter)
MergerTester = getProxyClass(MergerTester)


class TestMergeFailures(GangaUnitTest):
    def testMergeThatAlwaysFails(self):
        from Ganga.GPI import Job, Executable, Local, LocalFile

        j = Job()
        j.application = Executable(exe='sh', args=['-c', 'echo foo > out.txt'])
        j.backend = Local()
        j.outputfiles = [LocalFile('out.txt')]
        j.splitter = CopySplitter()
        j.postprocessors = MergerTester(files=['out.txt'])

        j.submit()
コード例 #5
0
from __future__ import absolute_import

import os

import pytest

from GangaTest.Framework.utils import sleep_until_state
from Ganga.testlib.monitoring import run_until_completed, run_until_state
from Ganga.GPIDev.Base.Proxy import getProxyClass

from Ganga.testlib.GangaUnitTest import GangaUnitTest
from .MergerTester import MergerTester
from .CopySplitter import CopySplitter

CopySplitter = getProxyClass(CopySplitter)
MergerTester = getProxyClass(MergerTester)


class TestMergeFailures(GangaUnitTest):
    def testMergeThatAlwaysFails(self):
        from Ganga.GPI import Job, Executable, Local, LocalFile

        j = Job()
        j.application = Executable(exe="sh", args=["-c", "echo foo > out.txt"])
        j.backend = Local()
        j.outputfiles = [LocalFile("out.txt")]
        j.splitter = CopySplitter()
        j.postprocessors = MergerTester(files=["out.txt"])

        j.submit()
コード例 #6
0
ファイル: __init__.py プロジェクト: VladimirRomanovsky/ganga
        logger.error('Reason: %s' % str(err))

for r in allRuntimes.values():
    try:
        r.loadPlugins()
    except Exception as err:
        logger.error("problems with loading plugins for %s -- ignored" % r.name)
        logger.error('Reason: %s' % str(err))

# ------------------------------------------------------------------------------------
# make all plugins visible in GPI
for k in allPlugins.allCategories():
    for n in allPlugins.allClasses(k):
        cls = allPlugins.find(k, n)
        if not cls._declared_property('hidden'):
            exportToPublicInterface(n, getProxyClass(cls), 'Classes')

# ------------------------------------------------------------------------------------
# set the default value for the plugins
default_plugins_cfg = getConfig("Plugins")

for opt in default_plugins_cfg:
    try:
        category, tag = opt.split('_')
    except ValueError, err:
        logger.warning("do not understand option %s in [Plugins]", opt)
        logger.debug('Reason: want %s' % str(err))
    else:
        if tag == 'default':
            try:
                allPlugins.setDefault(category, default_plugins_cfg[opt])
コード例 #7
0
ファイル: TestCustomMerger.py プロジェクト: pseyfert/ganga
from __future__ import absolute_import

import os
import tempfile

import pytest

from GangaTest.Framework.utils import write_file
from Ganga.GPIDev.Base.Proxy import getProxyClass
from Ganga.GPIDev.Adapters.IPostProcessor import PostProcessException

from Ganga.testlib.GangaUnitTest import GangaUnitTest
from Ganga.testlib.monitoring import run_until_completed, run_until_state
from .CopySplitter import CopySplitter

CopySplitter = getProxyClass(CopySplitter)


class TestCustomMerger(GangaUnitTest):
    def setUp(self):
        super(TestCustomMerger, self).setUp()
        from Ganga.GPI import Job, Executable, Local, File, LocalFile

        self.jobslice = []
        self.file_name = 'id_echo.sh'

        for i in range(2):

            j = Job(application=Executable(), backend=Local())

            scriptString = '''
コード例 #8
0
from __future__ import absolute_import

try:
    import unittest2 as unittest
except ImportError:
    import unittest
import random
import string

from Ganga.GPIDev.Base.Proxy import addProxy, getProxyClass, getProxyAttr, isProxy, isType, stripProxy

from Ganga.GPIDev.Lib.GangaList.GangaList import GangaList
GangaList = getProxyClass(GangaList)
from .TFile import TFile
TFile = getProxyClass(TFile)

# set the seed for repeatable tests
random.seed(666)

from Ganga.Utility.logging import getLogger
logger = getLogger(modulename=True)


class TestGangaList(unittest.TestCase):

    def __init__(self, *args, **kwargs):
        super(TestGangaList, self).__init__(*args, **kwargs)

        self.plain1 = []
        self.plain2 = []
コード例 #9
0
ファイル: TestTFile.py プロジェクト: MannyMoo/ganga
import unittest

from Ganga.GPIDev.Base.Proxy import getProxyClass
from . import TFile

TFile = getProxyClass(TFile)

class TestTFile(unittest.TestCase):

    def testEqualityName(self):
        t1 = TFile(name='foo')
        t2 = TFile(name='foo')
        assert t1 == t2, 'These two files should be equal.'

    def testEqualityNameInvert(self):
        t1 = TFile(name='foo')
        t2 = TFile(name='bar')
        assert t1 != t2, 'These two files should not be equal.'

    def testEqualitySubDir(self):
        t1 = TFile(name='foo')
        t2 = TFile(name='foo', subdir='..')
        assert t1 != t2, 'These two files should not be equal.'

    def testHash(self):
        t1 = TFile(name='foo')
        t2 = TFile(name='foo')
        assert t1 == t2
        assert hash(t1) == hash(t2)

    def testHashNotEqual(self):
コード例 #10
0
ファイル: TestTFile.py プロジェクト: pseyfert/ganga
import unittest

from Ganga.GPIDev.Base.Proxy import getProxyClass
from . import TFile

TFile = getProxyClass(TFile)


class TestTFile(unittest.TestCase):
    def testEqualityName(self):
        t1 = TFile(name='foo')
        t2 = TFile(name='foo')
        assert t1 == t2, 'These two files should be equal.'

    def testEqualityNameInvert(self):
        t1 = TFile(name='foo')
        t2 = TFile(name='bar')
        assert t1 != t2, 'These two files should not be equal.'

    def testEqualitySubDir(self):
        t1 = TFile(name='foo')
        t2 = TFile(name='foo', subdir='..')
        assert t1 != t2, 'These two files should not be equal.'

    def testHash(self):
        t1 = TFile(name='foo')
        t2 = TFile(name='foo')
        assert t1 == t2
        assert hash(t1) == hash(t2)

    def testHashNotEqual(self):