Added basic HTTP server
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,12 +1,26 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
from config import Config
|
||||
from plugins import WaitPlugin
|
||||
from plugin_repository import PluginRepository
|
||||
from program_executor import ProgramExecutor
|
||||
from http_server import ControllerHTTPServer
|
||||
import logging
|
||||
|
||||
|
||||
class HTTPControl:
|
||||
|
||||
def GET_status(self, path, data):
|
||||
return 200, "Very good!"
|
||||
|
||||
def POST_terminate(self, path, data):
|
||||
return 200, "Will do sir!"
|
||||
|
||||
def POST_continue(self, path, data):
|
||||
return 201, "Will do sir!"
|
||||
|
||||
|
||||
def main():
|
||||
# init
|
||||
logging.basicConfig(
|
||||
@@ -14,6 +28,8 @@ def main():
|
||||
format="%(asctime)s [%(levelname)s]: %(name)s: %(message)s",
|
||||
level=logging.DEBUG
|
||||
)
|
||||
http_server = ControllerHTTPServer(HTTPControl())
|
||||
http_server.start()
|
||||
compiler_repo = PluginRepository()
|
||||
compiler_repo.register_plugin(WaitPlugin)
|
||||
|
||||
@@ -21,6 +37,9 @@ def main():
|
||||
compiler_repo.load_plugin("wait")
|
||||
program = []
|
||||
program.append(compiler_repo.get_compiler("wait").compile(secs=2))
|
||||
program.append(compiler_repo.get_compiler("wait").compile(secs=3))
|
||||
program.append(compiler_repo.get_compiler("wait").compile(secs=10))
|
||||
program.append(compiler_repo.get_compiler("wait").compile(secs=10))
|
||||
|
||||
# execute:
|
||||
executor = ProgramExecutor(program)
|
||||
@@ -29,6 +48,7 @@ def main():
|
||||
# End of execution
|
||||
executor.join()
|
||||
compiler_repo.close()
|
||||
http_server.shutdown()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user