New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to also bounce when scaling #795

Merged
merged 9 commits into from Dec 18, 2015

add bounceAfterScale param to default checkbox for request

  • Loading branch information...
ssalinas committed Dec 15, 2015
commit b3039cf44ec39ff532159699787f1fb3e3504701
@@ -42,6 +42,7 @@
private final Optional<String> group;
private final Optional<Set<String>> readOnlyGroups;
private final Optional<Boolean> bounceAfterScale;
@JsonCreator
public SingularityRequest(@JsonProperty("id") String id, @JsonProperty("requestType") RequestType requestType, @JsonProperty("owners") Optional<List<String>> owners,
@@ -51,7 +52,7 @@ public SingularityRequest(@JsonProperty("id") String id, @JsonProperty("requestT
@JsonProperty("quartzSchedule") Optional<String> quartzSchedule, @JsonProperty("rackAffinity") Optional<List<String>> rackAffinity,
@JsonProperty("slavePlacement") Optional<SlavePlacement> slavePlacement, @JsonProperty("scheduledExpectedRuntimeMillis") Optional<Long> scheduledExpectedRuntimeMillis,
@JsonProperty("waitAtLeastMillisAfterTaskFinishesForReschedule") Optional<Long> waitAtLeastMillisAfterTaskFinishesForReschedule, @JsonProperty("group") Optional<String> group,
@JsonProperty("readOnlyGroups") Optional<Set<String>> readOnlyGroups) {
@JsonProperty("readOnlyGroups") Optional<Set<String>> readOnlyGroups, @JsonProperty("bounceAfterScale") Optional<Boolean> bounceAfterScale) {
this.id = id;
this.owners = owners;
this.numRetriesOnFailure = numRetriesOnFailure;
@@ -69,6 +70,7 @@ public SingularityRequest(@JsonProperty("id") String id, @JsonProperty("requestT
this.waitAtLeastMillisAfterTaskFinishesForReschedule = waitAtLeastMillisAfterTaskFinishesForReschedule;
this.group = group;
this.readOnlyGroups = readOnlyGroups;
this.bounceAfterScale = bounceAfterScale;
if (requestType == null) {
this.requestType = RequestType.fromDaemonAndScheduleAndLoadBalanced(schedule, daemon, loadBalanced);
@@ -93,7 +95,8 @@ public SingularityRequestBuilder toBuilder() {
.setSlavePlacement(slavePlacement)
.setScheduledExpectedRuntimeMillis(scheduledExpectedRuntimeMillis)
.setGroup(group)
.setReadOnlyGroups(readOnlyGroups);
.setReadOnlyGroups(readOnlyGroups)
.setBounceAfterScale(bounceAfterScale);
}
public String getId() {
@@ -229,6 +232,10 @@ public ScheduleType getScheduleTypeSafe() {
return readOnlyGroups;
}
public boolean isBounceAfterScale() {

This comment has been minimized.

@wsorenson

wsorenson Dec 17, 2015

Member

You need one that is the Json getter that just returns the actual value.

If you want to add a helper, you should @JsonIGnore it.

@wsorenson

wsorenson Dec 17, 2015

Member

You need one that is the Json getter that just returns the actual value.

If you want to add a helper, you should @JsonIGnore it.

return bounceAfterScale.or(Boolean.FALSE).booleanValue();
}
@Override
public String toString() {
return "SingularityRequest[" +
@@ -250,6 +257,7 @@ public String toString() {
", loadBalanced=" + loadBalanced +
", group=" + group +
", readOnlyGroups=" + readOnlyGroups +
", bounceAfterScale=" + bounceAfterScale +
']';
}
@@ -278,11 +286,12 @@ public boolean equals(Object o) {
Objects.equals(slavePlacement, request.slavePlacement) &&
Objects.equals(loadBalanced, request.loadBalanced) &&
Objects.equals(group, request.group) &&
Objects.equals(readOnlyGroups, request.readOnlyGroups);
Objects.equals(readOnlyGroups, request.readOnlyGroups) &&
Objects.equals(bounceAfterScale, request.bounceAfterScale);
}
@Override
public int hashCode() {
return Objects.hash(id, requestType, owners, numRetriesOnFailure, schedule, quartzSchedule, scheduleType, killOldNonLongRunningTasksAfterMillis, scheduledExpectedRuntimeMillis, waitAtLeastMillisAfterTaskFinishesForReschedule, instances, rackSensitive, rackAffinity, slavePlacement, loadBalanced, group, readOnlyGroups);
return Objects.hash(id, requestType, owners, numRetriesOnFailure, schedule, quartzSchedule, scheduleType, killOldNonLongRunningTasksAfterMillis, scheduledExpectedRuntimeMillis, waitAtLeastMillisAfterTaskFinishesForReschedule, instances, rackSensitive, rackAffinity, slavePlacement, loadBalanced, group, readOnlyGroups, bounceAfterScale);
}
}
@@ -37,6 +37,7 @@
private Optional<String> group;
private Optional<Set<String>> readOnlyGroups;
private Optional<Boolean> bounceAfterScale;
public SingularityRequestBuilder(String id, RequestType requestType) {
this.id = id;
@@ -57,11 +58,12 @@ public SingularityRequestBuilder(String id, RequestType requestType) {
this.waitAtLeastMillisAfterTaskFinishesForReschedule = Optional.absent();
this.group = Optional.absent();
this.readOnlyGroups = Optional.absent();
this.bounceAfterScale = Optional.absent();
}
public SingularityRequest build() {
return new SingularityRequest(id, requestType, owners, numRetriesOnFailure, schedule, daemon, instances, rackSensitive, loadBalanced, killOldNonLongRunningTasksAfterMillis, scheduleType, quartzSchedule,
rackAffinity, slavePlacement, scheduledExpectedRuntimeMillis, waitAtLeastMillisAfterTaskFinishesForReschedule, group, readOnlyGroups);
rackAffinity, slavePlacement, scheduledExpectedRuntimeMillis, waitAtLeastMillisAfterTaskFinishesForReschedule, group, readOnlyGroups, bounceAfterScale);
}
public Optional<Boolean> getLoadBalanced() {
@@ -218,6 +220,15 @@ public SingularityRequestBuilder setReadOnlyGroups(Optional<Set<String>> readOnl
return this;
}
public Optional<Boolean> getBounceAfterScale() {
return bounceAfterScale;
}
public SingularityRequestBuilder setBounceAfterScale(Optional<Boolean> bounceAfterScale) {
this.bounceAfterScale = bounceAfterScale;
return this;
}
@Override
public String toString() {
return "SingularityRequestBuilder[" +
@@ -239,6 +250,7 @@ public String toString() {
", loadBalanced=" + loadBalanced +
", group=" + group +
", readOnlyGroups=" + readOnlyGroups +
", bounceAfterScale=" + bounceAfterScale +
']';
}
@@ -266,11 +278,13 @@ public boolean equals(Object o) {
Objects.equals(rackAffinity, that.rackAffinity) &&
Objects.equals(slavePlacement, that.slavePlacement) &&
Objects.equals(loadBalanced, that.loadBalanced) &&
Objects.equals(group, that.group);
Objects.equals(group, that.group) &&
Objects.equals(readOnlyGroups, that.readOnlyGroups) &&
Objects.equals(bounceAfterScale, that.bounceAfterScale);
}
@Override
public int hashCode() {
return Objects.hash(id, requestType, owners, numRetriesOnFailure, schedule, quartzSchedule, scheduleType, killOldNonLongRunningTasksAfterMillis, scheduledExpectedRuntimeMillis, waitAtLeastMillisAfterTaskFinishesForReschedule, instances, rackSensitive, rackAffinity, slavePlacement, loadBalanced, group);
return Objects.hash(id, requestType, owners, numRetriesOnFailure, schedule, quartzSchedule, scheduleType, killOldNonLongRunningTasksAfterMillis, scheduledExpectedRuntimeMillis, waitAtLeastMillisAfterTaskFinishesForReschedule, instances, rackSensitive, rackAffinity, slavePlacement, loadBalanced, group, readOnlyGroups, bounceAfterScale);
}
}
@@ -35,6 +35,8 @@ class Request extends Model
data.instances = data.request.instances or 1
data.hasMoreThanOneInstance = data.instances > 1
data.bounceAfterScale = data.request.bounceAfterScale
data.paused = data.state is 'PAUSED'
data.deleted = data.state is 'DELETED'
data.inCooldown = data.state is 'SYSTEM_COOLDOWN'
@@ -122,6 +124,7 @@ class Request extends Model
vex.dialog.prompt
message: scaleTemplate
id: @get "id"
bounceAfterScale: @get "bounceAfterScale"
buttons: [
$.extend _.clone(vex.dialog.buttons.YES), text: 'Scale'
vex.dialog.buttons.NO
@@ -2,7 +2,7 @@
<pre>{{ id }}</pre>
<label for="bounce" id="bounce-label">
<input type="checkbox" id="bounce">
<input type="checkbox" id="bounce"{{#if bounceAfterScale}} checked{{/if}}>
Bounce after scaling
</label>

This comment has been minimized.

@tpetr

tpetr Dec 17, 2015

Member

I'd consider moving the bounce checkbox to after the scale input to fit in with the "bounce after scaling" wording.

@tpetr

tpetr Dec 17, 2015

Member

I'd consider moving the bounce checkbox to after the scale input to fit in with the "bounce after scaling" wording.

This comment has been minimized.

@tpetr

tpetr Dec 17, 2015

Member

bonus points for indenting the incremental bounce option + greying it out if the bounce checkmark is unchecked

@tpetr

tpetr Dec 17, 2015

Member

bonus points for indenting the incremental bounce option + greying it out if the bounce checkmark is unchecked

This comment has been minimized.

@ssalinas

ssalinas Dec 17, 2015

Member

right now the incremental option isn't show if bounce checkmark is unchecked and appears when you check it. would you rather see it greyed out instead of having it hidden?

@ssalinas

ssalinas Dec 17, 2015

Member

right now the incremental option isn't show if bounce checkmark is unchecked and appears when you check it. would you rather see it greyed out instead of having it hidden?

<div id="incremental-bounce-options" hidden>
ProTip! Use n and p to navigate between commits in a pull request.