当前位置: 首页>>代码示例>>Python>>正文


Python Task.interpolate方法代码示例

本文整理汇总了Python中apache.thermos.config.schema.Task.interpolate方法的典型用法代码示例。如果您正苦于以下问题:Python Task.interpolate方法的具体用法?Python Task.interpolate怎么用?Python Task.interpolate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在apache.thermos.config.schema.Task的用法示例。


在下文中一共展示了Task.interpolate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: task

# 需要导入模块: from apache.thermos.config.schema import Task [as 别名]
# 或者: from apache.thermos.config.schema.Task import interpolate [as 别名]
 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]
开发者ID:MustafaOrkunAcar,项目名称:incubator-aurora,代码行数:9,代码来源:test_finalization.py

示例2: task

# 需要导入模块: from apache.thermos.config.schema import Task [as 别名]
# 或者: from apache.thermos.config.schema.Task import interpolate [as 别名]
 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]
开发者ID:AltanAlpay,项目名称:aurora,代码行数:10,代码来源:test_ephemerals.py

示例3: task

# 需要导入模块: from apache.thermos.config.schema import Task [as 别名]
# 或者: from apache.thermos.config.schema.Task import interpolate [as 别名]
 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]
开发者ID:MustafaOrkunAcar,项目名称:incubator-aurora,代码行数:13,代码来源:test_failure_limit.py

示例4: flaky_task

# 需要导入模块: from apache.thermos.config.schema import Task [as 别名]
# 或者: from apache.thermos.config.schema.Task import interpolate [as 别名]
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]
开发者ID:betepahos,项目名称:incubator-aurora,代码行数:14,代码来源:test_angry.py

示例5: task

# 需要导入模块: from apache.thermos.config.schema import Task [as 别名]
# 或者: from apache.thermos.config.schema.Task import interpolate [as 别名]
 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]
开发者ID:betepahos,项目名称:incubator-aurora,代码行数:25,代码来源:test_failing_runner.py

示例6: task

# 需要导入模块: from apache.thermos.config.schema import Task [as 别名]
# 或者: from apache.thermos.config.schema.Task import interpolate [as 别名]
 def task(cls):
   task = Task(name="task", processes=[Process(name="process", cmdline=SIMPLEFORK_SCRIPT)])
   return task.interpolate()[0]
开发者ID:bhuvan,项目名称:incubator-aurora,代码行数:5,代码来源:test_staged_kill.py


注:本文中的apache.thermos.config.schema.Task.interpolate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。