From db7fcdd66fb52d89eba85f7cf81dbbb50acad80e Mon Sep 17 00:00:00 2001 From: meow Date: Wed, 27 Nov 2019 19:19:57 +0500 Subject: [PATCH] add rc-scripts and confs. Make log message clear when host is not found --- hack/conf.d/ucloud-host | 1 + hack/rc-scripts/ucloud-api | 8 ++++++++ hack/rc-scripts/ucloud-host | 8 ++++++++ hack/rc-scripts/ucloud-scheduler | 8 ++++++++ host/main.py | 2 +- 5 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 hack/conf.d/ucloud-host create mode 100644 hack/rc-scripts/ucloud-api create mode 100644 hack/rc-scripts/ucloud-host create mode 100644 hack/rc-scripts/ucloud-scheduler diff --git a/hack/conf.d/ucloud-host b/hack/conf.d/ucloud-host new file mode 100644 index 0000000..d1dd8d1 --- /dev/null +++ b/hack/conf.d/ucloud-host @@ -0,0 +1 @@ +HOSTNAME=server1.place10 \ No newline at end of file diff --git a/hack/rc-scripts/ucloud-api b/hack/rc-scripts/ucloud-api new file mode 100644 index 0000000..eb7f83e --- /dev/null +++ b/hack/rc-scripts/ucloud-api @@ -0,0 +1,8 @@ +#!/sbin/openrc-run + +name="$RC_SVCNAME" +pidfile="/var/run/${name}.pid" +command="$(which pipenv)" +command_args="run python ucloud.py api" +command_background="true" +directory="/root/ucloud" \ No newline at end of file diff --git a/hack/rc-scripts/ucloud-host b/hack/rc-scripts/ucloud-host new file mode 100644 index 0000000..0aa375f --- /dev/null +++ b/hack/rc-scripts/ucloud-host @@ -0,0 +1,8 @@ +#!/sbin/openrc-run + +name="$RC_SVCNAME" +pidfile="/var/run/${name}.pid" +command="$(which pipenv)" +command_args="run python ucloud.py host ${HOSTNAME}" +command_background="true" +directory="/root/ucloud" \ No newline at end of file diff --git a/hack/rc-scripts/ucloud-scheduler b/hack/rc-scripts/ucloud-scheduler new file mode 100644 index 0000000..00c0a36 --- /dev/null +++ b/hack/rc-scripts/ucloud-scheduler @@ -0,0 +1,8 @@ +#!/sbin/openrc-run + +name="$RC_SVCNAME" +pidfile="/var/run/${name}.pid" +command="$(which pipenv)" +command_args="run python ucloud.py scheduler" +command_background="true" +directory="/root/ucloud" \ No newline at end of file diff --git a/host/main.py b/host/main.py index a51e09a..c5c5887 100755 --- a/host/main.py +++ b/host/main.py @@ -76,7 +76,7 @@ def main(hostname): host_pool = HostPool(etcd_client, env_vars.get('HOST_PREFIX')) host = next(filter(lambda h: h.hostname == hostname, host_pool.hosts), None) - assert host is not None, "No such host" + assert host is not None, "No such host with name = {}".format(hostname) try: heartbeat_updating_process.start()