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] New Platform Migration - server #38360

Merged

Conversation

alvarezmelissa87
Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 commented Jun 7, 2019

Summary

This is the first phase of the ML plugin migration to the new platform - this is only addressing the server side implementation.

The new platform definition lives in server/new_platform.
The legacy plugin definition is still the one being executed, so this PR shims the new plugin definition into the still-used legacy one by instantiating it and wiring it up inside the init function.

Followups

  • convert all route files and their dependencies to TypeScript

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

- [ ] This was checked for breaking API changes and was labeled appropriately
- [ ] This includes a feature addition or change that requires a release note and was labeled appropriately

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui

@elasticmachine
Copy link
Contributor

💔 Build Failed

@alvarezmelissa87 alvarezmelissa87 force-pushed the ml-server-migration-step-one branch from a5408d7 to 1da3526 Compare June 7, 2019 14:34
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@alvarezmelissa87 alvarezmelissa87 changed the title WIP: [ML] New Platform Migration - server [ML] New Platform Migration - server Jun 7, 2019
Copy link
Contributor

@epixa epixa left a comment

Choose a reason for hiding this comment

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

The shimming/new-platform related changes in here look good. The important things - decoupling business logic from hapi and auditing dependencies on core and other plugins - are done in this PR.

The next migration steps for server-side stuff will be to start converting MlCoreSetup and PluginsSetup over to implementations provided by the new platform (not all of which are yet available at the time of this writing).

Great job!

Copy link
Contributor

@epixa epixa left a comment

Choose a reason for hiding this comment

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

LGTM from the standpoint of the new platform migration, though I didn't QA the changes in the product or dig deep into ML business logic.

@jinmu03 jinmu03 requested a review from joshdover June 11, 2019 16:31
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 out your branch, with security enabled and disabled, and with basic, trial and platinum licenses, and didn't find any issues.

A couple of minor questions but otherwise this all LGTM.

export const REQUIRED_ROLES = ['machine_learning_admin', 'machine_learning_user'];
export const REQUIRED_LICENSES = ['standard', 'gold', 'trial', 'platinum'];
export const LICENSES = ['oss', 'basic', 'standard', 'gold', 'trial', 'platinum'];
export type LicenseType = 'oss' | 'basic' | 'trial' | 'standard' | 'basic' | 'gold' | 'platinum';
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way of defining these license type values just once, for example in an enum, rather than using the Strings in multiple definitions?

elasticsearch: ElasticsearchPlugin;
xpackMain: MlXpackMainPlugin;
security: any;
// TODO: this is temporary for `mirrorPluginStatus`
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to confirm, is this still a TODO?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a TODO in the sense that in the legacy init function we were passing the instance of the plugin itself to the mirrorPluginStatus function. I wanted to note that that may change as the new platform services become available. It might not - I just wanted to remind myself to check as we move forward.

@alvarezmelissa87 alvarezmelissa87 added the release_note:skip Skip the PR/issue when compiling release notes label Jun 13, 2019
log: Logger;
}
export class Plugin {
private readonly pluginId: string = 'ml';
Copy link
Member

Choose a reason for hiding this comment

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

this could probably be moved out of the class as a PLUGIN_ID

},
mappings,
home: ['plugins/ml/register_feature'],
injectDefaultVars(server: any) {
Copy link
Member

Choose a reason for hiding this comment

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

could this be a Server or MlServer?
If not, does kibana have any types for this? also the kibana parameter in the outer function.

* you may not use this file except in compliance with the Elastic License.
*/

export const REQUIRED_ROLES = ['machine_learning_admin', 'machine_learning_user'];
Copy link
Member

Choose a reason for hiding this comment

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

These three arrays aren't used, what are they for?
There are also data frame roles which might be required. If these are going to be used to grant access to something, should we instead be relying on the underlying privileges rather than the roles? As new roles which are identical to these could be created and so should grant the same access.

Copy link
Contributor

@joshdover joshdover left a comment

Choose a reason for hiding this comment

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

Platform migration bits LGTM

@alvarezmelissa87 alvarezmelissa87 force-pushed the ml-server-migration-step-one branch from efa0019 to 709a32f Compare June 17, 2019 18:47
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@alvarezmelissa87 alvarezmelissa87 merged commit c47a0d5 into elastic:master Jun 17, 2019
@alvarezmelissa87 alvarezmelissa87 deleted the ml-server-migration-step-one branch June 17, 2019 20:10
alvarezmelissa87 added a commit that referenced this pull request Jun 18, 2019
* wip: pull out all server dependencies

* create new platform plugin

* shim newPlatform plugin into legacy init

* update server tests for migration refactor

* cleanup interfaces

* Only add ML links for sample data sets if full license from - 38120

* update test and fix typescript errors

* Remove unused types
@peteharverson peteharverson mentioned this pull request Oct 30, 2019
78 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:ml release_note:skip Skip the PR/issue when compiling release notes v7.3.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants