Skip to content

Commit

Permalink
Remove ESQueue and replace with Task Manager queueing
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Jul 14, 2020
1 parent 0a2b75b commit c796f3f
Show file tree
Hide file tree
Showing 37 changed files with 1,061 additions and 2,742 deletions.
1 change: 1 addition & 0 deletions x-pack/plugins/reporting/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"management",
"licensing",
"uiActions",
"taskManager",
"embeddable",
"share"
],
Expand Down
19 changes: 7 additions & 12 deletions x-pack/plugins/reporting/server/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,25 @@ import { SecurityPluginSetup } from '../../security/server';
import { ScreenshotsObservableFn } from '../server/types';
import { ReportingConfig } from './';
import { HeadlessChromiumDriverFactory } from './browsers/chromium/driver_factory';
import { checkLicense, getExportTypesRegistry, ReportingTask } from './lib';
import { screenshotsObservableFactory } from './lib/screenshots';
import { checkLicense, getExportTypesRegistry } from './lib';
import { ESQueueInstance } from './lib/create_queue';
import { EnqueueJobFn } from './lib/enqueue_job';
import { ReportingStore } from './lib/store';
import { SchedulingFn } from './lib/task';

export interface ReportingInternalSetup {
elasticsearch: ElasticsearchServiceSetup;
licensing: LicensingPluginSetup;
basePath: BasePath['get'];
router: IRouter;
security?: SecurityPluginSetup;
task: ReportingTask;
}

export interface ReportingInternalStart {
browserDriverFactory: HeadlessChromiumDriverFactory;
enqueueJob: EnqueueJobFn;
esqueue: ESQueueInstance;
store: ReportingStore;
savedObjects: SavedObjectsServiceStart;
scheduleTask: SchedulingFn;
uiSettings: UiSettingsServiceStart;
}

Expand Down Expand Up @@ -115,7 +114,7 @@ export class ReportingCore {
/*
* Gives async access to the startDeps
*/
private async getPluginStartDeps() {
public async getPluginStartDeps() {
if (this.pluginStartDeps) {
return this.pluginStartDeps;
}
Expand All @@ -127,12 +126,8 @@ export class ReportingCore {
return this.exportTypesRegistry;
}

public async getEsqueue() {
return (await this.getPluginStartDeps()).esqueue;
}

public async getEnqueueJob() {
return (await this.getPluginStartDeps()).enqueueJob;
public async getTaskScheduler() {
return (await this.getPluginStartDeps()).scheduleTask;
}

public async getLicenseInfo() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { CONTENT_TYPE_CSV, CSV_FROM_SAVEDOBJECT_JOB_TYPE } from '../../../common
import { RunTaskFnFactory, ScheduledTaskParams, TaskRunResult } from '../../types';
import { createGenerateCsv } from '../csv/generate_csv';
import { JobParamsPanelCsv, SearchPanel } from './types';
import { getFakeRequest } from './lib/get_fake_request';
import { getGenerateCsvParams } from './lib/get_csv_job';

/*
Expand Down Expand Up @@ -42,21 +41,12 @@ export const runTaskFnFactory: RunTaskFnFactory<ImmediateExecuteFn> = function e
// jobID is only for "queued" jobs
// Use the jobID as a logging tag or "immediate"
const { jobParams } = jobPayload;
const jobLogger = logger.clone([jobId === null ? 'immediate' : jobId]);
const jobLogger = logger.clone(['immediate']);
const generateCsv = createGenerateCsv(jobLogger);
const { isImmediate, panel, visType } = jobParams as JobParamsPanelCsv & {
panel: SearchPanel;
};
const { panel, visType } = jobParams as JobParamsPanelCsv & { panel: SearchPanel };

jobLogger.debug(`Execute job generating [${visType}] csv`);

if (isImmediate && req) {
jobLogger.info(`Executing job from Immediate API using request context`);
} else {
jobLogger.info(`Executing job async using encrypted headers`);
req = await getFakeRequest(jobPayload, config.get('encryptionKey')!, jobLogger);
}

const savedObjectsClient = context.core.savedObjects.client;

const uiConfig = await reporting.getUiSettingsServiceFactory(savedObjectsClient);
Expand Down
74 changes: 0 additions & 74 deletions x-pack/plugins/reporting/server/lib/create_queue.ts

This file was deleted.

107 changes: 0 additions & 107 deletions x-pack/plugins/reporting/server/lib/create_worker.test.ts

This file was deleted.

75 changes: 0 additions & 75 deletions x-pack/plugins/reporting/server/lib/create_worker.ts

This file was deleted.

Loading

0 comments on commit c796f3f

Please sign in to comment.