[
https://issues.apache.org/jira/browse/YARN-7202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16206843#comment-16206843
]
Gour Saha commented on YARN-7202:
---------------------------------
I think these 2 changes steers us away from REST style and hence should be
reverted -
{noformat}
---
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/service/webapp/ApiServer.java
+++
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/service/webapp/ApiServer.java
@@ -165,12 +165,12 @@ private Response stopService(String appName, boolean
destroy) {
} else {
LOG.info("Successfully stopped service {}", appName);
}
- return Response.status(Status.NO_CONTENT).build();
+ return Response.status(Status.OK).build();
} catch (ApplicationNotFoundException e) {
ServiceStatus serviceStatus = new ServiceStatus();
serviceStatus.setDiagnostics(
- "Service " + appName + " not found " + e.getMessage());
- return Response.status(Status.NOT_FOUND).entity(serviceStatus)
+ "Service " + appName + " is not found in YARN: " + e.getMessage());
+ return Response.status(Status.BAD_REQUEST).entity(serviceStatus)
.build();
} catch (Exception e) {
ServiceStatus serviceStatus = new ServiceStatus();
{noformat}
1. NO_CONTENT is pretty much similar to OK except that that the server will not
return a response entity-body. Returning OK tells the client that they should
expect a resource in the response as well, which is what we are NOT doing. So
this needs to be reverted back to NO_CONTENT.
2. BAD_REQUEST means that the server did not understand the request, typically
due to malformed syntax. It also hints that the client should not repeat the
request (without modification). NOT_FOUND is the most appropriate response code
here since it signifies that the service does not exist
(ApplicationNotFoundException). The same request could possibly work later if a
service of the same name was created down the line. So this needs to be
reverted back to NOT_FOUND.
> Add UT for api-server
> ---------------------
>
> Key: YARN-7202
> URL: https://issues.apache.org/jira/browse/YARN-7202
> Project: Hadoop YARN
> Issue Type: Sub-task
> Reporter: Jian He
> Assignee: Eric Yang
> Fix For: yarn-native-services
>
> Attachments: YARN-7202.yarn-native-services.001.patch,
> YARN-7202.yarn-native-services.002.patch,
> YARN-7202.yarn-native-services.003.patch,
> YARN-7202.yarn-native-services.004.patch,
> YARN-7202.yarn-native-services.005.patch,
> YARN-7202.yarn-native-services.006.patch,
> YARN-7202.yarn-native-services.007.patch,
> YARN-7202.yarn-native-services.008.patch,
> YARN-7202.yarn-native-services.011.patch,
> YARN-7202.yarn-native-services.012.patch,
> YARN-7202.yarn-native-services.013.patch,
> YARN-7202.yarn-native-services.014.patch
>
>
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]