Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Fix incorrect behaviors for Anomaly Detection jobs when resetting or converting to advanced job #90078

Merged
merged 10 commits into from
Feb 5, 2021

Conversation

qn895
Copy link
Member

@qn895 qn895 commented Feb 2, 2021

Summary

This PR fixes a bug introduced by #88898 which causes datafeed_config to be appended back to the job when resetting or converting to advanced job.

Before

  • Converting a job to an advanced job and then create the job will give an error

Screen Shot 2021-02-02 at 12 29 47

  • Resetting the job after running the wizard

Screen Shot 2021-02-02 at 13 51 56

@qn895 qn895 added bug Fixes for quality problems that affect the customer experience :ml Feature:Anomaly Detection ML anomaly detection v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.12.0 labels Feb 2, 2021
@qn895 qn895 self-assigned this Feb 2, 2021
@qn895 qn895 requested a review from a team as a code owner February 2, 2021 19:45
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

const hasDatafeed =
typeof job.datafeed_config === 'object' && Object.keys(job.datafeed_config).length > 0;
const datafeedId = hasDatafeed ? job.datafeed_config.datafeed_id : '';
const hasDatafeed = typeof datafeed === 'object' && Object.keys(datafeed).length > 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

datafeed should be set to undefined like job is on line 377.
This should also happen here:

mlJobService.tempJobCloningObjects.job = undefined;

Sorry, I missed this on the previous PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here d867b46

@spalger
Copy link
Contributor

spalger commented Feb 3, 2021

jenkins test this

@peteharverson
Copy link
Contributor

peteharverson commented Feb 4, 2021

I'm seeing some strange behavior when resetting a multi metric, or population job, after it has run. Sometimes it goes into the Single metric wizard, and sometimes it's gone into the Advanced wizard.

For example, with this config on cloudwatch-* it went into the Advanced wizard when hitting Reset:

  "custom_settings": {
    "created_by": "multi-metric-wizard"
  },
  "description": "",
  "analysis_config": {
    "bucket_span": "1h",
    "detectors": [
      {
        "detector_description": "mean(CPUUtilization) partitionfield=instance",
        "function": "mean",
        "field_name": "CPUUtilization",
        "partition_field_name": "instance",
        "detector_index": 0
      }
    ],
    "influencers": [
      "instance",
      "region"
    ]
  },

Update: I no longer see this issue after the edits in b8de989

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I no longer see the issues with Reset job after the changes in b8de989.

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested latest edit and LGTM

saveNewJob(job: any): Promise<any>;
cloneDatafeed(datafeed: any): Datafeed;
saveNewJob(job: Job): Promise<any>;
cloneDatafeed(Datafeed: Datafeed | undefined): Datafeed;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function shouldn't take undefined as it doesn't know how to deal with it.
we need a check here to ensure datafeed is not undefined:

if (mlJobService.tempJobCloningObjects.job !== undefined) {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here 0fa0b09

Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
ml 6.6MB 6.6MB +718.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@qn895 qn895 merged commit eff9d43 into elastic:master Feb 5, 2021
@qn895 qn895 deleted the ml-fix-cloning-adv-reset branch February 5, 2021 19:48
qn895 added a commit that referenced this pull request Feb 9, 2021
…g or converting to advanced job (#90078) (#90503)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Anomaly Detection ML anomaly detection :ml release_note:skip Skip the PR/issue when compiling release notes v7.12.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants