<div dir="ltr">I reverted this patch because it made running any tests locally impossible. I happen to use Python 3 to run lit, since LLDB on Windows requires it. I see that it didn't affect the two Windows bots I run, though.<div><br></div><div>This is the error I got locally:</div><div><a href="https://reviews.llvm.org/P8167">https://reviews.llvm.org/P8167</a> </div><div>OverflowError: timestamp too large to convert to C _PyTime_t<br></div><div><br></div><div>I guess the async result can't tolerate infinity as an argument in this particular version of Python (3.7) on Windows. We could use an artificial deadline like "now plus one year" to work around the overflow. <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 17, 2019 at 8:58 AM Julian Lettner via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: yln<br>
Date: Thu Oct 17 09:01:18 2019<br>
New Revision: 375129<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=375129&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=375129&view=rev</a><br>
Log:<br>
[lit] Synthesize artificial deadline<br>
<br>
We always want to use a deadline when calling `result.await`.  Let's<br>
synthesize an artificial deadline (positive infinity) to simplify code<br>
and do less busy waiting.<br>
<br>
Modified:<br>
    llvm/trunk/utils/lit/lit/run.py<br>
<br>
Modified: llvm/trunk/utils/lit/lit/run.py<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/run.py?rev=375129&r1=375128&r2=375129&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/run.py?rev=375129&r1=375128&r2=375129&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/utils/lit/lit/run.py (original)<br>
+++ llvm/trunk/utils/lit/lit/run.py Thu Oct 17 09:01:18 2019<br>
@@ -12,6 +12,7 @@ class NopSemaphore(object):<br>
     def release(self): pass<br>
<br>
 def create_run(tests, lit_config, workers, progress_callback, max_time):<br>
+    # TODO(yln) assert workers > 0<br>
     if workers == 1:<br>
         return SerialRun(tests, lit_config, progress_callback, max_time)<br>
     return ParallelRun(tests, lit_config, progress_callback, max_time, workers)<br>
@@ -107,11 +108,7 @@ class ParallelRun(Run):<br>
         self.workers = workers<br>
<br>
     def _execute(self):<br>
-        # We need to issue many wait calls, so compute the final deadline and<br>
-        # subtract time.time() from that as we go along.<br>
-        deadline = None<br>
-        if self.max_time:<br>
-            deadline = time.time() + self.max_time<br>
+        deadline = (time.time() + self.max_time) if self.max_time else float('inf')<br>
<br>
         semaphores = {<br>
             k: NopSemaphore() if v is None else<br>
@@ -146,15 +143,10 @@ class ParallelRun(Run):<br>
             # Wait for all results to come in. The callback that runs in the<br>
             # parent process will update the display.<br>
             for a in async_results:<br>
-                if deadline:<br>
-                    a.wait(deadline - time.time())<br>
-                else:<br>
-                    # Python condition variables cannot be interrupted unless<br>
-                    # they have a timeout. This can make lit unresponsive to<br>
-                    # KeyboardInterrupt, so do a busy wait with a timeout.<br>
-                    while not a.ready():<br>
-                        a.wait(1)<br>
+                timeout = deadline - time.time()<br>
+                a.wait(timeout)<br>
                 if not a.successful():<br>
+                    # TODO(yln): this also raises on a --max-time time<br>
                     a.get() # Exceptions raised here come from the worker.<br>
                 if self.hit_max_failures:<br>
                     break<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>