Exemplo n.º 1
0
 def task(cls):
   main = Process(name="main", cmdline="date && echo hello world")
   finalizer = Process(name="finalizer", cmdline="date", final=True)
   task = Task(name="task_with_finalizer",
               processes=[main, finalizer(name='finalizer1'), finalizer(name='finalizer2')],
               constraints=[Constraint(order=['finalizer1', 'finalizer2'])])
   return task.interpolate()[0]
Exemplo n.º 2
0
 def task(cls):
   task = Task(
     name = "task_with_ephemeral",
     processes = [
       Process(name = "ephemeral_sleepy", ephemeral=True, cmdline="sleep 10"),
       Process(name = "sleepy", cmdline="sleep 1")
     ])
   return task.interpolate()[0]
Exemplo n.º 3
0
 def task(cls):
   main = Process(name="main", cmdline="echo hello world")
   finalizer = Process(cmdline="date", final=True)
   task = Task(name="task_with_finalizer",
               processes=[main,
                          finalizer(name='finalizer1', cmdline='exit 1', max_failures=2),
                          finalizer(name='finalizer2')])
   return task.interpolate()[0]
Exemplo n.º 4
0
 def task(cls):
     task = Task(name="task_with_ephemeral",
                 processes=[
                     Process(name="ephemeral_sleepy",
                             ephemeral=True,
                             cmdline="sleep 10"),
                     Process(name="sleepy", cmdline="sleep 1")
                 ])
     return task.interpolate()[0]
Exemplo n.º 5
0
 def task(cls):
   base = Process(max_failures=2, min_duration=1)
   ex = base(cmdline="exit 1")
   hw = base(cmdline="echo hello world")
   task = Task(
     name = "failing_task",
     resources = Resources(cpu = 1.0, ram = 16*1024*1024, disk = 16*1024),
     max_failures = 0,
     processes = [ex(name='f1'), ex(name='f2'), ex(name='f3'),
                  hw(name='s1'), hw(name='s2'), hw(name='s3')])
   return task.interpolate()[0]
Exemplo n.º 6
0
def flaky_task():
  task = Task(
    name = "failing_task",
    max_failures = 2,
    processes = [
      Process(name = "a", max_failures=1, min_duration=1, cmdline="echo hello world"),
      Process(name = "b", max_failures=2, min_duration=1, cmdline="exit 1"),
      Process(name = "c", max_failures=1, min_duration=1, final=True, cmdline="echo hello world")
    ],
    constraints = [{'order': ['a', 'b']}]
  )
  return task.interpolate()[0]
Exemplo n.º 7
0
 def task(cls):
     main = Process(name="main", cmdline="date && echo hello world")
     finalizer = Process(name="finalizer", cmdline="date", final=True)
     task = Task(
         name="task_with_finalizer",
         processes=[
             main,
             finalizer(name='finalizer1', cmdline='exit 1'),
             finalizer(name='finalizer2')
         ],
         constraints=[Constraint(order=['finalizer1', 'finalizer2'])])
     return task.interpolate()[0]
Exemplo n.º 8
0
 def task(cls):
     main = Process(name="main", cmdline="echo hello world")
     finalizer = Process(cmdline="date", final=True)
     task = Task(name="task_with_finalizer",
                 processes=[
                     main,
                     finalizer(name='finalizer1',
                               cmdline='exit 1',
                               max_failures=2),
                     finalizer(name='finalizer2')
                 ])
     return task.interpolate()[0]
Exemplo n.º 9
0
 def task(cls):
   task = Task(
     name = "failing_task",
     resources = Resources(cpu = 1.0, ram = 16*1024*1024, disk = 16*1024),
     max_failures = 2,
     processes = [
       Process(name = "a", max_failures=1, min_duration=1, cmdline="echo hello world"),
       Process(name = "b", max_failures=1, min_duration=1, cmdline="exit 1"),
       Process(name = "c", max_failures=1, min_duration=1, cmdline="echo hello world")
     ],
     constraints = [{'order': ['a', 'b', 'c']}]
   )
   return task.interpolate()[0]
Exemplo n.º 10
0
def flaky_task():
    task = Task(name="failing_task",
                max_failures=2,
                processes=[
                    Process(name="a",
                            max_failures=1,
                            min_duration=1,
                            cmdline="echo hello world"),
                    Process(name="b",
                            max_failures=2,
                            min_duration=1,
                            cmdline="exit 1"),
                    Process(name="c",
                            max_failures=1,
                            min_duration=1,
                            final=True,
                            cmdline="echo hello world")
                ],
                constraints=[{
                    'order': ['a', 'b']
                }])
    return task.interpolate()[0]
Exemplo n.º 11
0
 def task(cls):
   ping_template = Process(
     name="{{process_name}}",
     min_duration=1,
     max_failures=5,
     cmdline = "echo {{process_name}} pinging;                                "
               "echo ping >> {{process_name}};                                "
               "echo current count $(cat {{process_name}} | wc -l);           "
               "if [ $(cat {{process_name}} | wc -l) -eq {{num_runs}} ]; then "
               "  exit 0;                                             "
               "else                                                  "
               "  exit 1;                                             "
               "fi                                                    ")
   tsk = Task(
     name = "pingping",
     resources = Resources(cpu = 1.0, ram = 16*1024*1024, disk = 16*1024),
     processes = [
       ping_template.bind(process_name = "p1", num_runs = 1),
       ping_template.bind(process_name = "p2", num_runs = 2),
       ping_template.bind(process_name = "p3", num_runs = 3),
     ]
   )
   return tsk.interpolate()[0]
Exemplo n.º 12
0
 def task(cls):
     ping_template = Process(
         name="{{process_name}}",
         min_duration=1,
         max_failures=5,
         cmdline=
         "echo {{process_name}} pinging;                                "
         "echo ping >> {{process_name}};                                "
         "echo current count $(cat {{process_name}} | wc -l);           "
         "if [ $(cat {{process_name}} | wc -l) -eq {{num_runs}} ]; then "
         "  exit 0;                                             "
         "else                                                  "
         "  exit 1;                                             "
         "fi                                                    ")
     tsk = Task(name="pingping",
                resources=Resources(cpu=1.0,
                                    ram=16 * 1024 * 1024,
                                    disk=16 * 1024),
                processes=[
                    ping_template.bind(process_name="p1", num_runs=1),
                    ping_template.bind(process_name="p2", num_runs=2),
                    ping_template.bind(process_name="p3", num_runs=3),
                ])
     return tsk.interpolate()[0]
Exemplo n.º 13
0
 def task(cls):
     task = Task(name="task", finalization_wait=3, processes=[ignorant_process(name="ignorant_process")])
     return task.interpolate()[0]
Exemplo n.º 14
0
 def task(cls):
     task = Task(name="task", processes=[sleepy_process(name="process")])
     return task.interpolate()[0]
Exemplo n.º 15
0
 def task(cls):
     main = Process(name="main", cmdline="date && echo hello world")
     finalizer = Process(name="finalizer", cmdline="date", final=True)
     task = Task(name="task_with_finalizer", processes=[main, finalizer])
     return task.interpolate()[0]
Exemplo n.º 16
0
 def task(cls):
   main = Process(name="main", cmdline="date && echo hello world")
   finalizer = Process(name="finalizer", cmdline="date", final=True)
   task = Task(name="task_with_finalizer", processes = [main, finalizer])
   return task.interpolate()[0]
Exemplo n.º 17
0
 def task(cls):
     task = Task(name="task", processes=[Process(name="process", cmdline=SIMPLEFORK_SCRIPT)])
     return task.interpolate()[0]
Exemplo n.º 18
0
 def task(cls):
     task = Task(name="task", processes=[sleepy_process(name="process")])
     return task.interpolate()[0]
Exemplo n.º 19
0
 def task(cls):
     task = Task(
         name="task",
         processes=[Process(name="process", cmdline=SIMPLEFORK_SCRIPT)])
     return task.interpolate()[0]
Exemplo n.º 20
0
 def task(cls):
     task = Task(name="task",
                 finalization_wait=3,
                 processes=[ignorant_process(name="ignorant_process")])
     return task.interpolate()[0]