Skip to content
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

Starred requests persistence #1219

Merged
merged 55 commits into from Nov 22, 2016
Merged

Starred requests persistence #1219

merged 55 commits into from Nov 22, 2016

Conversation

@MattCCS
Copy link
Contributor

MattCCS commented Aug 15, 2016

This PR enables "starred" Singularity requests to persist in Zookeeper, rather than be stored client-side, so clearing the cache or changing devices won't require re-starring.

/cc @ssalinas @tpetr

MattCCS added 26 commits Aug 11, 2016
@Calvinp
Copy link
Contributor

Calvinp commented Aug 15, 2016

Are we still planning on having endpoints to add or remove one star at a time?

@ssalinas
Copy link
Member

ssalinas commented Aug 15, 2016

@MattCCS as part of the implementation, I believe we also discussed adding the SingularityUserSettings into the SingularityUserHolder object so we can grab things on the /auth/user call when possible. Can we add that in?

public void setUserSettings(
@ApiParam("The user id to use") @QueryParam("userId") String userId,
@ApiParam("The new settings") SingularityUserSettings settings) {
userManager.updateUserSettings(SingularityValidator.encodeZkName(userId), settings);

This comment has been minimized.

Copy link
@tpetr

tpetr Aug 15, 2016

Member

this ZK encoding stuff should be inside UserManager -- the point of it is to encapsulate away all ZK-related stuff

This comment has been minimized.

Copy link
@MattCCS

MattCCS Aug 15, 2016

Author Contributor

Will fix.

@@ -436,4 +437,12 @@ private boolean isValidInteger(String strValue) {
return false;
}
}

public static String encodeZkName(String name) {
checkBadRequest(name != null, "Name may not be a null value");

This comment has been minimized.

Copy link
@ssalinas

ssalinas Aug 15, 2016

Member

Can use Strings.isNullOrEmpty(name) to hit both these lines in one go

This comment has been minimized.

Copy link
@MattCCS

MattCCS Aug 15, 2016

Author Contributor

Oh, handy, thanks.

private String getAuthUserId() {
checkBadRequest(user.isPresent() && user.get().getName().isPresent(), "Singularity userId must be provided by auth");
return user.get().getName().get();
}

This comment has been minimized.

Copy link
@tpetr

tpetr Sep 2, 2016

Member

This method needs some work:

  • The error message isn't accurate because we're not using the userId query param anymore.
  • Being unauthenticated should return an Unauthorized response, not a Bad Request response. Use SingularityAuthorizationHelper as a guide here; it uses checkUnauthorized(user.isPresent(), "Please log in to perform this action."); for stuff like this.
  • It's using the name field of SingularityUser (Thomas Petr) when it should be using the id field (tpetr).

This comment has been minimized.

Copy link
@MattCCS

MattCCS Sep 2, 2016

Author Contributor

Ah, my bad. So, should I be checking authEnabled before I do the checkAuthorized() call (as happens in SingularityAuthorizationHelper)? Or should I just be calling checkAuthorized() every time?

@ssalinas ssalinas modified the milestones: 0.11.0, 0.12.0 Sep 14, 2016
@ssalinas ssalinas added the hs_qa label Oct 31, 2016
@@ -2,6 +2,8 @@

import static com.google.common.base.Preconditions.checkNotNull;

import javax.ws.rs.HEAD;

This comment has been minimized.

Copy link
@tpetr

tpetr Oct 31, 2016

Member

i think this came in from a merge conflict

@ssalinas ssalinas modified the milestones: 0.12.0, 0.13.0 Nov 4, 2016
@ssalinas ssalinas added the hs_stable label Nov 15, 2016
@ssalinas
Copy link
Member

ssalinas commented Nov 22, 2016

@tpetr any problem with merging this one now?

@tpetr tpetr merged commit 20f0b94 into master Nov 22, 2016
1 of 2 checks passed
1 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@ssalinas ssalinas deleted the starred_requests_persistence branch Feb 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.