本文整理汇总了Python中Cobalt.Proxy.ComponentProxy.get_current_date_time方法的典型用法代码示例。如果您正苦于以下问题:Python ComponentProxy.get_current_date_time方法的具体用法?Python ComponentProxy.get_current_date_time怎么用?Python ComponentProxy.get_current_date_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cobalt.Proxy.ComponentProxy
的用法示例。
在下文中一共展示了ComponentProxy.get_current_date_time方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: metricmon
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import get_current_date_time [as 别名]
class metricmon(Component):
"""metrics mointor: monitors the real time statistics of interested metrics such as average waiting time and system utilization rate"""
implementation = "imon"
name = "imon"
def __init__(self, *args, **kwargs):
Component.__init__(self, *args, **kwargs)
self.event_manager = ComponentProxy("event-manager")
self.bqsim = ComponentProxy("queue-manager")
self.mmon_logger = None
def get_current_time_sec(self):
return self.event_manager.get_current_time()
def get_current_time_date(self):
return self.event_manager.get_current_date_time()
def init_mmon_logger(self):
if self.mon_logger == None:
self.mmon_logger = PBSlogger(self.bqsim.get_outputlog_string() + "-mmon")
def metric_monitor(self):
self.bqsim.monitor_metrics()
示例2: ClusterQsim
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import get_current_date_time [as 别名]
#.........这里部分代码省略.........
#recording holding job id and holden resource
self.job_hold_dict = {}
#record holding job's holding time jobid:first hold (sec)
self.first_hold_time_dict = {}
#record yield jobs's first yielding time, for calculating the extra waiting time
self.first_yield_hold_time_dict = {}
#record yield job ids. update dynamically
self.yielding_job_list = []
if self.coscheduling:
remote_mate_job_dict = dict((v,k) for k, v in self.mate_job_dict.iteritems())
try:
ComponentProxy(REMOTE_QUEUE_MANAGER).set_mate_job_dict(remote_mate_job_dict)
except:
self.logger.error("failed to connect to remote queue-manager component!")
self.coscheduling = False
print "number of mate job pairs: %s, proportion in cluster jobs: %s%%" \
% (len(self.mate_job_dict.keys()), round(proportion *100, 1) )
self.max_holding_sys_util = DEFAULT_MAX_HOLDING_SYS_UTIL
def get_current_time(self):
'''this function overrid the get_current_time in bgsched, bg_base_system, and cluster_base_system'''
return self.event_manager.get_current_time()
def get_current_time_sec(self):
return self.event_manager.get_current_time()
def get_current_time_date(self):
return self.event_manager.get_current_date_time()
def insert_time_stamp(self, timestamp, type, info):
'''insert time stamps in the same order'''
if type not in SET_event:
print "invalid event type,", type
return
evspec = {}
evspec['jobid'] = info.get('jobid', 0)
evspec['type'] = type
evspec['datetime'] = sec_to_date(timestamp)
evspec['unixtime'] = timestamp
evspec['machine'] = MACHINE_ID
self.event_manager.add_event(evspec)
def _get_queuing_jobs(self):
return [job for job in self.queues.get_jobs([{'is_runnable':True}])]
queuing_jobs = property(_get_queuing_jobs)
def _get_running_jobs(self):
return [job for job in self.queues.get_jobs([{'has_resources':True}])]
running_jobs = property(_get_running_jobs)
def add_queues(self, specs):
'''add queues'''
return self.queues.add_queues(specs)
add_queues = exposed(query(add_queues))
def get_queues(self, specs):
'''get queues'''
return self.queues.get_queues(specs)