From 7486fafbaafc7d7d0db5f9d2d21b2e1d386fe105 Mon Sep 17 00:00:00 2001 From: llnu Date: Sun, 8 Dec 2019 13:23:26 +0100 Subject: [PATCH] [scheduler] refactored from env_vars to config --- ucloud/scheduler/main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ucloud/scheduler/main.py b/ucloud/scheduler/main.py index e2c975a..9ebc4c8 100755 --- a/ucloud/scheduler/main.py +++ b/ucloud/scheduler/main.py @@ -6,7 +6,7 @@ from ucloud.common.request import RequestEntry, RequestType from ucloud.config import etcd_client -from ucloud.config import host_pool, request_pool, vm_pool, env_vars +from ucloud.config import host_pool, request_pool, vm_pool, config from .helper import (get_suitable_host, dead_host_mitigation, dead_host_detection, assign_host, NoSuitableHostFound) from . import logger @@ -18,8 +18,8 @@ def main(): pending_vms = [] for request_iterator in [ - etcd_client.get_prefix(env_vars.get('REQUEST_PREFIX'), value_in_json=True), - etcd_client.watch_prefix(env_vars.get('REQUEST_PREFIX'), timeout=5, value_in_json=True), + etcd_client.get_prefix(config['etcd']['REQUEST_PREFIX'], value_in_json=True), + etcd_client.watch_prefix(config['etcd']['REQUEST_PREFIX'], timeout=5, value_in_json=True), ]: for request_event in request_iterator: request_entry = RequestEntry(request_event) @@ -46,7 +46,7 @@ def main(): r = RequestEntry.from_scratch(type="ScheduleVM", uuid=pending_vm_entry.uuid, hostname=pending_vm_entry.hostname, - request_prefix=env_vars.get("REQUEST_PREFIX")) + request_prefix=config['etcd']["REQUEST_PREFIX"]) request_pool.put(r) elif request_entry.type == RequestType.ScheduleVM: @@ -72,7 +72,7 @@ def main(): r = RequestEntry.from_scratch(type=RequestType.InitVMMigration, uuid=request_entry.uuid, destination=request_entry.destination, - request_prefix=env_vars.get("REQUEST_PREFIX")) + request_prefix=config['etcd']["REQUEST_PREFIX"]) request_pool.put(r) # If the Request is about a VM that just want to get started/created