本文整理汇总了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]
示例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]
示例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]
示例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]
示例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]
示例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]