From c299d1a182d0fc78adb97e3c453df1e37c854b77 Mon Sep 17 00:00:00 2001
From: SP Mohanty <spmohanty91@gmail.com>
Date: Thu, 25 Jul 2019 20:02:54 +0200
Subject: [PATCH] Fixed #127 - Add a conditional to not use signals on windows

---
 flatland/evaluators/service.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/flatland/evaluators/service.py b/flatland/evaluators/service.py
index 201a397..0691d63 100644
--- a/flatland/evaluators/service.py
+++ b/flatland/evaluators/service.py
@@ -13,10 +13,22 @@ import msgpack_numpy as m
 import os
 import glob
 import shutil
-import timeout_decorator
 import time
 import traceback
 import crowdai_api
+import timeout_decorator
+
+
+use_signals_in_timeout = True
+if os.name == 'nt':
+    """
+    Windows doesnt support signals, hence
+    timeout_decorators usually fall apart.
+    Hence forcing them to not using signals 
+    whenever using the timeout decorator.
+    """
+    use_signals_in_timeout = False
+
 m.patch()
 
 ########################################################
@@ -198,7 +210,9 @@ class FlatlandRemoteEvaluationService:
         _response['payload'] = payload
         return _response
 
-    @timeout_decorator.timeout(PER_STEP_TIMEOUT)  # timeout for each command
+    @timeout_decorator.timeout(
+                        PER_STEP_TIMEOUT,
+                        use_signals=use_signals_in_timeout)  # timeout for each command
     def _get_next_command(self, _redis):
         """
         A low level wrapper for obtaining the next command from a 
-- 
GitLab