def _augment_submission_result(self, submission_result): vcap = rest._get_vcap_services(self._vcap_services) credentials = rest._get_credentials(vcap, self._service_name) instance_id = credentials['jobs_path'].split('/service_instances/', 1)[1].split('/', 1)[0] submission_result['instanceId'] = instance_id submission_result['streamsConnection'] = self.streams_connection()
def _augment_submission_result(self, submission_result): vcap = rest._get_vcap_services(self._vcap_services) credentials = rest._get_credentials(vcap, self._service_name) if rest_primitives._IAMConstants.V2_REST_URL in credentials: instance_id = credentials[rest_primitives._IAMConstants.V2_REST_URL].split('streaming_analytics/', 1)[1] else: instance_id = credentials['jobs_path'].split('/service_instances/', 1)[1].split('/', 1)[0] submission_result['instanceId'] = instance_id submission_result['streamsConnection'] = self.streams_connection()
def _augment_submission_result(self, submission_result): vcap = rest._get_vcap_services(self._vcap_services) credentials = rest._get_credentials(vcap, self._service_name) if rest_primitives._IAMConstants.V2_REST_URL in credentials: instance_id = credentials[ rest_primitives._IAMConstants.V2_REST_URL].split( 'streaming_analytics/', 1)[1] else: instance_id = credentials['jobs_path'].split( '/service_instances/', 1)[1].split('/', 1)[0] submission_result['instanceId'] = instance_id submission_result['streamsConnection'] = self.streams_connection() if 'jobId' in submission_result: if not hasattr(_StreamingAnalyticsSubmitter._SERVICE_ACTIVE, 'running'): _StreamingAnalyticsSubmitter._SERVICE_ACTIVE.running = dict() sn = self._service_name if self._service_name else os.environ[ 'STREAMING_ANALYTICS_SERVICE_NAME'] _StreamingAnalyticsSubmitter._SERVICE_ACTIVE.running[sn] = int( time.time() * 1000.0)
def _get_java_env(self): "Pass the VCAP through the environment to the java submission" env = super(_StreamingAnalyticsSubmitter, self)._get_java_env() vcap = rest._get_vcap_services(self._vcap_services) env['VCAP_SERVICES'] = json.dumps(vcap) return env
def _set_vcap(self): "Set self.vcap to the VCAP services, from env var or the config" self._vcap = rest._get_vcap_services(self._config().get(ConfigParams.VCAP_SERVICES))