Exemplo n.º 1
0
def get_instance(service_name="Steaming3Turbine"):
    """Setup to access your Streams instance.

    ..note::The notebook is work within Cloud and ICP4D.
            Refer to the 'Setup' cells above.
    Returns:
        instance : Access to Streams instance, used for submitting and rendering views.
    """
    try:
        from icpd_core import icpd_util
        import urllib3
        global cfg
        cfg[context.ConfigParams.SSL_VERIFY] = False
        instance = rest.Instance.of_service(cfg)
        print("Within ICP4D")
        urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
    except ImportError:
        cfg = None
        print("Outside ICP4D")
        import credential
        sc = rest.StreamingAnalyticsConnection(
            service_name='Streaming3Turbine',
            vcap_services=credential.vcap_conf)
        instance = sc.get_instances()[0]
    return instance, cfg
 def _launch_sample_job(self):
     # this job is monitored by test.jobs::TestJobStatusSource application
     # PE crash is forced by this application in order to trigger a notification
     topo = Topology("SampleCrashApp")
     self._add_toolkits(topo)
     # Call the crash composite
     test_op = op.Source(topo, "test.jobs::SampleCrashSource",
                         'tuple<boolean dummy>')
     # prepare config and submit the job to Streaming Analytics service
     config = {}
     sc = sr.StreamingAnalyticsConnection()
     config[context.ConfigParams.STREAMS_CONNECTION] = sc
     context.submit(context.ContextTypes.STREAMING_ANALYTICS_SERVICE,
                    topo,
                    config=config)
    def setUp(self):
        Tester.setup_streaming_analytics(self, force_remote_build=True)

        sc = rest.StreamingAnalyticsConnection()
        self.is_v2 = _IAMConstants.V2_REST_URL in sc.credentials
Exemplo n.º 4
0
 def setUp(self):
     Tester.setup_streaming_analytics(self, force_remote_build=True)
     sc = rest.StreamingAnalyticsConnection()
Exemplo n.º 5
0
 def streams_connection(self):
     if self._streams_connection is None:
         self._streams_connection = rest.StreamingAnalyticsConnection(
             self._vcap_services, self._service_name)
     return self._streams_connection
Exemplo n.º 6
0
 def setUpClass(self):
     # start streams service
     connection = sr.StreamingAnalyticsConnection()
     service = connection.get_streaming_analytics()
     result = service.start_instance()
     super().setUpClass()
Exemplo n.º 7
0
 def test_StreamingAnalyticsConnection(self):
     sc = rest.StreamingAnalyticsConnection()
     self.test_config[ConfigParams.STREAMS_CONNECTION] = sc
     result = submit(self.test_ctxtype, self.topo, self.test_config)
     self.assertEqual(result.return_code, 0)
     result.job.cancel()
 def setUpClass(self):
     self.service_name = os.environ.get('STREAMING_ANALYTICS_SERVICE_NAME')
     # start streams service
     connection = sr.StreamingAnalyticsConnection()
     service = connection.get_streaming_analytics()
     result = service.start_instance()
Exemplo n.º 9
0
 def setUp(self):
     Tester.setup_streaming_analytics(self, force_remote_build=True)
     vcap = self.test_config.get('topology.service.vcap')
     sn = self.test_config.get('topology.service.name')
     self.sc = rest.StreamingAnalyticsConnection(vcap, sn)