<commit_before>import random
from taskrun import *

manager = taskrun.Manager()

vcs = [1, 2, 3, 4]
rates = [20, 40, 60, 80, 100]

random.seed(None)

name = "Map_All"
map_all = taskrun.Task(name)
map_all.addCommand("echo " + name)
manager.addTask(map_all)

name = "Reduce_All"
reduce_all = taskrun.Task(name)
reduce_all.addCommand("echo " + name)
manager.addTask(reduce_all)

for vc in vcs:
    name = "Map_" + str(vc)
    sub_map = taskrun.Task(name)
    sub_map.addCommand("echo " + name)
    sub_map.addDependency(map_all)
    manager.addTask(sub_map)

    name = "Reduce_" + str(vc)
    sub_reduce = taskrun.Task(name)
    sub_reduce.addCommand("echo " + name)
    reduce_all.addDependency(sub_reduce)
    manager.addTask(sub_reduce)

    for rate in rates:
        name = "Worker_" + str(vc) + "-" + str(rate)
        pause = "; sleep " + str(random.randint(1,3))
        task = taskrun.Task(name)
        task.addCommand("echo " + name + pause)
        task.addDependency(sub_map)
        sub_reduce.addDependency(task)
        manager.addTask(task)

manager.runTasks()<commit_msg>Made test case bevery sleepy!<commit_after>import random
from taskrun import *

manager = taskrun.Manager()

vcs = [1, 2, 3, 4]
rates = [20, 40, 60, 80, 100]

random.seed(None)
def rsleep():
    return random.randint(1,3)

name = "Map_All"
map_all = taskrun.Task(name)
map_all.addCommand("sleep " + str(rsleep()))
manager.addTask(map_all)

name = "Reduce_All"
reduce_all = taskrun.Task(name)
reduce_all.addCommand("sleep " + str(rsleep()))
manager.addTask(reduce_all)

for vc in vcs:
    name = "Map_" + str(vc)
    sub_map = taskrun.Task(name)
    sub_map.addCommand("sleep " + str(rsleep()))
    sub_map.addDependency(map_all)
    manager.addTask(sub_map)

    name = "Reduce_" + str(vc)
    sub_reduce = taskrun.Task(name)
    sub_reduce.addCommand("sleep " + str(rsleep()))
    reduce_all.addDependency(sub_reduce)
    manager.addTask(sub_reduce)

    for rate in rates:
        name = "Worker_" + str(vc) + "-" + str(rate)
        task = taskrun.Task(name)
        task.addCommand("sleep 1", "/dev/null")
        task.addCommand("sleep 2", "/dev/null")
        task.addCommand("sleep 3", "/dev/null")
        task.addDependency(sub_map)
        sub_reduce.addDependency(task)
        manager.addTask(task)

manager.runTasks(show=True, run=True, progress=True)
{'fraction_non_alphanumeric': 0.14419396001701404, 'fraction_numerical': 0.015737983836665248, 'mean_word_length': 3.6027397260273974, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2378759', 'n_tokens_mistral': 893, 'n_tokens_neox': 849, 'n_words': 162}