Browse Source

some renamings

pull/1/head
Alexey Velikiy 6 years ago
parent
commit
e605d699ba
  1. 4
      analytics/worker.py
  2. 6
      server/src/controllers/analytics_controller.ts
  3. 4
      server/src/services/analytics_service.ts

4
analytics/worker.py

@ -92,9 +92,9 @@ class Worker(object):
return { return {
'task': "predict", 'task': "predict",
'status': "success", 'status': "success",
'predictor_id': predictor_id, 'analyticUnitId': predictor_id,
'segments': segments, 'segments': segments,
'last_prediction_time': last_prediction_time 'lastPredictionTime': last_prediction_time
} }
def get_model(self, predictor_id, pattern): def get_model(self, predictor_id, pattern):

6
server/src/controllers/analytics_controller.ts

@ -1,13 +1,13 @@
import { getTarget } from './metrics_controler'; import { getTarget } from './metrics_controler';
import { getLabeledSegments, insertSegments, removeSegments } from './segments_controller' import { getLabeledSegments, insertSegments, removeSegments } from './segments_controller'
import * as AnalyticUnit from '../models/analytic_unit' import * as AnalyticUnit from '../models/analytic_unit'
import { AnalyticsConnection } from '../services/analytics_service' import { AnalyticsService } from '../services/analytics_service'
const taskMap = {}; const taskMap = {};
let nextTaskId = 0; let nextTaskId = 0;
const analyticsConnection = new AnalyticsConnection(onResponse); const analyticsService = new AnalyticsService(onResponse);
function onResponse(response: any) { function onResponse(response: any) {
let taskId = response.__task_id; let taskId = response.__task_id;
@ -29,7 +29,7 @@ async function runTask(task): Promise<any> {
}; };
task.__task_id = nextTaskId++; task.__task_id = nextTaskId++;
await analyticsConnection.sendTask(task); await analyticsService.sendTask(task);
return new Promise<void>(resolve => { return new Promise<void>(resolve => {
taskMap[task.__task_id] = resolve; taskMap[task.__task_id] = resolve;

4
server/src/services/analytics_service.ts

@ -7,10 +7,10 @@ import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
export class AnalyticsService {
export class AnalyticsConnection {
private _requester: any; private _requester: any;
constructor(private _onResponse: (response: any) => void) { constructor(private _onResponse: (response: any) => void) {
this._initConnection(); this._initConnection();

Loading…
Cancel
Save