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

[AENT-7570]/client side fixes #196

Merged
merged 4 commits into from
Sep 12, 2024
Merged

Conversation

sandhujasmine
Copy link
Contributor

@sandhujasmine sandhujasmine commented Sep 9, 2024

Add option to patch resource-profile; and the deployed-version.

Testing

  1. Ensure this is being tested against latest deployment of anaconda-platform master so it has this fix (https://github.com/anaconda/anaconda-platform/pull/6970) in.

  2. Follow the same testing instructions on the server side as listed in this PR#6970 to start a deployment with version 0.1.0; then create an update and tag it as 0.1.1

  3. Now use this updated client side ae5 version to apply the patches:

  • Get the deployment ID and update to latest version. For the example below the deployment-id is a2-eca80be7b7a143f78299bd615cf66ab5
% ae5 deployment list
% ae5 deployment patch a2-eca80be7b7a143f78299bd615cf66ab5:latest

Watch the anaconda-app pod get updated to the latest 0.1.1 deployment. You can verify in the UI; verify in the response printed by the client; you can also verify in the AE server UI.

  • Get the deployment ID and update to older version. Verify the same things listed above ☝️
% ae5 deployment patch a2-eca80be7b7a143f78299bd615cf66ab5:0.1.0
  • Give it an invalid version number and verify the response
% ae5 deployment patch a2-eca80be7b7a143f78299bd615cf66ab5:0.2.0
Connecting to user account anaconda-enterprise@anaconda.example.com.
Error: No revisions found matching name=0.2.0
  • Test the resource-profile option also causes the pod to get restarted
ae5 deployment patch a2-eca80be7b7a143f78299bd615cf66ab5 --resource-profile large

'_revision': ident['_revision'],
'_record_type': 'project',
}
rrec = self._revision(dep2proj)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wanted to use the existing _revision code to raise an error if the revision is not found. It would be nice if it would list the available revisions but didn't try to figure that out.

@@ -1551,7 +1551,19 @@ def deployment_open(self, ident, frame=False, format=None):

def deployment_patch(self, ident, format=None, **kwargs):
drec = self._ident_record("deployment", ident)
data = {k: v for k, v in kwargs.items() if v is not None}
data = {k: v for k, v in kwargs.items() if v is not None and v != drec[k]}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the check that if the value in kwargs isn't different from existing deployment attribute, then don't bother calling the API (see this: v != drec[k]). This isn't necessary since the operations are idempotent; but it seemed easy enough to add so I did. I don't know if the server side already takes care of this.

@mcg1969
Copy link
Collaborator

mcg1969 commented Sep 10, 2024

@sandhujasmine this is working great! I was able to verify that this successfully results in an update to our database as well as to the deployment itself.

@sandhujasmine sandhujasmine merged commit 255d5c2 into master Sep 12, 2024
1 check passed
@sandhujasmine sandhujasmine deleted the AENT-7570/client-side-fixes branch September 12, 2024 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants