當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。