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 _set_credentials(self): "Set self.credentials for the selected service, from self.vcap" self.credentials = rest._get_credentials(self._config().get(ConfigParams.SERVICE_NAME), self._vcap)