Skip to content

Conversation

@jmthibault79
Copy link
Contributor

@jmthibault79 jmthibault79 commented May 20, 2024

Jira ticket: https://precisionmedicineinitiative.atlassian.net/browse/RW-11461 (requires PMI-OPS Jira access)

Includes the work from the previous draft #4232

Summary of changes

Adds a new endpoint "Update App Config" PATCH /api/google/v1/apps/{googleProject}/{appName} which allows users to modify the two autodelete app config fields: autodeleteEnabled and autodeleteThreshold. Requests can contain changes to one field or both (or neither) as long as (a) any specified threshold is a positive integer and (b) any requests which enable autodelete without specifying the threshold correspond to apps with pre-existing valid thresholds in the DB.

More details here: https://docs.google.com/document/d/1eWfY8PQoDKVOdIeREuEC9ObLhXlsTtG2ugLwuqov81k/edit#bookmark=id.n9sphs8lpm4l

What

Why

  • AoU RWB users want the ability to modify and enable/disable the autodelete settings of running apps. Currently they must delete the apps instead, creating them again with the desired settings

Testing these changes

I deployed this change to a BEE and created a Galaxy app in the BEE's Terra UI. I then observed that the app state (as seen via GET app) responded to my PATCH changes as expected.

What to test

Who tested and where

  • This change is covered by automated tests
    • NB: Rerun automation tests on this PR by commenting jenkins retest or jenkins multi-test.
  • I validated this change
  • Primary reviewer validated this change
  • I validated this change in the dev environment

@codecov
Copy link

codecov bot commented May 20, 2024

Codecov Report

Attention: Patch coverage is 75.55556% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 73.68%. Comparing base (6baab71) to head (b995b35).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #4575   +/-   ##
========================================
  Coverage    73.68%   73.68%           
========================================
  Files          159      159           
  Lines        14724    14764   +40     
  Branches      1166     1133   -33     
========================================
+ Hits         10849    10879   +30     
- Misses        3875     3885   +10     
Files Coverage Δ
...dsde/workbench/leonardo/http/appRoutesModels.scala 0.00% <ø> (ø)
...tute/dsde/workbench/leonardo/db/AppComponent.scala 97.93% <100.00%> (+0.02%) ⬆️
...ch/leonardo/http/service/LeoAppServiceInterp.scala 87.15% <100.00%> (+0.60%) ⬆️
...e/dsde/workbench/leonardo/http/api/AppRoutes.scala 81.05% <15.38%> (-10.42%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6baab71...b995b35. Read the comment docs.

}

"checkIfAppCreationIsAllowedAndIsAoU" should "enable IntraNodeVisibility if customApp check is disabled" in {
"checkIfAppCreationIsAllowed" should "enable IntraNodeVisibility if customApp check is disabled" in {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not related to this PR, but I happened to notice that this did not match the method name

)

tags = Map("appType" -> appResult.app.appType.toString)
_ <- metrics.incrementCounter("updateAppConfig", 1, tags)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed that the counter is sometimes incremented at the Service level and sometimes at the Routes level. Unclear which to choose.

@jmthibault79 jmthibault79 marked this pull request as ready for review May 22, 2024 14:46
@jmthibault79 jmthibault79 changed the title [RW-11461] WIP user app update autodelete [RW-11461] UpdateAppConfig to change autodelete settings May 22, 2024
@jmthibault79 jmthibault79 marked this pull request as draft May 22, 2024 17:54
@jmthibault79
Copy link
Contributor Author

Moving back to Draft while I have a think about logic/semantics

@jmthibault79 jmthibault79 marked this pull request as ready for review May 23, 2024 21:24
@jmthibault79 jmthibault79 requested a review from Qi77Qi May 23, 2024 21:26
@jmthibault79 jmthibault79 requested a review from LizBaldo May 23, 2024 22:11
@jmthibault79
Copy link
Contributor Author

jmthibault79 commented May 24, 2024

if we use a custom type for autodeleteThreshold

@Qi77Qi I made an attempt but I was unable to get it all the way working #4583

)
}

private[service] def validateAutodelete(autodeleteEnabled: Boolean,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure where this should be placed. thoughts?

BadRequestException("autodeleteThreshold should be a positive value", Some(ctx.traceId))
)
autodeleteEnabled = req.autodeleteEnabled.getOrElse(false)
_ <- validateAutodelete(autodeleteEnabled, req.autodeleteThreshold, ctx.traceId)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note that this makes the Create App validation more strict, to match

appQuery
.updateAutodeleteThreshold(appId, Some(threshold))
)
} yield ()).transaction
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't want to commit one without the other!

Example: the app had a 1-hour threshold, but it was disabled. Now the user wants to enable with a 10-hour threshold. If only the first change goes through, the app has a surprise active 1-hour threshold.

@jmthibault79 jmthibault79 force-pushed the joel/RW-11461 branch 2 times, most recently from 510a802 to caaee02 Compare May 30, 2024 15:18
@jmthibault79 jmthibault79 merged commit 823027a into develop May 31, 2024
@jmthibault79 jmthibault79 deleted the joel/RW-11461 branch May 31, 2024 14:29
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.

6 participants