示例#1
0
def kill_container(cid):
    c = Container.get_by_container_id(cid)
    if c:
        c.kill()
        key = consts.ERU_AGENT_DIE_REASON % c.container_id
        r = rds.get(key)
        rds.delete(key)
        if r is not None:
            c.set_props({'oom': 1})
        current_app.logger.info('Kill container (container_id=%s)', cid[:7])
    return {'r': 0, 'msg': consts.OK}
示例#2
0
 def cores(self):
     try:
         return cPickle.loads(rds.get(self._cores_key))
     except (EOFError, TypeError):
         return {}