Skip to content

Commit

Permalink
Disable by default "remembering" and querying Dynamatrix.knownClones …
Browse files Browse the repository at this point in the history
…(seems they have a way to store stats into parent after all)
  • Loading branch information
jimklimov committed Jul 10, 2023
1 parent ab669fc commit b7ba6c1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
46 changes: 23 additions & 23 deletions src/org/nut/dynamatrix/Dynamatrix.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Dynamatrix implements Cloneable {
* @see #setWorstResult(String, String)
* @see #resultFromString
*/
public Result getWorstResult(Boolean recurse = true) {
public Result getWorstResult(Boolean recurse = false) {
Result r = this.@dmWorstResult
if (recurse && this.knownClones.size() > 0) {
this.knownClones.each {
Expand Down Expand Up @@ -325,7 +325,7 @@ class Dynamatrix implements Cloneable {
* @see #setLogKey
*/
@NonCPS
synchronized public String getLogKey(String s, Boolean recurse = true) {
synchronized public String getLogKey(String s, Boolean recurse = false) {
Map<String, String> mapTrackStageLogkeys = this.getTrackStageLogkeys(recurse)
if (mapTrackStageLogkeys.containsKey(s)) {
return mapTrackStageLogkeys[s]
Expand All @@ -352,7 +352,7 @@ class Dynamatrix implements Cloneable {
* @return
*/
@NonCPS
synchronized public Map<Result, Set<String>> reportStageResults(Boolean recurse = true) {
synchronized public Map<Result, Set<String>> reportStageResults(Boolean recurse = false) {
Map<Result, Set<String>> mapres = [:]
this.getTrackStageResults(recurse).each { String sn, Result r ->
// this.trackStageResults.each { String sn, Result r ->
Expand Down Expand Up @@ -433,20 +433,20 @@ class Dynamatrix implements Cloneable {

/** Reporting the accounted values:
* We started the stage (maybe more than once) */
public Integer countStagesStarted(Boolean recurse = true) {
public Integer countStagesStarted(Boolean recurse = false) {
Map<String, Integer> mapCountStages = this.getCountStages(recurse)
return intNullZero(mapCountStages?.STARTED) + intNullZero(mapCountStages?.RESTARTED)
}

/** Reporting the accounted values:
* We restarted the stage */
public Integer countStagesRestarted(Boolean recurse = true) {
public Integer countStagesRestarted(Boolean recurse = false) {
return intNullZero(this.getCountStages(recurse)?.RESTARTED)
}

/** Reporting the accounted values:
* We know we finished the stage, successfully or with "fex" exception caught */
public Integer countStagesCompleted(Boolean recurse = true) {
public Integer countStagesCompleted(Boolean recurse = false) {
return intNullZero(this.getCountStages(recurse)?.COMPLETED)
}

Expand All @@ -455,32 +455,32 @@ class Dynamatrix implements Cloneable {
* (due to {@link #mustAbort}, after getting a node
* to execute our logic on)
*/
public Integer countStagesAbortedSafe(Boolean recurse = true) {
public Integer countStagesAbortedSafe(Boolean recurse = false) {
return intNullZero(this.getCountStages(recurse)?.ABORTED_SAFE)
}

/** Reporting the accounted values: Standard Jenkins build results */
public Integer countStagesFinishedOK(Boolean recurse = true) {
public Integer countStagesFinishedOK(Boolean recurse = false) {
return intNullZero(this.getCountStages(recurse)?.SUCCESS)
}

/** Reporting the accounted values: Standard Jenkins build results */
public Integer countStagesFinishedFailure(Boolean recurse = true) {
public Integer countStagesFinishedFailure(Boolean recurse = false) {
return intNullZero(this.getCountStages(recurse)?.FAILURE)
}

/** Reporting the accounted values: Standard Jenkins build results */
public Integer countStagesFinishedFailureAllowed(Boolean recurse = true) {
public Integer countStagesFinishedFailureAllowed(Boolean recurse = false) {
return intNullZero(this.getCountStages(recurse)?.UNSTABLE)
}

/** Reporting the accounted values: Standard Jenkins build results */
public Integer countStagesAborted(Boolean recurse = true) {
public Integer countStagesAborted(Boolean recurse = false) {
return intNullZero(this.getCountStages(recurse)?.ABORTED)
}

/** Reporting the accounted values: Standard Jenkins build results */
public Integer countStagesAbortedNotBuilt(Boolean recurse = true) {
public Integer countStagesAbortedNotBuilt(Boolean recurse = false) {
return intNullZero(this.getCountStages(recurse)?.NOT_BUILT)
}

Expand Down Expand Up @@ -536,7 +536,7 @@ class Dynamatrix implements Cloneable {
// Must be CPS - calls pipeline script steps; this
// precludes use of at least synchronized{} blocks
synchronized
Boolean updateProgressBadge(Boolean removeOnly = false, Boolean recurse = true) {
Boolean updateProgressBadge(Boolean removeOnly = false, Boolean recurse = false) {
if (!this.script)
return null

Expand Down Expand Up @@ -653,7 +653,7 @@ class Dynamatrix implements Cloneable {
return ret
}

public Dynamatrix clone(String dynamatrixComment, Boolean rememberMe = true) throws CloneNotSupportedException {
public Dynamatrix clone(String dynamatrixComment, Boolean rememberMe = false) throws CloneNotSupportedException {
Dynamatrix ret = (Dynamatrix) super.clone()
ret.dynamatrixComment = dynamatrixComment
ret.knownClones = []
Expand Down Expand Up @@ -697,7 +697,7 @@ class Dynamatrix implements Cloneable {
* Report amounts of stages which have certain verdicts,
* zero or not, in layman wording.
*/
public String toStringStageCount(Boolean recurse = true) {
public String toStringStageCount(Boolean recurse = false) {
return "countStagesStarted:${countStagesStarted(recurse)} " +
"(of which countStagesRestarted:${countStagesRestarted(recurse)}) " +
"countStagesCompleted:${countStagesCompleted(recurse)} " +
Expand All @@ -713,7 +713,7 @@ class Dynamatrix implements Cloneable {
* Report amounts of stages which have certain verdicts,
* greater than zero, in layman wording.
*/
public String toStringStageCountNonZero(Boolean recurse = true) {
public String toStringStageCountNonZero(Boolean recurse = false) {
String s = ""
Integer i

Expand Down Expand Up @@ -752,7 +752,7 @@ class Dynamatrix implements Cloneable {
* greater than zero, in debug-friendly wording (using
* key names from {@link #countStages} map).
*/
public String toStringStageCountDumpNonZero(Boolean recurse = true) {
public String toStringStageCountDumpNonZero(Boolean recurse = false) {
Map<String, Integer> m = [:]
this.getCountStages(recurse).each {String k, Integer v ->
if (v > 0) m[k] = v
Expand All @@ -766,7 +766,7 @@ class Dynamatrix implements Cloneable {
* made from this {@link Dynamatrix} object.
*/
@NonCPS
synchronized public Map<String, Integer> getCountStages(Boolean recurse = true) {
synchronized public Map<String, Integer> getCountStages(Boolean recurse = false) {
// Avoid java.lang.CloneNotSupportedException: java.util.concurrent.ConcurrentHashMap
// Groovy and Java should support it, but...
Map<String, Integer> mapres = new ConcurrentHashMap<String, Integer>()
Expand Down Expand Up @@ -794,7 +794,7 @@ class Dynamatrix implements Cloneable {
* made from this {@link Dynamatrix} object.
*/
@NonCPS
synchronized public Map<String, String> getTrackStageLogkeys(Boolean recurse = true) {
synchronized public Map<String, String> getTrackStageLogkeys(Boolean recurse = false) {
// Avoid java.lang.CloneNotSupportedException: java.util.concurrent.ConcurrentHashMap
// Groovy and Java should support it, but...
Map<String, String> mapres = new ConcurrentHashMap<String, String>()
Expand Down Expand Up @@ -822,7 +822,7 @@ class Dynamatrix implements Cloneable {
* made from this {@link Dynamatrix} object.
*/
@NonCPS
synchronized public Map<String, Result> getTrackStageResults(Boolean recurse = true) {
synchronized public Map<String, Result> getTrackStageResults(Boolean recurse = false) {
// Avoid java.lang.CloneNotSupportedException: java.util.concurrent.ConcurrentHashMap
// Groovy and Java should support it, but...
Map<String, Result> mapres = new ConcurrentHashMap<String, Result>()
Expand All @@ -845,7 +845,7 @@ class Dynamatrix implements Cloneable {
}

/** Returns stringification of current {@link #countStages} map contents. */
public String toStringStageCountDump(Boolean recurse = true) {
public String toStringStageCountDump(Boolean recurse = false) {
if (recurse) {
return this.getCountStages(recurse).toString()
} else {
Expand Down Expand Up @@ -1973,12 +1973,12 @@ def parallelStages = prepareDynamatrix(

/** @see #generateBuild(Map, boolean, boolean, Closure) */
def generateBuild(Map dynacfgOrig = [:], Closure bodyOrig = null) {
return generateBuild(dynacfgOrig, false, true, bodyOrig)
return generateBuild(dynacfgOrig, false, false, bodyOrig)
}

/** @see #generateBuild(Map, boolean, boolean, Closure) */
def generateBuild(Map dynacfgOrig = [:], boolean returnSet, Closure bodyOrig = null) {
return generateBuild(dynacfgOrig, returnSet, true, bodyOrig)
return generateBuild(dynacfgOrig, returnSet, false, bodyOrig)
}

/**
Expand Down
4 changes: 2 additions & 2 deletions vars/prepareDynamatrix.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ prepareDynamatrix([
* Or a Set, if called from inside a pipeline stage (CPS code).
*/
def call(Map dynacfgOrig = [:], Closure body = null) {
return call(dynacfgOrig, false, true, body)
return call(dynacfgOrig, false, false, body)
}

def call(Map dynacfgOrig = [:], boolean returnSet, Closure body = null) {
return call(dynacfgOrig, returnSet, true, body)
return call(dynacfgOrig, returnSet, false, body)
}

def call(Map dynacfgOrig = [:], boolean returnSet, Boolean rememberClones, Closure body = null) {
Expand Down

0 comments on commit b7ba6c1

Please sign in to comment.