Skip to content

ARROW-12332: [Rust] [Ballista] Add simple api server in scheduler#9987

Closed
msathis wants to merge 3 commits intoapache:masterfrom
msathis:master
Closed

ARROW-12332: [Rust] [Ballista] Add simple api server in scheduler#9987
msathis wants to merge 3 commits intoapache:masterfrom
msathis:master

Conversation

@msathis
Copy link

@msathis msathis commented Apr 11, 2021

Implements GET /executors. We can additional endpoints going forward.

@github-actions
Copy link

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on JIRA? https://issues.apache.org/jira/browse/ARROW

Opening JIRAs ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename pull request title in the following format?

ARROW-${JIRA_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

@msathis msathis changed the title Add simple api server in scheduler ARROW-12332: [Rust] Add simple api server in scheduler Apr 11, 2021
@github-actions
Copy link

@msathis
Copy link
Author

msathis commented Apr 11, 2021

Screenshot 2021-04-12 at 12 22 21 AM

@andygrove Please review when you find time :)

@andygrove andygrove changed the title ARROW-12332: [Rust] Add simple api server in scheduler ARROW-12332: [Rust] [Ballista] Add simple api server in scheduler Apr 11, 2021
@andygrove
Copy link
Member

Hi @msathis and thanks for creating the PR. I pulled your branch and tried testing this locally but couldn't get it to work. I'm probably doing something wrong. It would be good if you could add some documentation as part of this PR. Perhaps provide a curl command for hitting this API?

@msathis
Copy link
Author

msathis commented Apr 12, 2021

curl --request GET \
  --url http://localhost:50050/executors \
  --header 'Accept: application/json'

@andygrove The above curl should work. Added small documentation to the PR as well.

@kamilkonior
Copy link

Hi guys, I don't know how many endpoints you plan to have in future, but did you consider having additional prefix in path like /scheduler/executors ? ( FYI, I am just random person that is reading github issues )

@msathis
Copy link
Author

msathis commented Apr 12, 2021

@Cheappie I don't think we need the prefix since the api is part of the scheduler. But my knowledge is limited.

@andygrove Do you foresee a requirement to support additional resources not related to schedulers in future?

Copy link
Member

@andygrove andygrove left a comment

Choose a reason for hiding this comment

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

LGTM. I tested based on the provided curl command:

curl --request GET   --url http://localhost:50050/executors   --header 'Accept: application/json'
[{"id":"7b6069c3-b56a-4909-882b-97f103cdecc2","host":"localhost","port":50051}]

@msathis
Copy link
Author

msathis commented Apr 13, 2021

@andygrove Can you please get it merged, if everything is okay?

@andygrove andygrove closed this in 57d430e Apr 13, 2021
@andygrove
Copy link
Member

Hi guys, I don't know how many endpoints you plan to have in future, but did you consider having additional prefix in path like /scheduler/executors ? ( FYI, I am just random person that is reading github issues )

It's a good point but we're so early with this feature it is hard to know how it will evolve. The process is a dedicated scheduler so adding a scheduler prefix seems redundant at this point though.

Comment on lines +65 to +91
.serve(make_service_fn(move |_| {
let scheduler_server = SchedulerServer::new(config_backend.clone(), namespace.clone());
let scheduler_grpc_server = SchedulerGrpcServer::new(scheduler_server.clone());

let mut tonic = TonicServer::builder()
.add_service(scheduler_grpc_server)
.into_service();
let mut warp = warp::service(get_routes(scheduler_server));

future::ok::<_, Infallible>(tower::service_fn(
move |req: hyper::Request<hyper::Body>| {
let header = req.headers().get(hyper::header::ACCEPT);
if header.is_some() && header.unwrap().eq("application/json") {
return Either::Left(
warp.call(req)
.map_ok(|res| res.map(EitherBody::Left))
.map_err(Error::from),
);
}
Either::Right(
tonic
.call(req)
.map_ok(|res| res.map(EitherBody::Right))
.map_err(Error::from),
)
},
))
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I'm super late to this PR. Does this change mean that a SchedulerGrpcServer is being built for every request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants