def __init__(self): super().__init__() task = Task({ "id" : 1, "executiontime" : 1000, "criticaltime" : 1000, "priority" : 52, "period" : 0, "numberofjobs" : 0, "quota" : "1M", "pkg" : "hey", "config" : {} }) self.append(task) task = Task({ "id" : 2, "executiontime" : 1000, "criticaltime" : 1000, "priority" : 51, "period" : 0, "numberofjobs" : 0, "quota" : "1M", "pkg" : "hey", "config" : {} }) self.append(task)
def load_tasksets(include_possibilities=True): # read from files and load into TASKSETS and BADTASKSETS above # format: a tuple per line: (level, [Taskset, Taskset, ...]) # include_possibilities decides whether or not POSSIBLETASKSETS should be restored global TASKSETS global BADTASKSETS global POSSIBLETASKSETS for option in ('good', 'bad'): with open('./data/{}_tasksets'.format(option), 'r') as taskset_file: for line in taskset_file: # line format: (int, [ (bool,[{}]) ] ) level, tasksetList = eval( line) # level indicates size of tasksets add_if_not_exists(level) for successful, tasksetInfo in tasksetList: taskset = TaskSet([]) for taskDict in tasksetInfo: taskset.append(Task(taskDict)) if successful: TASKSETS[level].append((successful, taskset)) else: BADTASKSETS[level].append((successful, taskset)) if include_possibilities: try: with open('./data/possible_tasksets', 'r') as taskset_file: for line in taskset_file: # format: [taskset_hash], taskset_hash is type string POSSIBLETASKSETS += eval(line) except FileNotFoundError as e: print('There were no possible tasksets.')
def __next__(self): task = Task({ key: SampleRV._next_call_value(value) for key, value in self._attributes.items() }) self.post_generation(task) return task
def __init__(self): super().__init__() self.append( Task( { # general "id" : 0, "criticaltime" : 0, "executiontime" : 9999999999999999, # binary "quota" : "1M", "pkg" : "hey", "config" : {}, # frequency "numberofjobs" : 0, "period" : 0, # scheduler "priority" : 4, })) self.append( Task( { # general "id" : 1, "criticaltime" : 0, "executiontime" : 9999999999999999, # binary "quota" : "1M", "pkg" : "cond_42", "config" : { "arg1" : 30 }, # frequency "numberofjobs" : 0, "period" : 0, # scheduler "priority" : 20, }))
def __init__(self): super().__init__() task = Task( hey. HelloWorld, # fills `pkg`, `config`, `executiontime` and `quota` priority.Value(100), # fills `priority` period.Value(0) # fills period ) self.append(task)
def __init__(self): super().__init__() self.append( Task( { # general "id" : 0, "criticaltime" : 0, "executiontime" : 9999999999999999, # binary "quota" : "1M", "pkg" : "hey", "config" : {}, # frequency "numberofjobs" : 0, "period" : 0, # 3 seconds & endless # scheduler "deadline" : 20000000, # 10 seconds. })) self.append( Task( { # general "id" : 1, "criticaltime" : 0, "executiontime" : 9999999999999999, # binary "quota" : "1M", "pkg" : "hey", "config" : {}, # frequency "numberofjobs" : 0, "period" : 0, # 3 seconds & endless # scheduler "deadline" : 10000000, # 10 seconds. }))
def __init__(self): super().__init__() self.append( Task( { # general "id" : 0, "criticaltime" : 0, "executiontime" : 99999999, # binary "quota" : "1M", "pkg" : "hey", "config" : {}, # frequency "numberofjobs" : 2, "period" : 3, # scheduler "priority" : 50, })) self.append( Task( { # general "id" : 1, "criticaltime" : 0, "executiontime" : 99999999, # binary "quota" : "1M", "pkg" : "hey", "config" : {}, # frequency "numberofjobs" : 2, "period" : 3, # scheduler "priority" : 100, # <- tested attribute }))
def ben00(self): set = TaskSet([]) v00 = [0, 1000, 1000000] o00 = {"offset": [1000]} nj00 = {"numberofjobs": [1, 4, 16]} p00 = {"period": [5000, 10000]} pro00 = {"priority": [8, 32, 127]} d00 = {"deadline": [12500]} task00 = Task(hey.Value(v00), o00, nj00, p00, pro00, d00) set.append(task00) return set
def create_task(input_pkg='hey', input_priority=1, input_deadline=0, input_period=1000, input_criticaltime=0, input_numberofjobs=1, input_offset=0, input_quota=10, input_caps=50, input_cores=2, input_coreoffset=1, input_arg1=0): dict_pkg = {"pkg" : input_pkg} dict_priority = {'priority' : input_priority} dict_deadline = {'deadline' : input_deadline} dict_period = {'period' : input_period} dict_criticaltime = {'criticaltime' : input_criticaltime} dict_numberofjobs = {'numberofjobs' : input_numberofjobs} dict_offset = {'offset' : input_offset} dict_quota = {'quota' : str(input_quota)+'M'} dict_caps = {'caps': input_caps} dict_cores = {'cores' : input_cores} dict_coreoffset = {'coreoffset' : input_coreoffset} dict_arg1 = {"config" : {"arg1" : input_arg1}} return Task(dict_pkg, dict_priority, dict_deadline, dict_period, dict_criticaltime, dict_numberofjobs, dict_offset, dict_quota, dict_caps, dict_cores, dict_coreoffset, dict_arg1)
def ben04(self): set = TaskSet([]) # Wert mit dem der Task ausgeführt wird v00 = [10, 11, 10000, 10001, 1000000, 1000001] #Verzögerung des Taskes vor Ausführung o00 = {"offset": [1000]} #Anzahl der wdh. eines Tasks nj00 = {"numberofjobs": [100]} # nach dieser Zeit wird die nächste instanz des tasks gestartet wenn numberofjobs > 1. dabei wird die "alte" instanz beendet p00 = {"period": [10000]} #Wenn ein Task eine Priority hat, wird er nach dieser gescheduled, nicht nach der deadline. Deadline ist dann egal. Erst priority danach deadlines pro00 = {"priority": [8]} task00 = Task(tumatmul.Value(v00), o00, nj00, p00, pro00) set.append(task00) return set
def __init__(self): super().__init__() task = Task({ # general "id": 1, "executiontime": 99999999, "criticaltime": 0, # binary "quota": "1M", "pkg": "hey", "config": {}, # frequency "period": 0, # schedular "priority": 10, }) self.append(task)
def __init__(self): super().__init__() self.append( Task( { # general "id" : 0, # ignored and set by TaskSet "criticaltime" : 0, "executiontime" : 99999999, # binary "quota" : "1M", "pkg" : "hey", "config" : {}, # frequency "numberofjobs" : 0, "period" : 3, # scheduler "priority" : 10, }))
def __init__(self): super().__init__() for x in range(10): task = Task(hey.HelloWorld, priority.Custom(100), period.Custom(5)) self.append(task)
def specialSet(self, setcount): #setcount defines how many Tasks are allowed to be in one Taskset. #The funtion returns a list of Taskset-Generators. #each Task gets its own parameters: #parameter xxxx00 is for task 0 #parameter xxxx01 is for task 1 #parameter xxxx02 is for task 2 #parameter xxxx03 is for task 3 #parameter xxxx04 is for task 4 #nach dieser Zeit wird der Task beendet ct00 = {"criticaltime": [12000]} ct01 = {"criticaltime": [18000]} ct02 = {"criticaltime": [13000]} ct03 = {"criticaltime": [15000]} ct04 = {"criticaltime": [30000]} # Wert mit dem der Task ausgeführt wird v00 = [0] v01 = [100, 1000] v02 = [42, 10041] v03 = [10000, 10003] v04 = [10000, 10001] #Verzögerung des Taskes vor Ausführung o00 = {"offset": [1000]} o01 = {"offset": [500]} o02 = {"offset": [500]} o03 = {"offset": [500]} o04 = {"offset": [500]} #Anzahl der wdh. eines Tasks nj00 = {"numberofjobs": [1, 4]} nj01 = {"numberofjobs": [1, 4]} nj02 = {"numberofjobs": [1, 4]} nj03 = {"numberofjobs": [1, 4]} nj04 = {"numberofjobs": [1, 4]} # nach dieser Zeit wird die nächste instanz des tasks gestartet wenn numberofjobs > 1. dabei wird die "alte" instanz beendet p00 = {"period": [10000]} p01 = {"period": [10000]} p02 = {"period": [10000]} p03 = {"period": [10000]} p04 = {"period": [10000]} #Time zu der der Task "fertig sein soll" wird nur zum skedulen verwendet. Nach Überschreiten der deadline wird der task beednet und darf nur dannw eiter rechnen, wenn kein anderer Task rechnen möchte d00 = {"deadline": [12500]} d01 = {"deadline": [22500]} d02 = {"deadline": [20000]} d03 = {"deadline": [25000]} d04 = {"deadline": [30000]} #Wenn ein Task eine Priority hat, wird er nach dieser gescheduled, nicht nach der deadline. Deadline ist dann egal. Erst priority danach deadlines pro00 = {"priority": [8, 127]} pro01 = {"priority": [16, 127]} pro02 = {"priority": [64, 127]} pro03 = {"priority": [16, 127]} pro04 = {"priority": [32, 127]} #creates the Task-Generators task00 = Task(hey.Value(v00), ct00, o00, nj00, p00, d00, pro00) task01 = Task(pi.Value(v01), ct01, o01, nj01, p01, d01, pro01) task02 = Task(cond_42.Value(v02), ct02, o02, nj02, p02, d02, pro02) task03 = Task(cond_mod.Value(v03), ct03, o03, nj03, p03, d03, pro03) task04 = Task(tumatmul.Value(v04), ct04, o04, nj04, p04, d04, pro04) jobs = [] #creates the "Kreuzprodukt" of the Tasks as Taskset-Generator. But with a maximum of setcount Tasks in each Taskset. tasks = (task00, task01, task02, task03, task04) i = 0 if setcount > 0 and setcount < 5: set = TaskSet([]) while i < 5: set0 = copy.deepcopy(set) set0.append(copy.deepcopy(tasks[i])) if setcount > 1: j = i + 1 while j < 5: set1 = copy.deepcopy(set0) set1.append(copy.deepcopy(tasks[j])) if setcount > 2: k = j + 1 while k < 5: set2 = copy.deepcopy(set1) set2.append(copy.deepcopy(tasks[k])) if setcount > 3: l = k + 1 while l < 5: set3 = copy.deepcopy(set2) set3.append(copy.deepcopy(tasks[l])) jobs.append(set3) l = l + 1 else: jobs.append(set2) k = k + 1 else: jobs.append(set1) j = j + 1 else: jobs.append(set0) i = i + 1 set = TaskSet([]) if setcount == 5: set.append(task00) set.append(task01) set.append(task02) set.append(task03) set.append(task04) jobs.append(set) return jobs return jobs
def finalSetSmall(self): # returns a Taskset-Generator with round about 16k TaskSets set = TaskSet([]) #nach dieser Zeit wird der Task beendet ct00 = { "criticaltime": [12000] } #medean execution time of task 0: 1200; 100% at 1650 ct01 = { "criticaltime": [16000] } #medean execution time of task 1: 1600; 90% at 2800 ct02 = { "criticaltime": [13000] } #medean execution time of task 2: 1300; 90% at 2300 ct03 = { "criticaltime": [15000] } #medean execution time of task 3: 1400; 90% at 2700 ct04 = { "criticaltime": [30000] } #medean execution time of task 4: 3150; 95% at 3200 # Wert mit dem der Task ausgeführt wird v00 = [0] v01 = [100, 1000] v02 = [42, 10041] v03 = [10000, 10003] v04 = [10000, 10001] #Verzögerung des Taskes vor Ausführung o00 = {"offset": [1000]} o01 = {"offset": [500]} o02 = {"offset": [500]} o03 = {"offset": [500]} o04 = {"offset": [500]} #Anzahl der wdh. eines Tasks nj00 = {"numberofjobs": [1, 4]} nj01 = {"numberofjobs": [1, 4]} nj02 = {"numberofjobs": [1, 4]} nj03 = {"numberofjobs": [1, 4]} nj04 = {"numberofjobs": [1, 4]} # nach dieser Zeit wird die nächste instanz des tasks gestartet wenn numberofjobs > 1. dabei wird die "alte" instanz beendet p00 = {"period": [10000]} p01 = {"period": [10000]} p02 = {"period": [10000]} p03 = {"period": [10000]} p04 = {"period": [10000]} #Time zu der der Task "fertig sein soll" wird nur zum skedulen verwendet. Nach Überschreiten der deadline wird der task beednet und darf nur dannw eiter rechnen, wenn kein anderer Task rechnen möchte d00 = {"deadline": [12500]} d01 = {"deadline": [22500]} d02 = {"deadline": [20000]} d03 = {"deadline": [25000]} d04 = {"deadline": [30000]} #Wenn ein Task eine Priority hat, wird er nach dieser gescheduled, nicht nach der deadline. Deadline ist dann egal. Erst priority danach deadlines pro00 = {"priority": [8, 127]} pro01 = {"priority": [16, 127]} pro02 = {"priority": [64, 127]} pro03 = {"priority": [16, 127]} pro04 = {"priority": [32, 127]} task00 = Task(hey.Value(v00), ct00, o00, nj00, p00, d00, pro00) set.append(task00) task01 = Task(pi.Value(v01), ct01, o01, nj01, p01, d01, pro01) #set.append(task01) set.append(task01) task02 = Task(cond_42.Value(v02), ct02, o02, nj02, p02, d02, pro02) set.append(task02) task03 = Task(cond_mod.Value(v03), ct03, o03, nj03, p03, d03, pro03) set.append(task03) task04 = Task(tumatmul.Value(v04), ct04, o04, nj04, p04, d04, pro04) set.append(task00) set.append(task01) set.append(task02) set.append(task03) set.append(task04) return set
def task_generator(attributes): while True: yield Task({ key: SampleRV._next_call_value(value) for key, value in attributes.items() })
def __init__(self): super().__init__() for x in range(10): task = Task(hey.HelloWorld, priority.Random, period.Value(0)) self.append(task)