ambari git commit: AMBARI-19055 - Removing Tasks From host_role_command Causes Upgrades To Show As PENDING (jonathanhurley)
Repository: ambari Updated Branches: refs/heads/branch-2.5 5e8a30210 -> 2fdd80873 AMBARI-19055 - Removing Tasks From host_role_command Causes Upgrades To Show As PENDING (jonathanhurley) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2fdd8087 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2fdd8087 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2fdd8087 Branch: refs/heads/branch-2.5 Commit: 2fdd80873a4a31b53d39a101846cabc6a7bbd7e5 Parents: 5e8a302 Author: Jonathan HurleyAuthored: Sat Dec 3 08:35:12 2016 -0500 Committer: Jonathan Hurley Committed: Sat Dec 3 17:01:27 2016 -0500 -- .../controller/internal/CalculatedStatus.java | 52 +++- .../internal/RequestResourceProvider.java | 34 - .../internal/StageResourceProvider.java | 2 +- .../ambari/server/topology/TopologyManager.java | 19 ++- .../internal/CalculatedStatusTest.java | 31 .../internal/RequestResourceProviderTest.java | 12 +++-- 6 files changed, 121 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/2fdd8087/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java index 3a86aef..3c415df 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java @@ -53,6 +53,17 @@ public class CalculatedStatus { */ private final double percent; + /** + * A status which represents a COMPLETED state at 0% + */ + public static final CalculatedStatus COMPLETED = new CalculatedStatus(HostRoleStatus.COMPLETED, + HostRoleStatus.COMPLETED, 100.0); + + /** + * A status which represents a PENDING state at 0% + */ + public static final CalculatedStatus PENDING = new CalculatedStatus(HostRoleStatus.PENDING, + HostRoleStatus.PENDING, 0.0); // - Constructors -- @@ -79,12 +90,6 @@ public class CalculatedStatus { this.percent = percent; } - /** - * Static factory method to get Status that represents a Completed state - */ - public static CalculatedStatus getCompletedStatus() { -return new CalculatedStatus(HostRoleStatus.COMPLETED, HostRoleStatus.COMPLETED, 100.0); - } // - CalculatedStatus -- @@ -291,14 +296,25 @@ public class CalculatedStatus { } /** - * Calculates the overall status of an upgrade. - * @param stageDto the map of stage-to-summary value objects - * @param stageIds the stage ids to consider from the value objects + * Calculates the overall status of an upgrade. If there are no tasks, then a + * status of {@link HostRoleStatus#COMPLETED} is returned. + * + * @param stageDto + * the map of stage-to-summary value objects + * @param stageIds + * the stage ids to consider from the value objects * @return the calculated status */ public static CalculatedStatus statusFromStageSummary(Map stageDto, Set stageIds) { +// if either are empty, then we have no tasks and therefore no status - we +// should return COMPLETED. This can happen if someone removes all tasks but +// leaves the stages and request +if (stageDto.isEmpty() || stageIds.isEmpty()) { + return COMPLETED; +} + Collection stageStatuses = new HashSet<>(); Collection stageDisplayStatuses = new HashSet<>(); Collection taskStatuses = new ArrayList<>(); @@ -378,19 +394,28 @@ public class CalculatedStatus { */ public static HostRoleStatus calculateSummaryStatusOfStage(Map counters, int total, boolean skippable) { + +// when there are 0 tasks, return COMPLETED +if (total == 0) { + return HostRoleStatus.COMPLETED; +} + if (counters.get(HostRoleStatus.PENDING) == total) { return HostRoleStatus.PENDING; } + // By definition, any tasks in a future stage must be held in a PENDING status. if (counters.get(HostRoleStatus.HOLDING) > 0 || counters.get(HostRoleStatus.HOLDING_FAILED) > 0 || counters.get(HostRoleStatus.HOLDING_TIMEDOUT) > 0) { return counters.get(HostRoleStatus.HOLDING) > 0 ? HostRoleStatus.HOLDING :
ambari git commit: AMBARI-19055 - Removing Tasks From host_role_command Causes Upgrades To Show As PENDING (jonathanhurley)
Repository: ambari Updated Branches: refs/heads/trunk 5ec73bce0 -> 12a3cd871 AMBARI-19055 - Removing Tasks From host_role_command Causes Upgrades To Show As PENDING (jonathanhurley) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/12a3cd87 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/12a3cd87 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/12a3cd87 Branch: refs/heads/trunk Commit: 12a3cd87184167cadf3cd12eb9b3c9d67dd3907a Parents: 5ec73bc Author: Jonathan HurleyAuthored: Sat Dec 3 08:35:12 2016 -0500 Committer: Jonathan Hurley Committed: Sat Dec 3 14:09:44 2016 -0500 -- .../controller/internal/CalculatedStatus.java | 52 +++- .../internal/RequestResourceProvider.java | 34 - .../internal/StageResourceProvider.java | 2 +- .../ambari/server/topology/TopologyManager.java | 19 ++- .../internal/CalculatedStatusTest.java | 31 .../internal/RequestResourceProviderTest.java | 12 +++-- 6 files changed, 121 insertions(+), 29 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/12a3cd87/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java index 3a86aef..3c415df 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java @@ -53,6 +53,17 @@ public class CalculatedStatus { */ private final double percent; + /** + * A status which represents a COMPLETED state at 0% + */ + public static final CalculatedStatus COMPLETED = new CalculatedStatus(HostRoleStatus.COMPLETED, + HostRoleStatus.COMPLETED, 100.0); + + /** + * A status which represents a PENDING state at 0% + */ + public static final CalculatedStatus PENDING = new CalculatedStatus(HostRoleStatus.PENDING, + HostRoleStatus.PENDING, 0.0); // - Constructors -- @@ -79,12 +90,6 @@ public class CalculatedStatus { this.percent = percent; } - /** - * Static factory method to get Status that represents a Completed state - */ - public static CalculatedStatus getCompletedStatus() { -return new CalculatedStatus(HostRoleStatus.COMPLETED, HostRoleStatus.COMPLETED, 100.0); - } // - CalculatedStatus -- @@ -291,14 +296,25 @@ public class CalculatedStatus { } /** - * Calculates the overall status of an upgrade. - * @param stageDto the map of stage-to-summary value objects - * @param stageIds the stage ids to consider from the value objects + * Calculates the overall status of an upgrade. If there are no tasks, then a + * status of {@link HostRoleStatus#COMPLETED} is returned. + * + * @param stageDto + * the map of stage-to-summary value objects + * @param stageIds + * the stage ids to consider from the value objects * @return the calculated status */ public static CalculatedStatus statusFromStageSummary(Map stageDto, Set stageIds) { +// if either are empty, then we have no tasks and therefore no status - we +// should return COMPLETED. This can happen if someone removes all tasks but +// leaves the stages and request +if (stageDto.isEmpty() || stageIds.isEmpty()) { + return COMPLETED; +} + Collection stageStatuses = new HashSet<>(); Collection stageDisplayStatuses = new HashSet<>(); Collection taskStatuses = new ArrayList<>(); @@ -378,19 +394,28 @@ public class CalculatedStatus { */ public static HostRoleStatus calculateSummaryStatusOfStage(Map counters, int total, boolean skippable) { + +// when there are 0 tasks, return COMPLETED +if (total == 0) { + return HostRoleStatus.COMPLETED; +} + if (counters.get(HostRoleStatus.PENDING) == total) { return HostRoleStatus.PENDING; } + // By definition, any tasks in a future stage must be held in a PENDING status. if (counters.get(HostRoleStatus.HOLDING) > 0 || counters.get(HostRoleStatus.HOLDING_FAILED) > 0 || counters.get(HostRoleStatus.HOLDING_TIMEDOUT) > 0) { return counters.get(HostRoleStatus.HOLDING) > 0 ? HostRoleStatus.HOLDING : counters.get(HostRoleStatus.HOLDING_FAILED) > 0 ?
ambari git commit: Revert "AMBARI-19055 - Removing Tasks From host_role_command Causes Upgrades To Show As PENDING (jonathanhurley)"
Repository: ambari Updated Branches: refs/heads/branch-2.5 32af20930 -> 5e8a30210 Revert "AMBARI-19055 - Removing Tasks From host_role_command Causes Upgrades To Show As PENDING (jonathanhurley)" This reverts commit 19ca036c683e6d1741f1b6d73a2f3326f3fc20fd. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5e8a3021 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5e8a3021 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5e8a3021 Branch: refs/heads/branch-2.5 Commit: 5e8a3021003549f9af63ee3c104410421c5e54d5 Parents: 32af209 Author: Jonathan HurleyAuthored: Sat Dec 3 08:33:31 2016 -0500 Committer: Jonathan Hurley Committed: Sat Dec 3 08:33:31 2016 -0500 -- .../controller/internal/CalculatedStatus.java | 52 +--- .../internal/RequestResourceProvider.java | 34 + .../internal/StageResourceProvider.java | 2 +- .../internal/CalculatedStatusTest.java | 31 .../internal/RequestResourceProviderTest.java | 12 ++--- 5 files changed, 28 insertions(+), 103 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/5e8a3021/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java index 3c415df..3a86aef 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java @@ -53,17 +53,6 @@ public class CalculatedStatus { */ private final double percent; - /** - * A status which represents a COMPLETED state at 0% - */ - public static final CalculatedStatus COMPLETED = new CalculatedStatus(HostRoleStatus.COMPLETED, - HostRoleStatus.COMPLETED, 100.0); - - /** - * A status which represents a PENDING state at 0% - */ - public static final CalculatedStatus PENDING = new CalculatedStatus(HostRoleStatus.PENDING, - HostRoleStatus.PENDING, 0.0); // - Constructors -- @@ -90,6 +79,12 @@ public class CalculatedStatus { this.percent = percent; } + /** + * Static factory method to get Status that represents a Completed state + */ + public static CalculatedStatus getCompletedStatus() { +return new CalculatedStatus(HostRoleStatus.COMPLETED, HostRoleStatus.COMPLETED, 100.0); + } // - CalculatedStatus -- @@ -296,25 +291,14 @@ public class CalculatedStatus { } /** - * Calculates the overall status of an upgrade. If there are no tasks, then a - * status of {@link HostRoleStatus#COMPLETED} is returned. - * - * @param stageDto - * the map of stage-to-summary value objects - * @param stageIds - * the stage ids to consider from the value objects + * Calculates the overall status of an upgrade. + * @param stageDto the map of stage-to-summary value objects + * @param stageIds the stage ids to consider from the value objects * @return the calculated status */ public static CalculatedStatus statusFromStageSummary(Map stageDto, Set stageIds) { -// if either are empty, then we have no tasks and therefore no status - we -// should return COMPLETED. This can happen if someone removes all tasks but -// leaves the stages and request -if (stageDto.isEmpty() || stageIds.isEmpty()) { - return COMPLETED; -} - Collection stageStatuses = new HashSet<>(); Collection stageDisplayStatuses = new HashSet<>(); Collection taskStatuses = new ArrayList<>(); @@ -394,28 +378,19 @@ public class CalculatedStatus { */ public static HostRoleStatus calculateSummaryStatusOfStage(Map counters, int total, boolean skippable) { - -// when there are 0 tasks, return COMPLETED -if (total == 0) { - return HostRoleStatus.COMPLETED; -} - if (counters.get(HostRoleStatus.PENDING) == total) { return HostRoleStatus.PENDING; } - // By definition, any tasks in a future stage must be held in a PENDING status. if (counters.get(HostRoleStatus.HOLDING) > 0 || counters.get(HostRoleStatus.HOLDING_FAILED) > 0 || counters.get(HostRoleStatus.HOLDING_TIMEDOUT) > 0) { return counters.get(HostRoleStatus.HOLDING) > 0 ? HostRoleStatus.HOLDING :
ambari git commit: Revert "AMBARI-19055 - Removing Tasks From host_role_command Causes Upgrades To Show As PENDING (jonathanhurley)"
Repository: ambari Updated Branches: refs/heads/trunk 3096c79df -> 5ec73bce0 Revert "AMBARI-19055 - Removing Tasks From host_role_command Causes Upgrades To Show As PENDING (jonathanhurley)" This reverts commit 32840c1ed434ae4cc99e3ab6f7d3f2604fb69d06. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5ec73bce Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5ec73bce Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5ec73bce Branch: refs/heads/trunk Commit: 5ec73bce006a659f33c09c57cb50f28037eca5d7 Parents: 3096c79 Author: Jonathan HurleyAuthored: Sat Dec 3 08:22:31 2016 -0500 Committer: Jonathan Hurley Committed: Sat Dec 3 08:22:31 2016 -0500 -- .../controller/internal/CalculatedStatus.java | 52 +--- .../internal/RequestResourceProvider.java | 34 + .../internal/StageResourceProvider.java | 2 +- .../internal/CalculatedStatusTest.java | 31 .../internal/RequestResourceProviderTest.java | 12 ++--- 5 files changed, 28 insertions(+), 103 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/5ec73bce/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java -- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java index 3c415df..3a86aef 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CalculatedStatus.java @@ -53,17 +53,6 @@ public class CalculatedStatus { */ private final double percent; - /** - * A status which represents a COMPLETED state at 0% - */ - public static final CalculatedStatus COMPLETED = new CalculatedStatus(HostRoleStatus.COMPLETED, - HostRoleStatus.COMPLETED, 100.0); - - /** - * A status which represents a PENDING state at 0% - */ - public static final CalculatedStatus PENDING = new CalculatedStatus(HostRoleStatus.PENDING, - HostRoleStatus.PENDING, 0.0); // - Constructors -- @@ -90,6 +79,12 @@ public class CalculatedStatus { this.percent = percent; } + /** + * Static factory method to get Status that represents a Completed state + */ + public static CalculatedStatus getCompletedStatus() { +return new CalculatedStatus(HostRoleStatus.COMPLETED, HostRoleStatus.COMPLETED, 100.0); + } // - CalculatedStatus -- @@ -296,25 +291,14 @@ public class CalculatedStatus { } /** - * Calculates the overall status of an upgrade. If there are no tasks, then a - * status of {@link HostRoleStatus#COMPLETED} is returned. - * - * @param stageDto - * the map of stage-to-summary value objects - * @param stageIds - * the stage ids to consider from the value objects + * Calculates the overall status of an upgrade. + * @param stageDto the map of stage-to-summary value objects + * @param stageIds the stage ids to consider from the value objects * @return the calculated status */ public static CalculatedStatus statusFromStageSummary(Map stageDto, Set stageIds) { -// if either are empty, then we have no tasks and therefore no status - we -// should return COMPLETED. This can happen if someone removes all tasks but -// leaves the stages and request -if (stageDto.isEmpty() || stageIds.isEmpty()) { - return COMPLETED; -} - Collection stageStatuses = new HashSet<>(); Collection stageDisplayStatuses = new HashSet<>(); Collection taskStatuses = new ArrayList<>(); @@ -394,28 +378,19 @@ public class CalculatedStatus { */ public static HostRoleStatus calculateSummaryStatusOfStage(Map counters, int total, boolean skippable) { - -// when there are 0 tasks, return COMPLETED -if (total == 0) { - return HostRoleStatus.COMPLETED; -} - if (counters.get(HostRoleStatus.PENDING) == total) { return HostRoleStatus.PENDING; } - // By definition, any tasks in a future stage must be held in a PENDING status. if (counters.get(HostRoleStatus.HOLDING) > 0 || counters.get(HostRoleStatus.HOLDING_FAILED) > 0 || counters.get(HostRoleStatus.HOLDING_TIMEDOUT) > 0) { return counters.get(HostRoleStatus.HOLDING) > 0 ? HostRoleStatus.HOLDING :