本文整理汇总了Python中job.Job.pduration方法的典型用法代码示例。如果您正苦于以下问题:Python Job.pduration方法的具体用法?Python Job.pduration怎么用?Python Job.pduration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类job.Job
的用法示例。
在下文中一共展示了Job.pduration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sched_cost_n
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import pduration [as 别名]
def sched_cost_n(workflow, machines, schedule, n, timestamp, local):
"""
Return the cost used by n machines from timestamp untill end of execution.
"""
if local:
vm_boottime = timedelta(seconds=1)
else:
vm_boottime = VM_BOOTTIME
# existing machines
_schedule = Schedule(schedule)
if len(machines) < n:
_machines = list(machines)
# new machine + boot
for _i in range(n-len(_machines)):
machine = Machine()
_machines.append(machine)
boot_job = Job('boot', None)
boot_job.pduration = vm_boottime
boot_entry = ScheduleEntry(boot_job, machine, timestamp, timestamp+vm_boottime)
_schedule.add_entry_host(boot_entry, machine)
else:
# don't use spare machines
_machines = sorted(machines[1:], key=lambda m: schedule.entries_host[m][-1].end(), reverse=True)
for _i in range(len(_machines)-n):
_machines.pop()
_machines.insert(0, machines[0]) # manager
TIMER.tick("before sched")
sched_wf(workflow, _machines, _schedule, timestamp)
TIMER.tick("after sched")
_schedule.fix_machines()
cost_pred, _wf_end = sched_cost_pred(_machines, _schedule, timestamp)
return _schedule, cost_pred