Change REST client/server to a more understandable name

This commit is contained in:
Zihao Chen 2018-03-20 15:34:50 +08:00
Родитель d45136781e
Коммит 05d26c055e
3 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -19,7 +19,7 @@ import heartbeat_table
import logging_aux
import restclient
import restserver
from restclient import AutoScaleRestClient
from restclient import HpcRestClient
class HpcpackFramwork(object):
@ -48,7 +48,7 @@ class HpcpackFramwork(object):
self.heartbeat_table = heartbeat_table.HeartBeatTable()
self.hpc_client = AutoScaleRestClient()
self.hpc_client = HpcRestClient()
self.core_provisioning = 0.0
'''
@ -70,7 +70,7 @@ class HpcpackFramwork(object):
self.mesos_client.on(MesosClient.OFFERS, self.offer_received)
self.mesos_client.on(MesosClient.UPDATE, self.status_update)
self.th = HpcpackFramwork.MesosFramework(self.mesos_client)
self.heartbeat_server = restserver.RestServer(self.heartbeat_table, 8088)
self.heartbeat_server = restserver.HeartBeatServer(self.heartbeat_table, 8088)
def start(self):
self.th.start()

Просмотреть файл

@ -10,7 +10,7 @@ GrowDecision = namedtuple("GrowDecision", "cores_to_grow nodes_to_grow sockets_t
IdleNode = namedtuple("IdleNode", "node_name idle_since")
class AutoScaleRestClient(object):
class HpcRestClient(object):
def __init__(self, hostname="localhost"):
self.hostname = hostname
self.grow_decision_api_route = "https://{}/HpcManager/api/auto-scale/grow-decision"
@ -40,7 +40,7 @@ class AutoScaleRestClient(object):
if __name__ == '__main__':
client = AutoScaleRestClient()
client = HpcRestClient()
ans = client.get_grow_decision()
print ans.cores_to_grow
print client.check_nodes_idle(json.dumps(['mesoswinagent', 'mesoswinagent2']))

Просмотреть файл

@ -7,7 +7,7 @@ import logging_aux
from heartbeat_table import HeartBeatTable
class RestServer(object): # TODO: replace this implementation with twisted based implementation
class HeartBeatServer(object): # TODO: replace this implementation with twisted based implementation
def __init__(self, heartbeat_table, port=80):
self.logger = logging_aux.init_logger_aux("hpcframework.heatbeat_server", "hpcframework.heatbeat_server.log")
self._heartbeat_table = heartbeat_table # type: HeartBeatTable