-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Treat action code as attachments for created/updated actions #2847
Conversation
@csantanapr, FYI. |
9d2e029
to
67f8765
Compare
case _ => | ||
obj.fields.get("binary") match { | ||
case Some(JsBoolean(b)) => b | ||
case _ => false |
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.
Should probably error here since code and binary property is not defined.
@@ -138,7 +138,7 @@ class ActionsApiTests extends ControllerTestCommon with WhiskActionsApi { | |||
Get(s"$collectionPath/${action.name}") ~> Route.seal(routes(creds)) ~> check { | |||
status should be(OK) | |||
val response = responseAs[WhiskAction] | |||
response should be(action) | |||
response.toJson should be(action.toJson) |
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.
Direct comparison of the WhiskAction here fails. However, comparing the actions as JSON seems to work.
96b143b
to
f7f3b6a
Compare
} map { | ||
attFmt[String].read(_) | ||
} getOrElse { | ||
throw new DeserializationException( | ||
s"'code' must be a valid base64 string in 'exec' for '$kind' actions") | ||
throw new DeserializationException(s"'code' must be a string defined in 'exec' for '$kind' actions") |
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.
Not sure we will ever get here. Since I think the function in map will work even for an empty string.
Can expand tests from #2855 after that one is merged. |
whisk.core.database.test.CacheConcurrencyTests > the cache should support concurrent CRUD without bogus residual cache entries, iter 1 FAILED Failure is a result of parallel action gets with updates. I think this test fails because there is now an extra database write for the attachment that causes the action get to fail as it does not have the correct document revision. |
31ce900
to
ea5e9fa
Compare
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.
This looks generally good - I'm surprised no test changes were required. I suspect because tests check for action equality which will be opaque to the attachment change.
We will need a test which shows the controller can tolerate an action in the previous schema and migrates it to the new schema.
// java actions once stored the attachment in "jar" instead of "code" | ||
obj.fields.get("code").orElse(obj.fields.get("jar")) | ||
// java actions once stored the attachment in "jar" instead of "code" | ||
val code = obj.fields.get("code").orElse(obj.fields.get("jar")) |
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.
perhaps as part of the schema migration pr, you can normalize all jar
occurrences to code
and we can remove this legacy bit.
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.
As part of #2938 I have normalized jar to code. Will have to remove the jar reference here.
0639141
to
c6563a0
Compare
210d98d
to
740d0fb
Compare
Pushed changes to use ansible/files/runtimes.json since the runtimes were removed from ansible/group_varz/all. |
copy(code = Inline(encoded)) | ||
val code = new String(bytes, StandardCharsets.UTF_8) | ||
|
||
if (kind == "java" && !Exec.isBinaryCode(code)) { |
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.
Allows backward compatibility with old Java actions that have attachments that are not base64.
@dubeejw What's the status here? The latest Travis failed. |
29c12fd
to
e068182
Compare
Codecov Report
@@ Coverage Diff @@
## master #2847 +/- ##
==========================================
- Coverage 74.5% 74.42% -0.08%
==========================================
Files 126 126
Lines 5950 5955 +5
Branches 378 377 -1
==========================================
- Hits 4433 4432 -1
- Misses 1517 1523 +6
Continue to review full report at Codecov.
|
@markusthoemmes, Travis is now passing. Awaiting more feed back. |
Closed in favor of #3286 |
Save action code as attachments in the database for new or updated actions.
Depends on #2832 to get
whisk.core.controller.test.ActionsApiTests > Actions API should put and then get action from cache
test to pass.I combined these changes with #2730 and performed profiling on the controller.
Here is a graph of the heap monitoring when invoking a 34MB zipped action:
Previously invoking a 34MB non-cached action would result in a spike in heap usage when only using changes in #2730: