aurora-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Sweeney (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AURORA-1327) MesosSchedulerImpl should check if reason is present when posting status updates
Date Wed, 20 May 2015 22:08:00 GMT

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

Kevin Sweeney commented on AURORA-1327:
---------------------------------------

Consider adding a PMD rule to guard against introducing this in the future.

Also, while enum isn't a value class in Java (though the protobuf spec treats it as one) we
could easily be bitten by autoboxing here when parsing thrift fields. Consider adding a PMD
rule that'll catch

{code}
TaskConfig t = new TaskConfig();
Optional<Integer> numCpus = Optional.ofNullable(t.getNumCpus());
{code}

and suggest

{code}
TaskConfig t = new TaskConfig();
Optional<Integer> numCpus = t.isSetNumCpus() ? Optional.of(t.getNumCpus()) : Optional.<Integer>empty();
{code}

Asked for guidance to see if this is possible: http://stackoverflow.com/questions/30361186/is-it-possible-to-detect-autoboxing-in-a-pmd-rule

> MesosSchedulerImpl should check if reason is present when posting status updates
> --------------------------------------------------------------------------------
>
>                 Key: AURORA-1327
>                 URL: https://issues.apache.org/jira/browse/AURORA-1327
>             Project: Aurora
>          Issue Type: Task
>          Components: Scheduler
>            Reporter: Joshua Cohen
>
> We export stats based on task statuses, however since protobuf enums default to a value
when unset, the reason stats we generate may not be correct. c.f https://github.com/apache/aurora/blob/998993dd802cf5e94a995aefd7a6c4ec90a1d3af/src/main/java/org/apache/aurora/scheduler/mesos/MesosSchedulerImpl.java#L228.
If reason is unset, it will default to the first enum value ({{REASON_COMMAND_EXECUTOR_FAILED}}).
> We should call {{status.hasReason()}} first and if it's not set, do not use the value
of {{status.getReason()}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message