Bug #17299

[controller] runtime_constraints should be spelled {API:true}, not {api:true}

Added by Tom Clegg 9 months ago. Updated 6 months ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
-
Target version:
Start date:
02/03/2021
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
Story points:
-
Release relationship:
Auto

Description

In #17014 3ec51dcf456b2afe02857089895a261653abddd4 did this

 type RuntimeConstraints struct {
-       API          *bool
+       API          bool  `json:"api"`

and this

+    self.runtime_constraints = {
+      'api' => false,
+      'keep_cache_ram' => 0,
+      'ram' => 0,
+      'vcpus' => 0,
+    }.merge(attributes['runtime_constraints'] || {})
As a result:
  • when a client submits a CR with {"runtime_constraints":{"API":true}}, controller changes it to {"api":true}
  • when railsapi loads a CR from the database that has {"API":true}, it merges with the default {"api":false} and returns {"api":false,"API":true} to the caller and/or the updated database row, which is obviously bad and (sometimes?) causes crunchrun to use the wrong value.
To fix:
  • change the key back to "API" in the Go SDK
  • change the key to "API" in the Rails merge-with-default code

A benefit of #17014 is that (with the above fix) railsapi won't see "api" no matter what the client sends -- controller will rewrite it as "API" -- so we shouldn't need any extra checks to prevent future problems.


Subtasks

Task #17302: ReviewResolvedNico César

Associated revisions

Revision 08c80b2b
Added by Nico Cesar 9 months ago

Merge branch '17299-uppercase-api'

closes #17299

Arvados-DCO-1.1-Signed-off-by: Nico Cesar <>

History

#1 Updated by Nico César 9 months ago

  • Assigned To set to Nico César
  • Status changed from New to In Progress

#4 Updated by Tom Clegg 9 months ago

LGTM, thanks!

#5 Updated by Peter Amstutz 9 months ago

  • Status changed from In Progress to Resolved

#6 Updated by Peter Amstutz 6 months ago

  • Release set to 38

Also available in: Atom PDF