def init_container(): """ Performs global initializations on the local container on startup. """ _set_container_args(Container.args) interceptorsys = CONF.getValue('interceptor_system',None) if interceptorsys: logging.info("Setting capability container interceptor system") cls = pu.get_class(interceptorsys) Container.interceptor_system = cls() # Collect all service declarations in local code modules ModuleLoader().load_modules() #Load All Resource Descriptions for future decoding description_utility.load_descriptions()
def main(ns={}): print "STARTING...." from ion.services.coi import identity_registry from ion.data import dataobject from ion.resources import coi_resource_descriptions as coi from ion.resources import description_utility description_utility.load_descriptions() client = identity_registry.IdentityRegistryClient(target='mysys.identity') ns.update(locals()) webservice = IdentityWebResource(client) site = server.Site(webservice) reactor.listenTCP(8999, site) ns.update(locals())
def main(): from ion.resources import description_utility description_utility.load_descriptions() bootstrap._set_container_args("{'sys-name':'mysys'}") messaging = {'identity':{'name_type':'worker', 'args':{'scope':'system'}}} yield bootstrap.declare_messaging(messaging) services = [ { 'name':'identity', 'module':'ion.services.coi.identity_registry', 'class':'IdentityRegistryService', 'spawnargs':{ 'sys-name':'mysys', 'servicename':'identity', 'scope':'system' } } ] yield bootstrap.spawn_processes(services)
def _start_container(self): """ Starting and initialzing the container with a connection to a broker. @note Hardwired to connect to amoeba for broker. """ mopt = {} mopt['broker_host'] = CONF['broker_host'] mopt['broker_port'] = CONF['broker_port'] mopt['broker_vhost'] = CONF['broker_vhost'] mopt['broker_heartbeat'] = CONF['broker_heartbeat'] mopt['boot_script'] = None mopt['script'] = None self.cont_conn = yield container.startContainer(mopt) bootstrap.init_container() self.procRegistry = base_process.procRegistry self.test_sup = yield bootstrap.create_supervisor() #Load All Resource Descriptions for future decoding description_utility.load_descriptions() logging.info("============Magnet container started, "+repr(self.cont_conn))
def _start_container(self): """ Starting and initialzing the container with a connection to a broker. @note Hardwired to connect to amoeba for broker. """ mopt = {} mopt['broker_host'] = CONF['broker_host'] mopt['broker_port'] = CONF['broker_port'] mopt['broker_vhost'] = CONF['broker_vhost'] mopt['broker_heartbeat'] = CONF['broker_heartbeat'] mopt['boot_script'] = None mopt['script'] = None self.cont_conn = yield container.startContainer(mopt) bootstrap.init_container() self.procRegistry = base_process.procRegistry self.test_sup = yield bootstrap.create_supervisor() #Load All Resource Descriptions for future decoding description_utility.load_descriptions() logging.info("============Magnet container started, " + repr(self.cont_conn))
def main(): from ion.resources import description_utility description_utility.load_descriptions() bootstrap._set_container_args("{'sys-name':'mysys'}") messaging = { 'identity': { 'name_type': 'worker', 'args': { 'scope': 'system' } } } yield bootstrap.declare_messaging(messaging) services = [{ 'name': 'identity', 'module': 'ion.services.coi.identity_registry', 'class': 'IdentityRegistryService', 'spawnargs': { 'sys-name': 'mysys', 'servicename': 'identity', 'scope': 'system' } }] yield bootstrap.spawn_processes(services)
from twisted.internet import defer from twisted.python import log from ion.core import bootstrap from ion.resources import description_utility from ion.resources import description_utility description_utility.load_descriptions() @defer.inlineCallbacks def main(): bootstrap._set_container_args("{'sys-name':'mysys'}") messaging = { 'registry': { 'name_type': 'worker', 'args': { 'scope': 'system' } } } services = [{ 'name': 'registry', 'module': 'ion.data.datastore.registry', 'class': 'RegistryService', 'spawnargs': { 'sys-name': 'mysys', 'servicename': 'registry', 'scope': 'system' }
from twisted.internet import defer from twisted.python import log from magnet.container import Container from ion.resources import description_utility description_utility.load_descriptions() @defer.inlineCallbacks def main(ns={}): from ion.data.datastore import registry from ion.data.dataobject import Resource yield Container.configure_messaging('mysys.registry', {'name_type':'worker', 'args':{'scope':'system'}, 'scope':'system'}) client = registry.RegistryClient(target='mysys.registry') r = Resource.create_new_resource() r.name = 'thing' yield client.register_resource(r) ref = r.reference() r2 = yield client.get_resource(ref) print r2 ns.update(locals())