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

[Extensions] Configure a ScheduledJobParser/ScheduledJobRunner to send a parse ScheduledJobParameter/run job request to AD Extension from JS #309

Closed
12 tasks done
joshpalis opened this issue Jan 6, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@joshpalis
Copy link
Member

joshpalis commented Jan 6, 2023

Is your feature request related to a problem?

The ScheduledJobParser is used by the JobSweeper to parse the ScheduledJobParameter (AnomalyDetectorJob) object here. The ScheduledJobParameter is then further used to validate the job prior to scheduling. In order to support this for extensions, we must create a proxy ScheduledJobParser which shall pass the ScheduledJobParameter bytesReference and jobDocVersion back to Anomaly Detector extension to parse into an AnomalyDetectorJob.

The ScheduledJobRunner is used by the JobScheduler to invoke the runJob implementation of the dependent plugin here. The ScheduledJobRunner merely passes the ScheduledJobParameter and the JobExecutionContext back to the dependent plugin, which in turn runs the job. In order to support this for extensions, we must create a proxy ScheduledJobRunner which shall pass the JobExecutionContext back to Anomaly Detector extension to configure and run its job.

Task : To ensure consistency, update indicesToListen set for every index operation

  • Add JobDetailsService as an indexOperationListener onIndexModule for .opensearch-plugin-job-details
  • Post Index (getJobIndex): Pull Job Details from index and put into map with documentId
  • Put jobIndexName in indicesToListen set
  • Post Index (getJobType) : Pull jobType from index and put into map for documentId

Task : Whenever there is an operation on opensearch-plugin-job-details, parse the index source into a JobDetails object, extract the JobIndex and JobType, create proxies for the ScheduledJobParser and ScheduledJobRunner, and consolidate all these objects into a ScheduledJobProvider to add to indexToJobProviders.

  • Pull in the indexToJobProviders hashmap from JobSchedulerPlugin into JobDetailsService
  • Create method updateIndexToJobProviders which will be called via postIndex of JobDetailsService, which acts as an index operation listener to the JobDetails metadata index .opensearch-job-scheduler-job-details. The JobDetails bytesReference should be extracted from the Engine.Index parameter and passed to this method in order to update the indexToJobProviders
  • Create Proxy ScheduledJobParser by overriding the parse method, extract the ScheduledJobParameter bytesRef from the provided xContentParser, and invoke the provided job_parameter_action using the NodeClient. This should return the extension's ScheduledJobParameter
  • Create Proxy ScheduledJobRunner by overriding the runJob method, extract the expectedExecutionTime, jobDocVersion, jobIndexName, and jobId from the JobExecutionContext and invoke the provided job_runner_action using the NodeClient. This should return an acknowledgement from the extension
  • Combine the JobDetail's jobIndex, jobType with both the proxy ScheduledJobParser and ScheduledJobRunner into a ScheduledJobProvider entry to insert into the indexToJobProviders
  • Modify ExtensionJobParameter to check if jitter and lock duration seconds fields are set before passing to constructor
  • Modify JobRunnerRequest to return the documentId of the ScheduledJobParameter back to the extension
  • Add unit tests
@joshpalis joshpalis added enhancement New feature or request untriaged labels Jan 6, 2023
@joshpalis joshpalis self-assigned this Jan 6, 2023
@joshpalis joshpalis changed the title [Extensions] Configure a ScheduledJobRunner to send a run job request to AD Extension from JS with the given ScheduledJobParameter [Extensions] Configure a ScheduledJobParser/ScheduledJobRunner to send a parse ScheduledJobParameter/run job request to AD Extension from JS Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants