Python-ELMO is a Python library which offers an encapsulation of the binary tool ELMO, in order to manipulate it easily in Python and SageMath script.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

run_server.py 888B

  1. from listeningthread import ListeningThread
  2. from executorthread import ExecutorThread
  3. def do_main_program(projects):
  4. global thread, stop
  5. thread = ListeningThread('localhost', 5000, ExecutorThread, projects=projects)
  6. thread.start()
  7. def program_cleanup(signum, frame):
  8. global thread, stop
  9. thread.stop()
  10. stop = True
  11. thread = None
  12. stop = False
  13. # Information
  14. from project_reader import ProjectReader
  15. reader = ProjectReader()
  16. projects = {sc.get_project_label(): sc for sc in reader.get_project_classes()}
  17. print('Available projects: %s' % list(projects.keys()))
  18. print('')
  19. # Execute
  20. print("Executing...")
  21. do_main_program(projects)
  22. print("Done ! And now, listening...")
  23. import signal
  24. signal.signal(signal.SIGINT, program_cleanup)
  25. signal.signal(signal.SIGTERM, program_cleanup)
  26. # Wait
  27. import time
  28. while not stop:
  29. time.sleep(1)