本文整理汇总了Python中Cobalt.Proxy.ComponentProxy.add_init_events方法的典型用法代码示例。如果您正苦于以下问题:Python ComponentProxy.add_init_events方法的具体用法?Python ComponentProxy.add_init_events怎么用?Python ComponentProxy.add_init_events使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cobalt.Proxy.ComponentProxy
的用法示例。
在下文中一共展示了ComponentProxy.add_init_events方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ClusterQsim
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import add_init_events [as 别名]
#.........这里部分代码省略.........
if self.walltime_prediction: #*AdjEst*
ap = self.get_walltime_Ap(spec)
spec['walltime_p'] = float(spec['walltime']) * ap
else:
spec['walltime_p'] = float(spec['walltime'])
spec['state'] = 'invisible'
spec['start_time'] = '0'
spec['end_time'] = '0'
spec['queue'] = "default"
spec['has_resources'] = False
spec['is_runnable'] = False
#add the job spec to the spec list
specs.append(spec)
specs.sort(subtimecmp)
#adjust workload density and simulation start time
if self.fraction != 1 or self.anchor !=0 :
tune_workload(specs, self.fraction, self.anchor)
print "workload adjusted: "
print "first job submitted:", sec_to_date(specs[0].get('submittime'))
print "last job submitted:", sec_to_date(specs[len(specs)-1].get('submittime'))
self.total_job = len(specs)
print "total job number:", self.total_job
#self.add_jobs(specs)
self.unsubmitted_job_spec_dict = self.init_unsubmitted_dict(specs)
self.event_manager.add_init_events(specs, MACHINE_ID)
return 0
def init_unsubmitted_dict(self, specs):
#jobdict = {}
specdict = {}
for spec in specs:
jobid = str(spec['jobid'])
#new_job = Job(spec)
#jobdict[jobid] = new_job
specdict[jobid] = spec
return specdict
def get_walltime_Ap(self, spec): #*AdjEst*
'''get walltime adjusting parameter from history manager component'''
projectname = spec.get('project')
username = spec.get('user')
if prediction_scheme == "paired":
return self.history_manager.get_Ap_by_keypair(username, projectname)
Ap_proj = self.history_manager.get_Ap('project', projectname)
Ap_user = self.history_manager.get_Ap('user', username)
if prediction_scheme == "project":
return Ap_proj
elif prediction_scheme == "user":
print "Ap_user==========", Ap_user
return Ap_user
elif prediction_scheme == "combined":
return (Ap_proj + Ap_user) / 2