Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-8779

Fix few discrepancies between YARN Service swagger spec and code

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.1.0, 3.1.1
    • None
    • yarn-native-services
    • None

    Description

      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} -

      type: object
      items:
        $ref: '#/definitions/Service'
      

      It should be -

      $ref: '#/definitions/Service'
      

       
      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 -

      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”])
      

      For Golang we saw this for ContainerState -

      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 
      

       
      6.
      launch_time actually returns an integer but swagger definition says date. Hence, the following exception is seen on the client side -

      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”])
      

       
      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.

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            gsaha Gour Saha
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: