15 """Calculate the specific configuration of the current job in the digi
16 task. Try to make each fragment utilize the same amount of CPU and
17 Cache resources. Exploits the fact that the task when sorted by
18 mu value will have long finishing pieces near the beginning and
19 short pieces near the end. A more even solution is obtained by
20 pairing chunks of maxEvents/2 from the beginning and end of the
23 hiMaxEvents,loMaxEvents=0,0
25 hiMaxEvents=loMaxEvents=int(maxEvents/2)
27 hiMaxEvents=int((maxEvents-1)/2)
28 loMaxEvents=int((maxEvents+1)/2)
32 hi_mu_frag=
getFragment(jobnumber,sorted(task,key=
lambda job: job[
'mu'],reverse=
True),hiMaxEvents)
34 lo_mu_frag=
getFragment(jobnumber,sorted(task,key=
lambda job: job[
'mu']),loMaxEvents)
36 fragment=sorted(sum([hi_mu_frag,lo_mu_frag],[]),key=
lambda job: job[
'run'])
37 if sequentialEventNumbers:
43 """Calculate the specific configuration of the current job in the digi
44 task. Sample the mu values randomly.
47 random.seed(jobnumber)
51 max_index = len(lookup_table) - 1
55 evt_nbr = jobnumber * totalEvents + skipEvents
56 for i
in range(maxEvents):
59 index = lookup_table[random.randint(0, max_index)]
65 'starttstamp': t[
'starttstamp'],
71 item[
'force_new'] = t[
'force_new']
73 if sequentialEventNumbers:
74 item[
'evt_nbr'] = evt_nbr
78 return sorted(new_frag, key=itemgetter(
'run',
'starttstamp'))
81 """ Calculate the specific configuration of the current job in the digi task.
85 raise IndexError(
'There are only %i jobs in this task (not %i).' % (len([1
for i
in taskIterator(task,maxEvents)]) + 1,jobnumber + 1))