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

Qi Zhu edited comment on YARN-10674 at 3/18/21, 1:29 PM:
---------------------------------------------------------

Thanks [~gandras] for reply.

If we don't have  PreemptionMode.ENABLED, we can use the has option to know if 
this is enabled and passed to PreemptionMode enabled field.
{code:java}
public static PreemptionMode fromString(String cliOption,
    boolean enabled) {
  if (enabled) {
    return PreemptionMode.ENABLED;
  } else {
    if (StringUtils.isEmpty(cliOption)) {
      return PreemptionMode.NO_POLICY;
    } else {
      if (cliOption.trim().
          equals(PreemptionMode.OBSERVE_ONLY.getCliOption())) {
        return PreemptionMode.OBSERVE_ONLY;
      } else if (cliOption.trim().
          equals(PreemptionMode.NO_POLICY.getCliOption())) {
        return PreemptionMode.NO_POLICY;
      } else {
        return null;
      }
    }
  }
}
{code}
If return null:
{code:java}
private static void checkDisablePreemption(FSConfigToCSConfigConverterParams.
    PreemptionMode preemptionMode) {
  if (preemptionMode == null) {
    throw new PreconditionException(
        "Specified disable-preemption mode is illegal, " +
            " use nopolicy or observeonly.");
  }
}
{code}
 

But fromString should return a value to make it used later,  if it will return 
null , it will confused with the case that we disabled but print not nopolicy 
or observeonly. I think the flag will make this clear that we have four case 
return value:
 # null mean that we use illegal value 
 # PreemptionMode.ENABLED 
 # PreemptionMode.OBSERVE_ONLY
 # PreemptionMode.NO_POLICY

What's your opinion about this?

 


was (Author: zhuqi):
Thanks [~gandras] for reply.

If we don't have  PreemptionMode.ENABLED, we can use the has option to know if 
this is enabled and passed to PreemptionMode enabled field.
{code:java}
public static PreemptionMode fromString(String cliOption,
    boolean enabled) {
  if (enabled) {
    return PreemptionMode.ENABLED;
  } else {
    if (StringUtils.isEmpty(cliOption)) {
      return PreemptionMode.NO_POLICY;
    } else {
      if (cliOption.trim().
          equals(PreemptionMode.OBSERVE_ONLY.getCliOption())) {
        return PreemptionMode.OBSERVE_ONLY;
      } else if (cliOption.trim().
          equals(PreemptionMode.NO_POLICY.getCliOption())) {
        return PreemptionMode.NO_POLICY;
      } else {
        return null;
      }
    }
  }
}
{code}
But fromString should return a value to make it used later,  if it will return 
null , it will confused with the case that we disabled but print not nopolicy 
or observeonly. I think the flag will make this clear that we have four case 
return value:
 # null mean that we use illegal value 
 # PreemptionMode.ENABLED 
 # PreemptionMode.OBSERVE_ONLY
 # PreemptionMode.NO_POLICY

What's your opinion about this?

 

> fs2cs: should support auto created queue deletion.
> --------------------------------------------------
>
>                 Key: YARN-10674
>                 URL: https://issues.apache.org/jira/browse/YARN-10674
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>            Reporter: Qi Zhu
>            Assignee: Qi Zhu
>            Priority: Major
>              Labels: fs2cs
>         Attachments: YARN-10674.001.patch, YARN-10674.002.patch, 
> YARN-10674.003.patch, YARN-10674.004.patch, YARN-10674.005.patch, 
> YARN-10674.006.patch, YARN-10674.007.patch, YARN-10674.008.patch, 
> YARN-10674.009.patch, YARN-10674.010.patch, YARN-10674.011.patch, 
> YARN-10674.012.patch, YARN-10674.013.patch, YARN-10674.014.patch, 
> YARN-10674.015.patch
>
>
> In FS the auto deletion check interval is 10s.
> {code:java}
> @Override
> public void onCheck() {
>   queueMgr.removeEmptyDynamicQueues();
>   queueMgr.removePendingIncompatibleQueues();
> }
> while (running) {
>   try {
>     synchronized (this) {
>       reloadListener.onCheck();
>     }
> ...
> Thread.sleep(reloadIntervalMs);
> }
> /** Time to wait between checks of the allocation file */
> public static final long ALLOC_RELOAD_INTERVAL_MS = 10 * 1000;{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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