Merge branch 'wip' into 'master'
Wip See merge request ungleich-public/ucloud-scheduler!1
This commit is contained in:
commit
d468a1ba7d
8 changed files with 14 additions and 15 deletions
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
3
Pipfile
Normal file → Executable file
3
Pipfile
Normal file → Executable file
|
@ -7,12 +7,15 @@ verify_ssl = true
|
|||
bandit = "*"
|
||||
flake8 = "*"
|
||||
black = "==19.3b0"
|
||||
pylint = "*"
|
||||
|
||||
[packages]
|
||||
python-decouple = "*"
|
||||
pytest = "*"
|
||||
coverage = "*"
|
||||
grpcio = "*"
|
||||
python-etcd3 = {editable = true,git = "https://github.com/kragniz/python-etcd3"}
|
||||
pylint = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.7"
|
||||
|
|
0
Pipfile.lock
generated
Normal file → Executable file
0
Pipfile.lock
generated
Normal file → Executable file
4
config.py
Normal file
4
config.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
from decouple import config
|
||||
from etcd3_wrapper import Etcd3Wrapper
|
||||
|
||||
etcd_client = Etcd3Wrapper(host=config("ETCD_URL"))
|
5
helper.py
Normal file → Executable file
5
helper.py
Normal file → Executable file
|
@ -5,12 +5,9 @@ from ucloud_common.vm import VmPool, VMStatus
|
|||
from ucloud_common.host import HostPool, HostStatus
|
||||
from ucloud_common.request import RequestEntry, RequestPool, RequestType
|
||||
|
||||
from etcd3_wrapper import Etcd3Wrapper
|
||||
from decouple import config
|
||||
from config import etcd_client as client
|
||||
|
||||
client = Etcd3Wrapper(
|
||||
host=config("ETCD_HOST"), port=int(config("ETCD_PORT"))
|
||||
)
|
||||
vm_pool = VmPool(client, config("VM_PREFIX"))
|
||||
host_pool = HostPool(client, config("HOST_PREFIX"))
|
||||
request_pool = RequestPool(client, config("REQUEST_PREFIX"))
|
||||
|
|
6
main.py
Normal file → Executable file
6
main.py
Normal file → Executable file
|
@ -9,7 +9,7 @@ import logging
|
|||
|
||||
from decouple import config
|
||||
|
||||
from etcd3_wrapper import Etcd3Wrapper
|
||||
from config import etcd_client as client
|
||||
|
||||
from ucloud_common.vm import VmPool
|
||||
from ucloud_common.host import HostPool
|
||||
|
@ -28,9 +28,7 @@ logging.basicConfig(
|
|||
|
||||
def main(vm_prefix, host_prefix, request_prefix):
|
||||
logging.info(f"{'*' * 5} SESSION STARTED {'*' * 5}")
|
||||
client = Etcd3Wrapper(
|
||||
host=config("ETCD_HOST"), port=int(config("ETCD_PORT"))
|
||||
)
|
||||
|
||||
vm_pool = VmPool(client, vm_prefix)
|
||||
host_pool = HostPool(client, host_prefix)
|
||||
request_pool = RequestPool(client, request_prefix)
|
||||
|
|
5
tests/test_basics.py
Normal file → Executable file
5
tests/test_basics.py
Normal file → Executable file
|
@ -20,13 +20,12 @@ from main import (
|
|||
main,
|
||||
)
|
||||
|
||||
from etcd3_wrapper import Etcd3Wrapper
|
||||
|
||||
from config import etcd_client
|
||||
|
||||
class TestFunctions(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.client = Etcd3Wrapper()
|
||||
cls.client = etcd_client
|
||||
cls.host_prefix = "/test/host"
|
||||
cls.vm_prefix = "/test/vm"
|
||||
|
||||
|
|
6
tests/test_dead_host_mechanism.py
Normal file → Executable file
6
tests/test_dead_host_mechanism.py
Normal file → Executable file
|
@ -16,14 +16,12 @@ from main import (
|
|||
dead_host_detection,
|
||||
dead_host_mitigation,
|
||||
main,
|
||||
config
|
||||
)
|
||||
|
||||
from etcd3_wrapper import Etcd3Wrapper
|
||||
|
||||
|
||||
class TestDeadHostMechanism(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.client = Etcd3Wrapper()
|
||||
self.client = config.etcd_client
|
||||
self.host_prefix = "/test/host"
|
||||
self.vm_prefix = "/test/vm"
|
||||
|
||||
|
|
Loading…
Reference in a new issue