本文整理汇总了Python中request.Request.create_from_jobinfo方法的典型用法代码示例。如果您正苦于以下问题:Python Request.create_from_jobinfo方法的具体用法?Python Request.create_from_jobinfo怎么用?Python Request.create_from_jobinfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类request.Request
的用法示例。
在下文中一共展示了Request.create_from_jobinfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _monitor_lrms_jobs
# 需要导入模块: from request import Request [as 别名]
# 或者: from request.Request import create_from_jobinfo [as 别名]
def _monitor_lrms_jobs(self):
lrms_jobinfolist = self._platform.get_jobinfolist()
now = cpyutils.eventloop.now()
if lrms_jobinfolist is None:
err_time = now - self._timestamp_joblist
if err_time < _CONFIGURATION_MONITORING.PERIOD_MONITORING_JOBS_FAIL_GRACE:
_LOGGER.debug("could not obtain the job list from the platform in the last %s seconds, but we are in grace time" % err_time)
return
_LOGGER.warning("could not obtain the job list from the platform in the last %s seconds" % err_time)
lrms_jobinfolist = {}
# Now we are updating the items in the lrms_jobinfo
if self._lrms_joblist is None:
_LOGGER.debug("first monitorisation of jobs in LRMS\n")
self._lrms_joblist = JobList()
for job in lrms_jobinfolist:
self._lrms_joblist.append(Request.create_from_jobinfo(job))
stored_j_ids = self._lrms_joblist.get_ids()
for job_info in lrms_jobinfolist:
j_id = job_info.job_id
if j_id in stored_j_ids:
job = self._lrms_joblist.get_by_id(j_id)
job.update_info(job_info)
else:
_LOGGER.warning("job %s has just appeared" % j_id)
self._lrms_joblist.append(Request.create_from_jobinfo(job_info))
# First we are detecting the missing jobs
job_ids = [ j.job_id for j in lrms_jobinfolist ]
j_ids_to_delete = []
for job in self._lrms_joblist:
# Final states are SERVED, NOT_SERVED y DISSAPEARED, so if it the job is not in the observed list but it was in a temporary state (e.g. ATTENDED), it has dissapeared
if (job.state not in [ Request.SERVED, Request.NOT_SERVED, Request.DISSAPEARED ]) and (job.job_id not in job_ids):
job.set_state(Request.DISSAPEARED)
# These are jobs that are kept because the job list is incremental and it is not substituted
if (job.state in [ Request.NOT_SERVED, Request.SERVED, Request.DISSAPEARED ]) and ((now - job.timestamp_state) > _CONFIGURATION_MONITORING.COOLDOWN_SERVED_JOBS):
j_ids_to_delete.append(job.job_id)
for job_id in j_ids_to_delete:
self._lrms_joblist.del_by_id(job_id)
self._timestamp_joblist = now