-
Notifications
You must be signed in to change notification settings - Fork 73
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
Communication mechanism JS (Part 1) #761
Closed
vibrantvarun
wants to merge
2
commits into
opensearch-project:feature/extensions
from
vibrantvarun:Communicatio_Mechanism_JS
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use Job index constant here
ANOMALY_DETECTOR_JOB_INDEX
.Also,
getJobDetails
is equivalent to which JobScheduler extension point here?For ADplugin, we have
getJobIndex()
andgetJobType()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not pulled ANOMALY_DETECTOR_JOB_INDEX from AnomalyDetectorJob because the class is commented. I have mentioned the same in TODO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@owaiskazi19
JobDetails
is equivalent to bothgetJobIndex()
andgetJobType()
. Both these strings are utilized by Job Scheduler to configure it's behavior foronIndexModule()
and to also configure theindexToJobProviders
which theJobSweeper
uses to schedule jobs. I also agree that we should use theANOMALY_DETECTOR_JOB_INDEX
constant, @vibrantvarun it should be fine to uncomment thisThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to understand more on why are we coupling up
getJobIndex()
andgetJobType()
together injobDetails
?Shouldn't it follow the old design of keeping them separate or otherwise we have to change these extension points in all the plugins/extensions using JS?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getJobIndex
andgetJobType
are currently used by Job Scheduler to retrieve implementations of theJobSchedulerExtension
interface here. Simply put, these two extension points just provide strings to Job Scheduler.We're coupling the Job Index and Job Type strings together in one request, rather than separate requests since this is the only initial information we need from extensions in order to configure both the
indicesToListen
set andindexToJobProviders
hashmap. How these are further used is documented here. Separating these into two requests would be unnecessary.This wouldn't have any affect on how plugins are using JS, since the plugin architecture for JS remains untouched within
PluginsService
'sloadExtensionsForPlugin
workflow. As for extensions, the only difference at this point is how we are providing these strings to Job Scheduler. How Job Scheduler uses these strings will remain unchanged.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @joshpalis @owaiskazi19 the job index cannot be pulled from AnomalyDetectorJob.java as of now because it still has circular dependency from JS on some other methods written in the file. If I uncomment only the required code like the Job Index initialization then I am facing an error of jacoco test coverage report. Therefore, for now I am hardcoding the value of job index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can fix the jacoco test coverage by uncommenting the tests too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I did uncomment the code, but there are some dependencies which are imported from JobScheduler like Schedule.java etc. These dependencies cannot be resolved until they are imported from JS native plugin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Let's create a constant in this file then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK