test_service.py 479 B

12345678910111213141516171819202122
  1. from modelverse import *
  2. init()
  3. login("test_service", "my_password")
  4. def fibonacci_service(port):
  5. def fibonacci(value):
  6. if value <= 2:
  7. return 1
  8. else:
  9. return fibonacci(value - 1) + fibonacci(value - 2)
  10. service_set(port, fibonacci(service_get(port)))
  11. service_register("fibonacci", fibonacci_service)
  12. while raw_input() != "STOP":
  13. # Stay active, as we shouldn't exit while the service is running!
  14. pass
  15. service_stop()