-
Notifications
You must be signed in to change notification settings - Fork 186
Self Service Shuffle Opt Out #2060
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
Merged
Merged
Changes from all commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
4f7caa7
shuffle lowest memory utilization tasks instead of highest
7cfd013
modify unit test to reflect new shuffling logic
f21141a
slight refactor, postpone larger refactor
99b1770
raw refactor of shuffle logic
48e12a0
cleanup shuffle refactor, wire into SingularityUsagePoller
bfcae86
method consistency for CPU/memory shuffles
e5fbb6b
resolve checkstyle violations
54ef4bc
uniform action id per task shuffle
48c385f
minimal viable shuffle unit tests
0b9eafa
fix off by one error in shuffle task count check
1881eb8
actually count initial # of shuffling tasks per host
2d6dae8
correctly update overusage, attempt to ensure that slave reaches reso…
c3ebb94
rearrange helper test methods
5c03641
fix bug in initial CPU utilization calculation + memory shuffle unit …
0e344c8
more thorough shuffle unit test
335c3c0
attempts to use helper methods in shuffle unit testing have failed
7a5ba4f
memory shuffle should take into account external memory pressure
52d3dca
add slightly more logging if shuffling >= 1 slave
3745584
sanity check logging, remove after sanity regained
40d3b59
move shuffle debug logging
825b744
self-service shuffle backend
c7cccf6
refactor self-service shuffle backend into own resource/manager
00324e6
use dynamic shuffle blacklist when computing possible tasks to shuffle
d19e42e
self-service shuffle fe api actions
56fc051
remove unused configuration class
b194deb
add self-service ui backend classes to modules
51bb0dd
shuffle opt out status should be attached to RequestParent to be cons…
40f061a
self-service shuffle: breaking the UI for a good cause
d05e352
I've made a terrible mistake, but it should be checkpointed just in case
85cea69
revert SingularityRequestParent changes
2219bae
new base path for shuffle resource
f2de75f
unbreak the self-service shuffle ui
0d8e4bc
workaround API structure
8bfa0e2
silly mistakes
018c9e1
preload hardcoded configuration blacklist in manager
68450b6
deprecate hardcoded configuration blacklist
98b9953
shuffle blacklist tests
c776862
Clean up FE code, fix {} in resources
f336d89
use correct redux flow
627d77d
testing configuration preloading is surprisingly intricate
2f31deb
undo formatting changes to request resource
b3a8112
zkmigration to phase out configuration doNotShuffleRequests
59fd951
remove stray parameter
7ca2418
the letter a
b72447c
improve shuffle cfg test
345716b
improve shuffle resource authorization
b501e3b
restore RequestForm to master state
dea8613
revert back to shuffle opt out button in request header
f03d22f
restore functionality of shuffle opt out button/modal
b7b7b33
add shuffle opt out button/modal to task detail page
c79c7e3
should've reset from staging
62105d5
update shuffle opt-out modal text
1b15dbe
use hs_qa request resource version
8838bbc
resolve merge conflicts with smarter-shuffle
c08b2f0
resolve merge conflicts with hs_qa
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...larityService/src/main/java/com/hubspot/singularity/data/ShuffleConfigurationManager.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| package com.hubspot.singularity.data; | ||
|
|
||
| import com.codahale.metrics.MetricRegistry; | ||
| import com.google.inject.Inject; | ||
| import com.hubspot.singularity.SingularityCreateResult; | ||
| import com.hubspot.singularity.SingularityDeleteResult; | ||
| import com.hubspot.singularity.config.SingularityConfiguration; | ||
| import org.apache.curator.framework.CuratorFramework; | ||
| import org.apache.curator.utils.ZKPaths; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public class ShuffleConfigurationManager extends CuratorAsyncManager { | ||
| private static final Logger LOG = LoggerFactory.getLogger(RequestManager.class); | ||
|
|
||
| private static final String ZK_ROOT_PATH = "/shuffle"; | ||
| private static final String BLACKLIST_PATH = ZK_ROOT_PATH + "/blacklist"; | ||
|
|
||
| @Inject | ||
| public ShuffleConfigurationManager( | ||
| CuratorFramework curator, | ||
| SingularityConfiguration configuration, | ||
| MetricRegistry metricRegistry | ||
| ) { | ||
| super(curator, configuration, metricRegistry); | ||
| } | ||
|
|
||
| private String getShuffleBlacklistPath(String requestId) { | ||
| return ZKPaths.makePath(BLACKLIST_PATH, requestId); | ||
| } | ||
|
|
||
| public List<String> getShuffleBlacklist() { | ||
| return getChildren(BLACKLIST_PATH); | ||
| } | ||
|
|
||
| public SingularityCreateResult addToShuffleBlacklist(String requestId) { | ||
| return create(getShuffleBlacklistPath(requestId)); | ||
| } | ||
|
|
||
| public SingularityDeleteResult removeFromShuffleBlacklist(String requestId) { | ||
| return delete(getShuffleBlacklistPath(requestId)); | ||
| } | ||
|
|
||
| public boolean isOnShuffleBlacklist(String requestId) { | ||
| return exists(getShuffleBlacklistPath(requestId)); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...ce/src/main/java/com/hubspot/singularity/data/zkmigrations/ShuffleBlacklistMigration.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| package com.hubspot.singularity.data.zkmigrations; | ||
|
|
||
| import com.google.inject.Inject; | ||
| import com.google.inject.Singleton; | ||
| import com.hubspot.singularity.config.SingularityConfiguration; | ||
| import com.hubspot.singularity.data.ShuffleConfigurationManager; | ||
|
|
||
| @Singleton | ||
| public class ShuffleBlacklistMigration extends ZkDataMigration { | ||
| private final SingularityConfiguration configuration; | ||
| private final ShuffleConfigurationManager manager; | ||
|
|
||
|
|
||
| @Inject | ||
| public ShuffleBlacklistMigration(SingularityConfiguration configuration, ShuffleConfigurationManager manager) { | ||
| super(16); | ||
| this.configuration = configuration; | ||
| this.manager = manager; | ||
| } | ||
|
|
||
| @Override | ||
| public void applyMigration() { | ||
| for (String requestId : configuration.getDoNotShuffleRequests()) { | ||
| manager.addToShuffleBlacklist(requestId); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
...Service/src/main/java/com/hubspot/singularity/resources/ShuffleConfigurationResource.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| package com.hubspot.singularity.resources; | ||
|
|
||
| import com.fasterxml.jackson.databind.ObjectMapper; | ||
| import com.google.inject.Inject; | ||
| import com.hubspot.singularity.SingularityAuthorizationScope; | ||
| import com.hubspot.singularity.SingularityRequestWithState; | ||
| import com.hubspot.singularity.SingularityUser; | ||
| import com.hubspot.singularity.WebExceptions; | ||
| import com.hubspot.singularity.auth.SingularityAuthorizationHelper; | ||
| import com.hubspot.singularity.config.ApiPaths; | ||
| import com.hubspot.singularity.data.RequestManager; | ||
| import com.hubspot.singularity.data.ShuffleConfigurationManager; | ||
| import com.ning.http.client.AsyncHttpClient; | ||
| import io.dropwizard.auth.Auth; | ||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.Parameter; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import io.swagger.v3.oas.annotations.tags.Tags; | ||
| import org.apache.curator.framework.recipes.leader.LeaderLatch; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import javax.ws.rs.DELETE; | ||
| import javax.ws.rs.GET; | ||
| import javax.ws.rs.POST; | ||
| import javax.ws.rs.Path; | ||
| import javax.ws.rs.PathParam; | ||
| import javax.ws.rs.Produces; | ||
| import javax.ws.rs.core.MediaType; | ||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| @Path(ApiPaths.SHUFFLE_RESOURCE_PATH) | ||
| @Produces({ MediaType.APPLICATION_JSON }) | ||
| @Schema(title = "Manages shuffle configuration of Singularity.") | ||
| @Tags({@Tag(name = "Shuffle")}) | ||
| public class ShuffleConfigurationResource extends AbstractLeaderAwareResource { | ||
| private static final Logger LOG = LoggerFactory.getLogger(ShuffleConfigurationResource.class); | ||
|
|
||
| private final ShuffleConfigurationManager shuffleCfgManager; | ||
| private final SingularityAuthorizationHelper authorizationHelper; | ||
|
|
||
| @Inject | ||
| public ShuffleConfigurationResource( | ||
| AsyncHttpClient httpClient, LeaderLatch leaderLatch, ObjectMapper objectMapper, | ||
| ShuffleConfigurationManager shuffleCfgManager, | ||
| SingularityAuthorizationHelper authorizationHelper | ||
| ) { | ||
| super(httpClient, leaderLatch, objectMapper); | ||
|
|
||
| this.shuffleCfgManager = shuffleCfgManager; | ||
| this.authorizationHelper = authorizationHelper; | ||
| } | ||
|
|
||
| @GET | ||
| @Path("/blacklist") | ||
| @Operation(summary = "Retrieve the set of request IDs that should not be shuffled.") | ||
| public List<String> getShuffleBlacklist(@Parameter(hidden = true) @Auth SingularityUser user) { | ||
| authorizationHelper.checkReadAuthorization(user); | ||
| return shuffleCfgManager.getShuffleBlacklist(); | ||
| } | ||
|
|
||
| @GET | ||
| @Path("/blacklist/{requestId}") | ||
| @Operation(summary = "Check if a request ID is on the shuffle blacklist.") | ||
| public boolean isOnShuffleBlacklist( | ||
| @Parameter(hidden = true) @Auth SingularityUser user, | ||
| @Parameter(required = true, description = "The Request ID to fetch crash loops for") @PathParam("requestId") String requestId | ||
| ) { | ||
| authorizationHelper.checkForAuthorizationByRequestId(requestId, user, SingularityAuthorizationScope.READ); | ||
| return shuffleCfgManager.isOnShuffleBlacklist(requestId); | ||
| } | ||
|
|
||
| @POST | ||
| @Path("/blacklist/{requestId}") | ||
| @Operation(summary = "Add a request ID to the shuffle blacklist. No effect if already present.") | ||
| public void addToShuffleBlacklist( | ||
| @Parameter(hidden = true) @Auth SingularityUser user, | ||
| @Parameter(required = true, description = "The Request ID to fetch crash loops for") @PathParam("requestId") String requestId | ||
| ) { | ||
| authorizationHelper.checkForAuthorizationByRequestId(requestId, user, SingularityAuthorizationScope.WRITE); | ||
| shuffleCfgManager.addToShuffleBlacklist(requestId); | ||
| } | ||
|
|
||
| @DELETE | ||
| @Path("/blacklist/{requestId}") | ||
| @Operation(summary = "Remove a request ID from the shuffle blacklist. No effect if not present.") | ||
| public void removeFromShuffleBlacklist( | ||
| @Parameter(hidden = true) @Auth SingularityUser user, | ||
| @Parameter(required = true, description = "The Request ID to fetch crash loops for") @PathParam("requestId") String requestId | ||
| ) { | ||
| authorizationHelper.checkForAuthorizationByRequestId(requestId, user, SingularityAuthorizationScope.WRITE); | ||
| shuffleCfgManager.removeFromShuffleBlacklist(requestId); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover from a merge conflict?