Gour Saha created YARN-8779:
-------------------------------
Summary: Fix few discrepancies between YARN Service swagger spec
and code
Key: YARN-8779
URL: https://issues.apache.org/jira/browse/YARN-8779
Project: Hadoop YARN
Issue Type: Bug
Components: yarn-native-services
Affects Versions: 3.1.1, 3.1.0
Reporter: Gour Saha
Following issues were identified in YARN Service swagger definition during an
effort to integrate with a running service by generating Java and Go
client-side stubs from the spec -
1.
*restartPolicy* is wrong and should be *restart_policy*
2.
A DELETE request to a non-existing service (or a previously existing but
deleted service) throws an ApiException instead of something like
NotFoundException (the equivalent of 404). Note, DELETE of an existing service
behaves fine.
3.
The response code of DELETE request is 200. The spec says 204. Since the
response has a payload, the spec should be updated to 200 instead of 204.
4.
_DefaultApi.java_ client's _appV1ServicesServiceNameGetWithHttpInfo_ method
does not return a Service object. Swagger definition has the below bug in GET
response of */app/v1/services/\{service_name}* -
{code:java}
type: object
items:
$ref: '#/definitions/Service'
{code}
It should be -
{code:java}
$ref: '#/definitions/Service'
{code}
5.
Serialization issues were seen in all enum classes - ServiceState.java,
ContainerState.java, ComponentState.java, PlacementType.java and
PlacementScope.java.
Java client threw the below exception for ServiceState -
{code:java}
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot
construct instance of `org.apache.cb.yarn.service.api.records.ServiceState`
(although at least one Creator exists): no String-argument constructor/factory
method to deserialize from String value ('ACCEPTED')
at [Source:
(org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream);
line: 1, column: 121] (through reference chain:
org.apache.cb.yarn.service.api.records.Service["state”])
{code}
For Golang we saw this for ContainerState -
{code:java}
ERRO[2018-08-12T23:32:31.851-07:00] During GET request: json: cannot unmarshal
string into Go struct field Container.state of type yarnmodel.ContainerState
{code}
6.
*launch_time* actually returns an integer but swagger definition says date.
Hence, the following exception is seen on the client side -
{code:java}
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException:
Unexpected token (VALUE_NUMBER_INT), expected START_ARRAY: Expected array or
string.
at [Source:
(org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream);
line: 1, column: 477] (through reference chain:
org.apache.cb.yarn.service.api.records.Service["components"]->java.util.ArrayList[0]->org.apache.cb.yarn.service.api.records.Component["containers"]->java.util.ArrayList[0]->org.apache.cb.yarn.service.api.records.Container["launch_time”])
{code}
8.
*user.name* query param with a valid value is required for all API calls to an
unsecure cluster. This is not defined in the spec.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]