-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tried moving the functions to a separate file
- Loading branch information
Showing
2 changed files
with
30 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// This file holds several Groovy functions that are used in the pipeline | ||
// | ||
|
||
/* | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Increasing the number of CPUs often gives diminishing returns, so we increase it | ||
following a logarithm curve. Example: | ||
- 0 < value <= 1: start + step | ||
- 1 < value <= 2: start + 2*step | ||
- 2 < value <= 4: start + 3*step | ||
- 4 < value <= 8: start + 4*step | ||
In order to support re-runs, the step increase may be multiplied by the attempt | ||
number prior to calling this function. | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
*/ | ||
|
||
// Modified logarithm function that doesn't return negative numbers | ||
def positive_log(value, base) { | ||
if (value <= 1) { | ||
return 0 | ||
} else { | ||
return Math.log(value)/Math.log(base) | ||
} | ||
} | ||
|
||
def log_increase_cpus(start, step, value, base) { | ||
return check_max(start + step * (1 + Math.ceil(positive_log(value, base))), 'cpus') | ||
} | ||
|