-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Flint query scheduler part 2 * spotless apply * Add UT * Resolve comments * Add more UTs * Resolve comments * Use SQL thread pool --------- (cherry picked from commit 729bb13) Signed-off-by: Louis Chu <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
db75d94
commit 9b19238
Showing
31 changed files
with
1,366 additions
and
535 deletions.
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
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
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
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
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
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
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
57 changes: 57 additions & 0 deletions
57
async-query-core/src/main/java/org/opensearch/sql/spark/scheduler/AsyncQueryScheduler.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package org.opensearch.sql.spark.scheduler; | ||
|
||
import org.opensearch.sql.spark.scheduler.model.AsyncQuerySchedulerRequest; | ||
|
||
/** Scheduler interface for scheduling asynchronous query jobs. */ | ||
public interface AsyncQueryScheduler { | ||
|
||
/** | ||
* Schedules a new job in the system. This method creates a new job entry based on the provided | ||
* request parameters. | ||
* | ||
* <p>Use cases: - Creating a new periodic query execution - Setting up a scheduled data refresh | ||
* task | ||
* | ||
* @param asyncQuerySchedulerRequest The request containing job configuration details | ||
* @throws IllegalArgumentException if a job with the same name already exists | ||
* @throws RuntimeException if there's an error during job creation | ||
*/ | ||
void scheduleJob(AsyncQuerySchedulerRequest asyncQuerySchedulerRequest); | ||
|
||
/** | ||
* Updates an existing job with new parameters. This method modifies the configuration of an | ||
* already scheduled job. | ||
* | ||
* <p>Use cases: - Changing the schedule of an existing job - Modifying query parameters of a | ||
* scheduled job - Updating resource allocations for a job | ||
* | ||
* @param asyncQuerySchedulerRequest The request containing updated job configuration | ||
* @throws IllegalArgumentException if the job to be updated doesn't exist | ||
* @throws RuntimeException if there's an error during the update process | ||
*/ | ||
void updateJob(AsyncQuerySchedulerRequest asyncQuerySchedulerRequest); | ||
|
||
/** | ||
* Unschedules a job by marking it as disabled and updating its last update time. This method is | ||
* used when you want to temporarily stop a job from running but keep its configuration and | ||
* history in the system. | ||
* | ||
* <p>Use cases: - Pausing a job that's causing issues without losing its configuration - | ||
* Temporarily disabling a job during maintenance or high-load periods - Allowing for easy | ||
* re-enabling of the job in the future | ||
* | ||
* @param jobId The unique identifier of the job to unschedule | ||
*/ | ||
void unscheduleJob(String jobId); | ||
|
||
/** | ||
* Removes a job completely from the scheduler. This method permanently deletes the job and all | ||
* its associated data from the system. | ||
* | ||
* <p>Use cases: - Cleaning up jobs that are no longer needed - Removing obsolete or erroneously | ||
* created jobs - Freeing up resources by deleting unused job configurations | ||
* | ||
* @param jobId The unique identifier of the job to remove | ||
*/ | ||
void removeJob(String jobId); | ||
} |
31 changes: 31 additions & 0 deletions
31
...re/src/main/java/org/opensearch/sql/spark/scheduler/model/AsyncQuerySchedulerRequest.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.spark.scheduler.model; | ||
|
||
import java.time.Instant; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.opensearch.sql.spark.rest.model.LangType; | ||
|
||
/** Represents a job request for a scheduled task. */ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class AsyncQuerySchedulerRequest { | ||
protected String accountId; | ||
// Scheduler jobid is the opensearch index name until we support multiple jobs per index | ||
protected String jobId; | ||
protected String dataSource; | ||
protected String scheduledQuery; | ||
protected LangType queryLang; | ||
protected Object schedule; | ||
protected boolean enabled; | ||
protected Instant lastUpdateTime; | ||
protected Instant enabledTime; | ||
protected Long lockDurationSeconds; | ||
protected Double jitter; | ||
} |
Oops, something went wrong.