Esempio n. 1
0
class TestReflection(TestCase):
    def setUp(self):
        self.cache = '/tmp/test-cache-%d'%os.getpid()
        os.mkdir(self.cache)
        self.subject = EggCache(cache_dir=self.cache)
    def tearDown(self):
        shutil.rmtree(self.cache)

    def testGetEgg(self):
        path = self.subject.get_egg(egg, repo)
        self.assertTrue(os.path.exists(path))

    def testOnlyDownloadOnce(self):
        # download once
        path = self.subject.get_egg(egg, repo)
        self.assertNotEquals(0, int(os.stat(path).st_size))

        # truncate file
        with open(path, 'w'): pass
        self.assertEquals(0, int(os.stat(path).st_size))

        # request again: should NOT download, sees file already exists
        path = self.subject.get_egg(egg, repo)
        self.assertEquals(0, int(os.stat(path).st_size))
Esempio n. 2
0
from pyon.core.exception import InstStateError
from pyon.public import OT
from pyon.core.bootstrap import IonObject
from pyon.util.containers import get_safe
from pyon.ion.stream import StandaloneStreamPublisher

from ion.agents.instrument.exceptions import InstrumentStateException
from ion.agents.instrument.instrument_agent import InstrumentAgent
from ion.core.includes.mi import DriverEvent
from ion.services.dm.utility.granule.record_dictionary import RecordDictionaryTool

from coverage_model import ParameterDictionary

# TODO: make unique for multiple processes on same VM
EGG_CACHE_DIR = '/tmp/eggs%d' % os.getpid()
EGG_CACHE = EggCache(EGG_CACHE_DIR)
DSA_STATE_KEY = 'dsa_state'


class DataSetAgent(InstrumentAgent):
    """
    this dataset agent has two states: autosampling and idle
    based on InstrumentAgent but override methods to simplify flow control
    generalized ion interface, specialization provided by the driver class.
    """
    ORIGIN_TYPE = "Dataset"

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

        log.debug("Agent: __init__")
Esempio n. 3
0
from pyon.agent.agent import ResourceAgentState
from pyon.core.exception import InstStateError
from pyon.public import OT
from pyon.core.bootstrap import IonObject
from pyon.util.containers import get_safe
from pyon.ion.stream import StandaloneStreamPublisher

from ion.agents.instrument.exceptions import InstrumentStateException
from ion.agents.instrument.instrument_agent import InstrumentAgent
from ion.core.includes.mi import DriverEvent
from ion.services.dm.utility.granule.record_dictionary import RecordDictionaryTool

from coverage_model import ParameterDictionary

# TODO: make unique for multiple processes on same VM
EGG_CACHE = EggCache('/tmp/eggs%d' % os.getpid())


class Poller(object):
    """ abstract class to show API needed for plugin poller objects """
    def __init__(self, config, memento, data_callback, exception_callback):
        pass

    def start(self):
        pass

    def shutdown(self):
        pass


class Parser(object):
Esempio n. 4
0
 def setUp(self):
     self.cache = '/tmp/test-cache-%d'%os.getpid()
     os.mkdir(self.cache)
     self.subject = EggCache(cache_dir=self.cache)