[llvm] r375129 - [lit] Synthesize artificial deadline

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 10:46:17 PDT 2019


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.

This is the error I got locally:
https://reviews.llvm.org/P8167
OverflowError: timestamp too large to convert to C _PyTime_t

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.

On Thu, Oct 17, 2019 at 8:58 AM Julian Lettner via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: yln
> Date: Thu Oct 17 09:01:18 2019
> New Revision: 375129
>
> URL: http://llvm.org/viewvc/llvm-project?rev=375129&view=rev
> Log:
> [lit] Synthesize artificial deadline
>
> We always want to use a deadline when calling `result.await`.  Let's
> synthesize an artificial deadline (positive infinity) to simplify code
> and do less busy waiting.
>
> Modified:
>     llvm/trunk/utils/lit/lit/run.py
>
> Modified: llvm/trunk/utils/lit/lit/run.py
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/run.py?rev=375129&r1=375128&r2=375129&view=diff
>
> ==============================================================================
> --- llvm/trunk/utils/lit/lit/run.py (original)
> +++ llvm/trunk/utils/lit/lit/run.py Thu Oct 17 09:01:18 2019
> @@ -12,6 +12,7 @@ class NopSemaphore(object):
>      def release(self): pass
>
>  def create_run(tests, lit_config, workers, progress_callback, max_time):
> +    # TODO(yln) assert workers > 0
>      if workers == 1:
>          return SerialRun(tests, lit_config, progress_callback, max_time)
>      return ParallelRun(tests, lit_config, progress_callback, max_time,
> workers)
> @@ -107,11 +108,7 @@ class ParallelRun(Run):
>          self.workers = workers
>
>      def _execute(self):
> -        # We need to issue many wait calls, so compute the final deadline
> and
> -        # subtract time.time() from that as we go along.
> -        deadline = None
> -        if self.max_time:
> -            deadline = time.time() + self.max_time
> +        deadline = (time.time() + self.max_time) if self.max_time else
> float('inf')
>
>          semaphores = {
>              k: NopSemaphore() if v is None else
> @@ -146,15 +143,10 @@ class ParallelRun(Run):
>              # Wait for all results to come in. The callback that runs in
> the
>              # parent process will update the display.
>              for a in async_results:
> -                if deadline:
> -                    a.wait(deadline - time.time())
> -                else:
> -                    # Python condition variables cannot be interrupted
> unless
> -                    # they have a timeout. This can make lit unresponsive
> to
> -                    # KeyboardInterrupt, so do a busy wait with a timeout.
> -                    while not a.ready():
> -                        a.wait(1)
> +                timeout = deadline - time.time()
> +                a.wait(timeout)
>                  if not a.successful():
> +                    # TODO(yln): this also raises on a --max-time time
>                      a.get() # Exceptions raised here come from the worker.
>                  if self.hit_max_failures:
>                      break
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191017/f509fcd0/attachment.html>


More information about the llvm-commits mailing list