[ 
https://issues.apache.org/jira/browse/YARN-7202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16197421#comment-16197421
 ] 

Jian He commented on YARN-7202:
-------------------------------

bq.  If Service config changed, save configuration.
bq. If Service should increase/decrease containers, perform flex operation.
bq. If Service should be in STARTED state, then start containers.
bq. If Service should be in STOPPED state, then stop containers.

I meant given that start and stop are anyways the last operations. Are there 
any difference if I simply do this:
 {code}
    if (updateServiceData.getState() != null
        && updateServiceData.getState() == ServiceState.STOPPED) {
      return stopService(appName, false);
    }

    // If a START is requested
    if (updateServiceData.getState() != null
        && updateServiceData.getState() == ServiceState.STARTED) {
      return startService(appName);
    }
{code}
vs this, 
{code}
if (updateServiceData.getState() != null
        && updateServiceData.getState() == ServiceState.STOPPED) {
      Response r = stopService(appName, false);
      if (r.getStatus() ==
          Response.status(Status.BAD_REQUEST).build()
          .getStatus() ||
          r.getStatus() ==
          Response.status(Status.NOT_FOUND).build()
          .getStatus()) {
        hasBadRequest = true;
      } else if (r.getStatus() ==
          Response.status(Status.INTERNAL_SERVER_ERROR).build()
          .getStatus()) {
        hasErrors = true;
      }
    }

    // If a START is requested
    if (updateServiceData.getState() != null
        && updateServiceData.getState() == ServiceState.STARTED) {
      Response r = startService(appName);
      if (r.getStatus() ==
          Response.status(Status.BAD_REQUEST).build()
          .getStatus()) {
        hasBadRequest = true;
      } else if (r.getStatus() ==
          Response.status(Status.INTERNAL_SERVER_ERROR).build()
          .getStatus()) {
        hasErrors = true;
      }
    }
{code}
And that said, I'm going remove the flex operation in this updateService method.

bq. The dependency are required to import MiniCluster. For some reason, I think 
the code refactoring has some issues. 
I complied after removing these dependencies without any issues. Please double 
check.
{code}
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-common</artifactId>
      <type>test-jar</type>
    </dependency>

    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-hdfs</artifactId>
      <type>test-jar</type>
    </dependency>

    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-yarn-server-tests</artifactId>
      <type>test-jar</type>
    </dependency>
{code}
Can you remove the TestApiService in this jira and move it to whichever 
followup jira it fits? because, I don't see any fundamental difference of 
TestApiServer and TestApiService here, given that both use mocked client. (btw, 
the test class name is  confusing.)


> End-to-end 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
>         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
>
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to