adobe / aio-cli-plugin-runtime

Adobe I/O Runtime plugin for the Adobe I/O CLI
https://www.adobe.io
Apache License 2.0
15 stars 31 forks source link

feat: add concurrency flag to create and update #316

Closed MichaelGoberling closed 1 year ago

MichaelGoberling commented 1 year ago

Description

Add a new flag for setting concurrency of actions

Default, min, and max taken from Runtime System Settings

Motivation and Context

Trying to set concurrency of a blackbox action, which can't be managed with app.config.yaml

How Has This Been Tested?

Locally linked plugin, npm run test

Screenshots (if appropriate):

Types of changes

Checklist:

codecov[bot] commented 1 year ago

Codecov Report

Merging #316 (78eb43d) into master (3968c92) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #316   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           66        66           
  Lines         1749      1752    +3     
  Branches       367       369    +2     
=========================================
+ Hits          1749      1752    +3     
Files Changed Coverage Δ
src/commands/runtime/action/create.js 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

purplecabbage commented 1 year ago

lgtm! Do we have a similar test in the app plugin for deploying from app.config.yaml? My preference would be that these limits are enforced by the server when we attempt to deploy/update the action, so we do not need to store these values in multiple places; BUT I do not foresee these changing anytime soon, so I think its fine.

MichaelGoberling commented 1 year ago

@purplecabbage

I don't think we do this sort of validation in the app plugin, so there's no similar tests

Agreed on the server side enforcement... Let me spend some time seeing if each of the min/max errors coming back from openwhisk are sufficient and we can remove the client side checking

MichaelGoberling commented 1 year ago

Yea I think the server responses seem fine, let me remove the client side checking here and then make another pr for the other flags in this command

Max exceeded

➜  runtime-memory-test git:(main) ✗ aio runtime action create test-1 --concurrency=5000 ./actions/generic/index.js 
 ›   Error: failed to create the action: the request content was malformed:
 ›   requirement failed: concurrency 5000 exceeds allowed threshold of 500 (400 Bad Request)
 ›    specify --verbose flag for more information

Min exceeded

➜  runtime-memory-test git:(main) ✗ aio runtime action create test-1 --concurrency=-1 ./actions/generic/index.js
 ›   Error: failed to create the action: the request content was malformed:
 ›   requirement failed: concurrency -1 below allowed threshold of 1 (400 Bad Request)
 ›    specify --verbose flag for more information
MichaelGoberling commented 1 year ago

Client side validation removed. Also opened a new PR doing this for other commands: https://github.com/adobe/aio-cli-plugin-runtime/pull/317