44def getExecutorStepEventCounts(executor, argdict=None):
45 """Get executor step event counts from executor config."""
46 if not argdict:
47 argdict = executor.conf.argdict
48 if 'splitConfig' not in argdict:
49 return []
50
51 maxEvents = argdict['maxEvents'].returnMyValue(exe=executor)
52 skipEvents = argdict['skipEvents'].returnMyValue(exe=executor)
53 splitConfig = argdict['splitConfig'].returnMyValue(exe=executor)
54 if not splitConfig:
55 return []
56
57 steps, fractions = loadSplitConfig(splitConfig)
58
59 if sum(fractions) != 1:
60 raise ValueError('Event fractions should total to 1!')
61
62 counts = []
63 for i in range(len(fractions) - 1):
64 counts.append(round(maxEvents * fractions[i]))
65 counts.append(maxEvents - sum(counts))
66
67 sums = []
68 for i in range(len(fractions)):
69 sums.append(skipEvents + sum(counts[:i]))
70
71 return counts, sums