Skip to content

Commit

Permalink
[ML] deleteIngestPipeline method
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov committed Jul 8, 2021
1 parent 76923f6 commit 85a71fe
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions x-pack/test/functional/services/ml/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,9 +955,11 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) {
) {
const compressedDefinition = this.getCompressedModelDefinition(modelType);

const models = new Array(count).fill(null).map((v, i) => {
const modelIds = new Array(count).fill(null).map((v, i) => `dfa_${modelType}_model_n_${i}`);

const models = modelIds.map((id) => {
return {
model_id: `dfa_${modelType}_model_n_${i}`,
model_id: id,
body: {
compressed_definition: compressedDefinition,
inference_config: {
Expand All @@ -976,8 +978,14 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) {
await this.createIngestPipeline(model.model_id);
}
}

return modelIds;
},

/**
* Retrieves compressed model definition from the test resources.
* @param modelType
*/
getCompressedModelDefinition(modelType: ModelType) {
return fs.readFileSync(
path.resolve(
Expand Down Expand Up @@ -1013,5 +1021,11 @@ export function MachineLearningAPIProvider({ getService }: FtrProviderContext) {
log.debug('> Ingest pipeline crated');
return ingestPipeline;
},

async deleteIngestPipeline(modelId: string) {
log.debug(`Deleting ingest pipeline for trained model with id "${modelId}"`);
await esSupertest.delete(`/_ingest/pipeline/pipeline_${modelId}`).expect(200);
log.debug('> Ingest pipeline deleted');
},
};
}

0 comments on commit 85a71fe

Please sign in to comment.