Exemple #1
0
def main():
    parser = argparse.ArgumentParser(description="CC Control script")
    parser.add_argument("pidfile", help="pidfile to use. If not specified, uses the first one found.")
    parser.add_argument("command", help="command to send to the container agent", choices=IContainerAgent.names())
    parser.add_argument("commandargs", metavar="arg", nargs="*", help="arguments to the command being sent")

    opts = parser.parse_args()

    pidfile = opts.pidfile
    if not pidfile:
        raise Exception("No pidfile specified")

    parms = {}
    with open(pidfile, "r") as pf:
        parms = msgpack.loads(pf.read())

    assert parms, "No content in pidfile"

    node, ioloop = make_node(parms["messaging"])
    cc = RPCClient(node=node, name=(parms["container-xp"], parms["container-agent"]))

    # make a manual call - this is to avoid having to have the IonObject for the call
    methdefs = [x[1] for x in IContainerAgent.namesAndDescriptions() if x[0] == opts.command]
    assert len(methdefs) == 1

    arg_names = methdefs[0].positional  # ('name', 'module', 'cls', 'config')
    msg_args = msgpack.dumps(
        dict(zip(arg_names, opts.commandargs))
    )  # ('name', <usrinp1>, 'cls', <usrinp2>) -> { 'name' : <usrinp1>, 'cls': <usrinp2> }
    retval = cc.request(msg_args, op=opts.command)

    print "Returned", retval
    node.client.close()
Exemple #2
0
class TestProcessInt(IonIntegrationTestCase):
    def setUp(self):
        self._start_container()
        self.pid = self.container.spawn_process('fake',
                                                'pyon.ion.test.test_process',
                                                'FakeService')
        self.fsclient = RPCClient(to_name='fake_service')

    @unittest.skip("timeouts removed 18 oct 2012")
    def test_timeout_with_messaging(self):
        with self.assertRaises(IonTimeout) as cm:
            self.fsclient.request({}, op='takes_too_long', timeout=5)

        self.assertIn('execute in allotted time', cm.exception.message)

    @unittest.skipIf(os.getenv('CEI_LAUNCH_TEST', False),
                     "Test reaches into container, doesn't work with CEI")
    @unittest.skip("heartbeat failing process is disabled")
    def test_heartbeat_failure(self):
        self.patch_cfg(
            'pyon.ion.process.CFG', {
                'cc': {
                    'timeout': {
                        'heartbeat_proc_count_threshold': 2,
                        'heartbeat': 1.0
                    }
                }
            })

        svc = self.container.proc_manager.procs[self.pid]
        ip = svc._process
        stopar = AsyncResult()
        self.container.proc_manager.add_proc_state_changed_callback(
            lambda *args: stopar.set(args))

        noticear = AsyncResult()  # notify us when the call has been made
        ar = ip._routing_call(svc.takes_too_long, None, noticear=noticear)

        noticear.get(timeout=10)  # wait for the call to be made

        # heartbeat a few times so we trigger the failure soon
        for x in xrange(2):
            ip.heartbeat()

        # wait for ip thread to kick over
        ip._ctrl_thread.join(timeout=5)

        # now wait for notice proc got canned
        stopargs = stopar.get(timeout=5)

        self.assertEquals(stopargs,
                          (svc, ProcessStateEnum.FAILED, self.container))

        # should've shut down, no longer in container's process list
        self.assertEquals(len(self.container.proc_manager.procs), 0)
Exemple #3
0
    def __init__(self, process=None, **kwargs):
        self._process = process

        if 'to_name' in kwargs and kwargs['to_name'] is not None and not isinstance(kwargs['to_name'], BaseTransport):
            container = (hasattr(self._process, 'container') and self._process.container) or self._get_container_instance()
            if container:
                kwargs['to_name'] = container.create_xn_service(kwargs['to_name'])
            else:
                log.info('No container at ProcessRPCClient init time, will wait until message send to upgrade to Exchange Object')

        RPCClient.__init__(self, **kwargs)
 def register_dataset(self, data_product_id=''):
     procs,_ = self.clients.resource_registry.find_resources(restype=RT.Process, id_only=True)
     pid = None
     for p in procs:
         if 'registration_worker' in p:
             pid = p
     if not pid: 
         log.warning('No registration worker found')
         return
     rpc_cli = RPCClient(to_name=pid)
     rpc_cli.request({'data_product_id':data_product_id}, op='register_dap_dataset')
Exemple #5
0
    def __init__(self, process=None, **kwargs):
        self._process = process

        if 'to_name' in kwargs and kwargs['to_name'] is not None and not isinstance(kwargs['to_name'], BaseTransport):
            container = (hasattr(self._process, 'container') and self._process.container) or self._get_container_instance()
            if container:
                # Client creates the service XN
                kwargs['to_name'] = container.create_service_xn(kwargs['to_name'])
            else:
                log.info('No container at ProcessRPCClient init time, will wait until message send to upgrade to Exchange Object')

        RPCClient.__init__(self, **kwargs)
Exemple #6
0
    def test_rpc_client(self, iomock):
        node = Mock(spec=NodeB)

        rpcc = RPCClient(node=node, to_name="simply", iface=ISimpleInterface)
        rpcc.node.channel.return_value = self._setup_mock_channel()

        self.assertTrue(hasattr(rpcc, 'simple'))

        ret = rpcc.simple(one="zap", two="zip")

        iomock.assert_called_once_with('SimpleInterface_simple_in', one='zap', two='zip')
        self.assertEquals(ret, "bidirmsg")
Exemple #7
0
    def test_rpc_client(self, iomock):
        node = Mock(spec=NodeB)

        rpcc = RPCClient(node=node, to_name="simply", iface=ISimpleInterface)
        rpcc.node.channel.return_value = self._setup_mock_channel()

        self.assertTrue(hasattr(rpcc, "simple"))

        ret = rpcc.simple(one="zap", two="zip")

        iomock.assert_called_once_with("SimpleInterface_simple_in", one="zap", two="zip")
        self.assertEquals(ret, "bidirmsg")
Exemple #8
0
    def __init__(self, process=None, **kwargs):
        self._process = process
        self._declare_name = kwargs.pop("declare_name", True)  # MM: Prevent senders from declaring with wrong AMQP properties

        if 'to_name' in kwargs and kwargs['to_name'] is not None and not isinstance(kwargs['to_name'], BaseTransport):
            container = (hasattr(self._process, 'container') and self._process.container) or self._get_container_instance()
            if container:
                if self._declare_name:
                    # NOTE: What if this is a process or agent client? Cannot declare with known properties.
                    # Client creates the service XN
                    kwargs['to_name'] = container.create_service_xn(kwargs['to_name'])
            else:
                log.info('No container at ProcessRPCClient init time, will wait until message send to upgrade to Exchange Object')

        RPCClient.__init__(self, **kwargs)
Exemple #9
0
    def create_endpoint(self, to_name=None, existing_channel=None, **kwargs):
        if not self._process:
            raise StandardError("No Process specified")

        # upgrade to exchange object
        if to_name is None and not isinstance(self._send_name, BaseTransport):
            container = self._process.container or self._get_container_instance()
            if not container:
                raise StandardError("No container found, can not upgrade to ExchangeObject")

            if self._declare_name:
                self._send_name = container.create_service_xn(self._send_name)

        # upgrade one timers too
        if to_name is not None and not isinstance(to_name, BaseTransport):
            container = self._process.container or self._get_container_instance()
            if not container:
                raise StandardError("No container found, can not upgrade to ExchangeObject")

            if self._declare_name:
                to_name = container.create_service_xn(to_name)

        newkwargs = kwargs.copy()
        newkwargs['process'] = self._process
        return RPCClient.create_endpoint(self, to_name, existing_channel, **newkwargs)
Exemple #10
0
    def create_endpoint(self, to_name=None, existing_channel=None, **kwargs):
        if not self._process:
            raise StandardError("No Process specified")

        newkwargs = kwargs.copy()
        newkwargs['process'] = self._process
        return RPCClient.create_endpoint(self, to_name, existing_channel, **newkwargs)
Exemple #11
0
    def create_endpoint(self, to_name=None, existing_channel=None, **kwargs):
        if not self._process:
            raise StandardError("No Process specified")

        # upgrade to exchange object
        if to_name is None and not isinstance(self._send_name, BaseTransport):
            container = self._process.container or self._get_container_instance(
            )
            if not container:
                raise StandardError(
                    "No container found, can not upgrade to ExchangeObject")

            if self._declare_name:
                self._send_name = container.create_service_xn(self._send_name)

        # upgrade one timers too
        if to_name is not None and not isinstance(to_name, BaseTransport):
            container = self._process.container or self._get_container_instance(
            )
            if not container:
                raise StandardError(
                    "No container found, can not upgrade to ExchangeObject")

            if self._declare_name:
                to_name = container.create_service_xn(to_name)

        newkwargs = kwargs.copy()
        newkwargs['process'] = self._process
        return RPCClient.create_endpoint(self, to_name, existing_channel,
                                         **newkwargs)
Exemple #12
0
    def create_endpoint(self, to_name=None, existing_channel=None, **kwargs):
        if not self._process:
            raise StandardError("No Process specified")

        newkwargs = kwargs.copy()
        newkwargs['process'] = self._process
        return RPCClient.create_endpoint(self, to_name, existing_channel, **newkwargs)
    def register_dataset(self, dataset_id='', external_data_product_name=''):
        dataset_obj = self.read_dataset(dataset_id)
        dataset_obj.registered = True
        self.update_dataset(dataset=dataset_obj)
        external_data_product_name = external_data_product_name or dataset_obj.name

        procs,_ = self.clients.resource_registry.find_resources(restype=RT.Process, id_only=True)
        pid = None
        for p in procs:
            if 'registration_worker' in p:
                pid = p
        if not pid: 
            log.warning('No registration worker found')
            return
        rpc_cli = RPCClient(to_name=pid)
        rpc_cli.request({'dataset_id':dataset_id, 'data_product_name':external_data_product_name}, op='register_dap_dataset')
Exemple #14
0
class TestProcessInt(IonIntegrationTestCase):
    def setUp(self):
        self._start_container()
        self.pid = self.container.spawn_process('fake', 'pyon.ion.test.test_process', 'FakeService')
        self.fsclient = RPCClient(to_name='fake_service')

    @unittest.skip("timeouts removed 18 oct 2012")
    def test_timeout_with_messaging(self):
        with self.assertRaises(IonTimeout) as cm:
            self.fsclient.request({}, op='takes_too_long', timeout=5)

        self.assertIn('execute in allotted time', cm.exception.message)

    @unittest.skipIf(os.getenv('CEI_LAUNCH_TEST', False), "Test reaches into container, doesn't work with CEI")
    @unittest.skip("heartbeat failing process is disabled")
    def test_heartbeat_failure(self):
        self.patch_cfg('pyon.ion.process.CFG', {'cc':{'timeout':{'heartbeat_proc_count_threshold':2, 'heartbeat':1.0}}})

        svc = self.container.proc_manager.procs[self.pid]
        ip = svc._process
        stopar = AsyncResult()
        self.container.proc_manager.add_proc_state_changed_callback(lambda *args: stopar.set(args))

        noticear = AsyncResult()        # notify us when the call has been made
        ar = ip._routing_call(svc.takes_too_long, None, noticear=noticear)

        noticear.get(timeout=10)        # wait for the call to be made

        # heartbeat a few times so we trigger the failure soon
        for x in xrange(2):
            ip.heartbeat()

        # wait for ip thread to kick over
        ip._ctrl_thread.join(timeout=5)

        # now wait for notice proc got canned
        stopargs = stopar.get(timeout=5)

        self.assertEquals(stopargs, (svc, ProcessStateEnum.FAILED, self.container))

        # should've shut down, no longer in container's process list
        self.assertEquals(len(self.container.proc_manager.procs), 0)
    def register_dataset(self, dataset_id='', external_data_product_name=''):
        dataset_obj = self.read_dataset(dataset_id)
        dataset_obj.registered = True
        self.update_dataset(dataset=dataset_obj)
        external_data_product_name = external_data_product_name or dataset_obj.name

        procs, _ = self.clients.resource_registry.find_resources(
            restype=RT.Process, id_only=True)
        pid = None
        for p in procs:
            if 'registration_worker' in p:
                pid = p
        if not pid:
            log.warning('No registration worker found')
            return
        rpc_cli = RPCClient(to_name=pid)
        rpc_cli.request(
            {
                'dataset_id': dataset_id,
                'data_product_name': external_data_product_name
            },
            op='register_dap_dataset')
Exemple #16
0
    def __init__(self, process=None, **kwargs):
        self._process = process
        self._declare_name = kwargs.pop(
            "declare_name", True
        )  # MM: Prevent senders from declaring with wrong AMQP properties

        if 'to_name' in kwargs and kwargs[
                'to_name'] is not None and not isinstance(
                    kwargs['to_name'], BaseTransport):
            container = (
                hasattr(self._process, 'container')
                and self._process.container) or self._get_container_instance()
            if container:
                if self._declare_name:
                    # NOTE: What if this is a process or agent client? Cannot declare with known properties.
                    # Client creates the service XN
                    kwargs['to_name'] = container.create_service_xn(
                        kwargs['to_name'])
            else:
                log.info(
                    'No container at ProcessRPCClient init time, will wait until message send to upgrade to Exchange Object'
                )

        RPCClient.__init__(self, **kwargs)
 def __init__(self, to_name=None, node=None, **kwargs):
     to_name = to_name or __name__ + "test"
     RPCClient.__init__(self, to_name=to_name, node=node, **kwargs)
Exemple #18
0
 def setUp(self):
     self._start_container()
     self.pid = self.container.spawn_process('fake', 'pyon.ion.test.test_process', 'FakeService')
     self.fsclient = RPCClient(to_name='fake_service')
Exemple #19
0
#!/usr/bin/env python

from pyon.net.endpoint import RPCClient
from pyon.net.messaging import make_node
from interface.services.examples.hello.ihello_service import IHelloService
"""
import gevent

from interface.services.ibank_service import IBankService
from interface.services.idatastore_service import IDatastoreService

node,iowat=make_node()

bank = RPCClient(node=node, name="bank", iface=IBankService)
data = RPCClient(node=node, name="datastore", iface=IDatastoreService)
"""

n, io = make_node()

hello = RPCClient(node=n, name=('qq', 'hello'), iface=IHelloService)
Exemple #20
0
 def stats(cls,pid):
     '''
     RPC Method for querying a Transform's internal statistics
     '''
     rpc_cli = RPCClient(to_name=pid)
     return rpc_cli.request({},op='_stat')
Exemple #21
0
 def __init__(self, process=None, **kwargs):
     self._process = process
     RPCClient.__init__(self, **kwargs)
def run_test():
    x509_cert = {
        'certificate':
        """-----BEGIN CERTIFICATE-----
MIIEMzCCAxugAwIBAgICBQAwDQYJKoZIhvcNAQEFBQAwajETMBEGCgmSJomT8ixkARkWA29yZzEX
MBUGCgmSJomT8ixkARkWB2NpbG9nb24x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zS21x8mC6n+MTyYYKVlEW4VSJ3TyMKlR
gAjhxY/LUNeVpfxm2fY8tvQecWaW3mYQLfnvM7f1FeNJwEwIkS/yaeNmcRC6HK/hHeE87+fNVW/U
ftU4FW5Krg3QIYxcTL2vL3JU4Auu3E/XVcx0iqYMGZMEEDOcQPcCgYEA6sLLIeOdngUvxdA4KKEe
qInDpa/coWbtAlGJv8NueYTuD3BYJG5KoWFY4TVfjQsBgdxNxHzxb5l9PrFLm9mRn3iiR/2EpQke
qJzs87K0A/sxTVES29w1PKinkBkdu8pNk10TxtRUl/Ox3fuuZPvyt9hi5c5O/MCKJbjmyJHuJBcC
gYBiAJM2oaOPJ9q4oadYnLuzqms3Xy60S6wUS8+KTgzVfYdkBIjmA3XbALnDIRudddymhnFzNKh8
rwoQYTLCVHDd9yFLW0d2jvJDqiKo+lV8mMwOFP7GWzSSfaWLILoXcci1ZbheJ9607faxKrvXCEpw
xw36FfbgPfeuqUdI5E6fswKBgFIxCu99gnSNulEWemL3LgWx3fbHYIZ9w6MZKxIheS9AdByhp6px
lt1zeKu4hRCbdtaha/TMDbeV1Hy7lA4nmU1s7dwojWU+kSZVcrxLp6zxKCy6otCpA1aOccQIlxll
Vc2vO7pUIp3kqzRd5ovijfMB5nYwygTB4FwepWY5eVfXAoGBAIqrLKhRzdpGL0Vp2jwtJJiMShKm
WJ1c7fBskgAVk8jJzbEgMxuVeurioYqj0Cn7hFQoLc+npdU5byRti+4xjZBXSmmjo4Y7ttXGvBrf
c2bPOQRAYZyD2o+/MHBDsz7RWZJoZiI+SJJuE4wphGUsEbI2Ger1QW9135jKp6BsY2qZ
-----END RSA PRIVATE KEY-----"""
    }

    container = cc.Container()
    container.start()  # :(

    client = RPCClient(node=container.node,
                       name="app_integration",
                       iface=IAppIntegrationService)

    print "Before start client"
    container.start_client('app_integration', client)

    print "Before register user"
    res = client.register_user(x509_cert["certificate"],
                               x509_cert["rsa_private_key"])
    print "After register user: " + str(res)

    container.stop()
Exemple #23
0
parser = argparse.ArgumentParser()
parser.add_argument('-d',
                    '--datasize',
                    type=int,
                    help='Maximum size of data in bytes')
parser.add_argument('-m',
                    '--msgpack',
                    action='store_true',
                    help='Encode data with msgpack')
parser.set_defaults(datasize=1024 * 1024, parallel=1)
opts = parser.parse_args()

node, iowat = make_node()
#dsclient = RPCClient(node=node, name="datastore", iface=IDatastoreService)
hsclient = RPCClient(node=node, name="hello", iface=IHelloService)


def notif(*args, **kwargs):
    print "GOT A BACKPRESSURE NOTICE", str(args), str(kwargs)


node.client.add_backpressure_callback(notif)
node.client.set_backpressure_multiplier(2)

# make data (bytes)
DATA_SIZE = opts.datasize
# base64 encoding wastes a lot of space, truncate it at the exact data size we requested
data = base64.urlsafe_b64encode(os.urandom(DATA_SIZE))[:DATA_SIZE]
if opts.msgpack:
    data = msgpack.dumps(data)
 def __init__(self, to_name=None, node=None, **kwargs):
     to_name = to_name or __name__ + "test"
     RPCClient.__init__(self, to_name=to_name, node=node, **kwargs)
Exemple #25
0
 def setUp(self):
     self._start_container()
     self.pid = self.container.spawn_process('fake',
                                             'pyon.ion.test.test_process',
                                             'FakeService')
     self.fsclient = RPCClient(to_name='fake_service')
Exemple #26
0
 def __init__(self, process=None, **kwargs):
     self._process = process
     RPCClient.__init__(self, **kwargs)
Exemple #27
0
 def test_rpc_client_with_unnamed_args(self):
     rpcc = RPCClient(to_name="simply", iface=ISimpleInterface)
     self.assertRaises(AssertionError, rpcc.simple, "zap", "zip")
def run_test():
    x509_cert = {
        "certificate": """-----BEGIN CERTIFICATE-----
MIIEMzCCAxugAwIBAgICBQAwDQYJKoZIhvcNAQEFBQAwajETMBEGCgmSJomT8ixkARkWA29yZzEX
MBUGCgmSJomT8ixkARkWB2NpbG9nb24xCzAJBgNVBAYTAlVTMRAwDgYDVQQKEwdDSUxvZ29uMRsw
GQYDVQQDExJDSUxvZ29uIEJhc2ljIENBIDEwHhcNMTAxMTE4MjIyNTA2WhcNMTAxMTE5MTAzMDA2
WjBvMRMwEQYKCZIm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E/XVcx0iqYMGZMEEDOcQPcCgYEA6sLLIeOdngUvxdA4KKEe
qInDpa/coWbtAlGJv8NueYTuD3BYJG5KoWFY4TVfjQsBgdxNxHzxb5l9PrFLm9mRn3iiR/2EpQke
qJzs87K0A/sxTVES29w1PKinkBkdu8pNk10TxtRUl/Ox3fuuZPvyt9hi5c5O/MCKJbjmyJHuJBcC
gYBiAJM2oaOPJ9q4oadYnLuzqms3Xy60S6wUS8+KTgzVfYdkBIjmA3XbALnDIRudddymhnFzNKh8
rwoQYTLCVHDd9yFLW0d2jvJDqiKo+lV8mMwOFP7GWzSSfaWLILoXcci1ZbheJ9607faxKrvXCEpw
xw36FfbgPfeuqUdI5E6fswKBgFIxCu99gnSNulEWemL3LgWx3fbHYIZ9w6MZKxIheS9AdByhp6px
lt1zeKu4hRCbdtaha/TMDbeV1Hy7lA4nmU1s7dwojWU+kSZVcrxLp6zxKCy6otCpA1aOccQIlxll
Vc2vO7pUIp3kqzRd5ovijfMB5nYwygTB4FwepWY5eVfXAoGBAIqrLKhRzdpGL0Vp2jwtJJiMShKm
WJ1c7fBskgAVk8jJzbEgMxuVeurioYqj0Cn7hFQoLc+npdU5byRti+4xjZBXSmmjo4Y7ttXGvBrf
c2bPOQRAYZyD2o+/MHBDsz7RWZJoZiI+SJJuE4wphGUsEbI2Ger1QW9135jKp6BsY2qZ
-----END RSA PRIVATE KEY-----""",
    }

    container = cc.Container()
    container.start()  # :(

    client = RPCClient(node=container.node, name="app_integration", iface=IAppIntegrationService)

    print "Before start client"
    container.start_client("app_integration", client)

    print "Before register user"
    res = client.register_user(x509_cert["certificate"], x509_cert["rsa_private_key"])
    print "After register user: " + str(res)

    container.stop()
Exemple #29
0
 def stats(cls, pid):
     '''
     RPC Method for querying a Transform's internal statistics
     '''
     rpc_cli = RPCClient(to_name=pid)
     return rpc_cli.request({}, op='_stat')