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

Create Job API #2070

Merged
Merged

Conversation

vmmusings
Copy link
Member

@vmmusings vmmusings commented Sep 9, 2023

Description

Sample Request Responses.

Job Creation API

curl --location 'http://ec2-54-70-149-21.us-west-2.compute.amazonaws.com:9200/_plugins/_query/_jobs' \
--header 'Content-Type: application/json' \
--data '{
    "query" : "select * from default.http_logs limit 10"
}'
{
  "jobId": "00fd796ut1a7eg0q"
}

Job Result API:

curl --location --request GET 'http://ec2-54-70-149-21.us-west-2.compute.amazonaws.com:9200/_plugins/_query/_jobs/00fd796ut1a7eg0q/result' \
--header 'Content-Type: application/json' \
--data '{
   "query" : "select * from default.http_logs limit 1"
}'
{"status":"RUNNING"}

Issues Resolved

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@codecov
Copy link

codecov bot commented Sep 9, 2023

Codecov Report

Merging #2070 (f96a1a5) into feature/job-apis (a7af359) will increase coverage by 0.21%.
The diff coverage is 94.27%.

@@                  Coverage Diff                   @@
##             feature/job-apis    #2070      +/-   ##
======================================================
+ Coverage               96.36%   96.57%   +0.21%     
- Complexity               4643     4696      +53     
======================================================
  Files                     425      433       +8     
  Lines                   12106    12387     +281     
  Branches                  832      847      +15     
======================================================
+ Hits                    11666    11963     +297     
+ Misses                    431      413      -18     
- Partials                    9       11       +2     
Flag Coverage Δ
sql-engine 96.57% <94.27%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...org/opensearch/sql/spark/client/EmrClientImpl.java 100.00% <ø> (ø)
...earch/sql/spark/data/constants/SparkConstants.java 0.00% <ø> (ø)
...sql/spark/rest/RestAsyncQueryManagementAction.java 0.00% <0.00%> (ø)
.../sql/spark/rest/model/CreateAsyncQueryRequest.java 0.00% <0.00%> (ø)
...transport/model/CancelAsyncQueryActionRequest.java 0.00% <ø> (ø)
...ransport/model/CancelAsyncQueryActionResponse.java 0.00% <ø> (ø)
...ransport/model/CreateAsyncQueryActionResponse.java 0.00% <ø> (ø)
...nsport/model/GetAsyncQueryResultActionRequest.java 0.00% <ø> (ø)
...sport/model/GetAsyncQueryResultActionResponse.java 0.00% <ø> (ø)
.../spark/asyncquery/model/AsyncQueryJobMetadata.java 85.18% <85.18%> (ø)
... and 18 more

@vmmusings vmmusings force-pushed the create-job-api branch 7 times, most recently from b55d3c5 to cbb0c14 Compare September 18, 2023 15:13
@vmmusings vmmusings force-pushed the create-job-api branch 2 times, most recently from db73143 to 26bee6c Compare September 18, 2023 23:05
@vmmusings vmmusings marked this pull request as ready for review September 18, 2023 23:06
@vmmusings vmmusings force-pushed the create-job-api branch 2 times, most recently from 2268c9c to 8d62bec Compare September 19, 2023 16:47
@YANG-DB
Copy link
Member

YANG-DB commented Sep 19, 2023

@vamsi-amazon can u plz add a swagger file for a consolidated view and documentation for this API ?

docs/user/interfaces/jobinterface.rst Outdated Show resolved Hide resolved
docs/user/interfaces/jobinterface.rst Outdated Show resolved Hide resolved
Comment on lines 54 to 61
String sparkExecutionEngineConfigString =
settings.getSettingValue(SPARK_EXECUTION_ENGINE_CONFIG);
SparkExecutionEngineConfig sparkExecutionEngineConfig =
AccessController.doPrivileged(
(PrivilegedAction<SparkExecutionEngineConfig>)
() ->
SparkExecutionEngineConfig.toSparkExecutionEngineConfig(
sparkExecutionEngineConfigString));
Copy link
Collaborator

Choose a reason for hiding this comment

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

the construct of SparkExecutionEngine should independent of JobExecutorService.

Copy link
Member Author

Choose a reason for hiding this comment

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

SparkExecutionEngineConfig contains applicationId which can change and it is picked up runtime during query execution. Probably I need to split up the settings.

Signed-off-by: Vamsi Manohar <[email protected]>
@vmmusings vmmusings force-pushed the create-job-api branch 5 times, most recently from b6a5ceb to 257fb50 Compare September 20, 2023 23:40
@vmmusings
Copy link
Member Author

@vamsi-amazon can u plz add a swagger file for a consolidated view and documentation for this API ?

@YANG-DB will address this in a separate task.

Signed-off-by: Vamsi Manohar <[email protected]>
@vmmusings vmmusings self-assigned this Sep 21, 2023
@vmmusings vmmusings added the enhancement New feature or request label Sep 21, 2023
@vmmusings vmmusings merged commit 525a0ae into opensearch-project:feature/job-apis Sep 21, 2023
16 of 20 checks passed
vmmusings added a commit that referenced this pull request Sep 22, 2023
* Create Job API

Signed-off-by: Vamsi Manohar <[email protected]>

* Refactor to Async Query API

Signed-off-by: Vamsi Manohar <[email protected]>

---------

Signed-off-by: Vamsi Manohar <[email protected]>
vmmusings added a commit that referenced this pull request Sep 22, 2023
* Create Job API

Signed-off-by: Vamsi Manohar <[email protected]>

* Refactor to Async Query API

Signed-off-by: Vamsi Manohar <[email protected]>

---------

Signed-off-by: Vamsi Manohar <[email protected]>
vmmusings added a commit that referenced this pull request Sep 27, 2023
* Glue datasource support (#2055)

Signed-off-by: Vamsi Manohar <[email protected]>

* Initial commit of new job APIs (#2050)

Signed-off-by: Vamsi Manohar <[email protected]>

* Create Job API (#2070)

* Create Job API

Signed-off-by: Vamsi Manohar <[email protected]>

* Refactor to Async Query API

Signed-off-by: Vamsi Manohar <[email protected]>

---------

Signed-off-by: Vamsi Manohar <[email protected]>

* Cancel Job API (#2126)

Signed-off-by: Vamsi Manohar <[email protected]>

* Add tags to the emr jobs based on the query types (#2150)

Signed-off-by: Vamsi Manohar <[email protected]>

---------

Signed-off-by: Vamsi Manohar <[email protected]>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 27, 2023
* Glue datasource support (#2055)

Signed-off-by: Vamsi Manohar <[email protected]>

* Initial commit of new job APIs (#2050)

Signed-off-by: Vamsi Manohar <[email protected]>

* Create Job API (#2070)

* Create Job API

Signed-off-by: Vamsi Manohar <[email protected]>

* Refactor to Async Query API

Signed-off-by: Vamsi Manohar <[email protected]>

---------

Signed-off-by: Vamsi Manohar <[email protected]>

* Cancel Job API (#2126)

Signed-off-by: Vamsi Manohar <[email protected]>

* Add tags to the emr jobs based on the query types (#2150)

Signed-off-by: Vamsi Manohar <[email protected]>

---------

Signed-off-by: Vamsi Manohar <[email protected]>
(cherry picked from commit ae10857)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
vmmusings pushed a commit that referenced this pull request Sep 27, 2023
* Glue datasource support (#2055)



* Initial commit of new job APIs (#2050)



* Create Job API (#2070)

* Create Job API



* Refactor to Async Query API



---------



* Cancel Job API (#2126)



* Add tags to the emr jobs based on the query types (#2150)



---------


(cherry picked from commit ae10857)

Signed-off-by: Vamsi Manohar <[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>
penghuo pushed a commit that referenced this pull request Oct 3, 2023
* Glue datasource support (#2055)

Signed-off-by: Vamsi Manohar <[email protected]>

* Initial commit of new job APIs (#2050)

Signed-off-by: Vamsi Manohar <[email protected]>

* Create Job API (#2070)

* Create Job API

Signed-off-by: Vamsi Manohar <[email protected]>

* Refactor to Async Query API

Signed-off-by: Vamsi Manohar <[email protected]>

---------

Signed-off-by: Vamsi Manohar <[email protected]>

* Cancel Job API (#2126)

Signed-off-by: Vamsi Manohar <[email protected]>

* Fix response codes returned

Signed-off-by: Derek Ho <[email protected]>

* Remove @opensearch datasource, update with new type

Signed-off-by: Derek Ho <[email protected]>

* Spotless Apply

Signed-off-by: Derek Ho <[email protected]>

* Fix tests

Signed-off-by: Derek Ho <[email protected]>

* Revert change back to json string

Signed-off-by: Derek Ho <[email protected]>

* Update tests to use JSON string literal instead of formatting

Signed-off-by: Derek Ho <[email protected]>

* Update IT

Signed-off-by: Derek Ho <[email protected]>

* Fix show datsources IT

Signed-off-by: Derek Ho <[email protected]>

* Remove files from merge

Signed-off-by: Derek Ho <[email protected]>

---------

Signed-off-by: Vamsi Manohar <[email protected]>
Signed-off-by: Derek Ho <[email protected]>
Co-authored-by: Vamsi Manohar <[email protected]>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 3, 2023
* Glue datasource support (#2055)

Signed-off-by: Vamsi Manohar <[email protected]>

* Initial commit of new job APIs (#2050)

Signed-off-by: Vamsi Manohar <[email protected]>

* Create Job API (#2070)

* Create Job API

Signed-off-by: Vamsi Manohar <[email protected]>

* Refactor to Async Query API

Signed-off-by: Vamsi Manohar <[email protected]>

---------

Signed-off-by: Vamsi Manohar <[email protected]>

* Cancel Job API (#2126)

Signed-off-by: Vamsi Manohar <[email protected]>

* Fix response codes returned

Signed-off-by: Derek Ho <[email protected]>

* Remove @opensearch datasource, update with new type

Signed-off-by: Derek Ho <[email protected]>

* Spotless Apply

Signed-off-by: Derek Ho <[email protected]>

* Fix tests

Signed-off-by: Derek Ho <[email protected]>

* Revert change back to json string

Signed-off-by: Derek Ho <[email protected]>

* Update tests to use JSON string literal instead of formatting

Signed-off-by: Derek Ho <[email protected]>

* Update IT

Signed-off-by: Derek Ho <[email protected]>

* Fix show datsources IT

Signed-off-by: Derek Ho <[email protected]>

* Remove files from merge

Signed-off-by: Derek Ho <[email protected]>

---------

Signed-off-by: Vamsi Manohar <[email protected]>
Signed-off-by: Derek Ho <[email protected]>
Co-authored-by: Vamsi Manohar <[email protected]>
(cherry picked from commit 5ce1bab)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
penghuo pushed a commit that referenced this pull request Oct 3, 2023
* Glue datasource support (#2055)



* Initial commit of new job APIs (#2050)



* Create Job API (#2070)

* Create Job API



* Refactor to Async Query API



---------



* Cancel Job API (#2126)



* Fix response codes returned



* Remove @opensearch datasource, update with new type



* Spotless Apply



* Fix tests



* Revert change back to json string



* Update tests to use JSON string literal instead of formatting



* Update IT



* Fix show datsources IT



* Remove files from merge



---------




(cherry picked from commit 5ce1bab)

Signed-off-by: Vamsi Manohar <[email protected]>
Signed-off-by: Derek Ho <[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>
Co-authored-by: Vamsi Manohar <[email protected]>
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

Successfully merging this pull request may close these issues.

4 participants