Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:serverless/serverless-openwhisk
Browse files Browse the repository at this point in the history
  • Loading branch information
jthomas committed Jan 14, 2019
2 parents b6b83eb + 1de0312 commit d4ecee0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ functions:
namespace: "..." // defaults to user-provided credentials
memory: 256 // 128 to 512 (MB).
timeout: 60 // 0.1 to 600 (seconds)
concurrency: 1 // 1 to 500, default is 1
parameters:
foo: bar // default parameters
annotations:
Expand Down
13 changes: 11 additions & 2 deletions compile/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class OpenWhiskCompileFunctions {
return functionObject.memory || this.serverless.service.provider.memory || 256;
}

calculateConcurrency(functionObject) {
return functionObject.concurrency || this.serverless.service.provider.concurrency || 1;
}

calculateTimeout(functionObject) {
return functionObject.timeout || this.serverless.service.provider.timeout || 60;
}
Expand All @@ -77,7 +81,11 @@ class OpenWhiskCompileFunctions {
overwrite: params.Overwrite,
action: {
exec: params.Exec,
limits: { timeout: params.Timeout * 1000, memory: params.MemorySize },
limits: {
timeout: params.Timeout * 1000,
memory: params.MemorySize,
concurrency: params.Concurrency,
},
parameters: params.Parameters,
annotations: params.Annotations
},
Expand All @@ -99,6 +107,7 @@ class OpenWhiskCompileFunctions {
const MemorySize = this.calculateMemorySize(functionObject);
const Timeout = this.calculateTimeout(functionObject);
const Overwrite = this.calculateOverwrite(functionObject);
const Concurrency = this.calculateConcurrency(functionObject);

// optional action parameters
const Parameters = Object.keys(functionObject.parameters || {})
Expand All @@ -108,7 +117,7 @@ class OpenWhiskCompileFunctions {
const Annotations = this.constructAnnotations(functionObject.annotations);

return this.compileFunctionAction(
{ FunctionName, NameSpace, Overwrite, Exec, Timeout, MemorySize, Parameters, Annotations }
{ FunctionName, NameSpace, Overwrite, Exec, Timeout, MemorySize, Concurrency, Parameters, Annotations }
);
});
}
Expand Down

0 comments on commit d4ecee0

Please sign in to comment.