Ticket #11658: trac_11658-fix_timeout_in_parallel_decorator.sagelib.patch

File trac_11658-fix_timeout_in_parallel_decorator.sagelib.patch, 986 bytes (added by leif, 11 years ago)

Sage library patch. Corrects time to wait for child processes (before they get killed) in the parallel fork decorator. Based on Sage 4.7.1.rc0.

  • sage/parallel/use_fork.py

    # HG changeset patch
    # User Leif Leonhardy <not.really@online.de>
    # Date 1312803746 -7200
    # Node ID 5186d5944d0f7ff89ae4d982cda7e6b5e6dc9887
    # Parent  99045c72f54cc6d141685bb51c04b8a08edf99c4
    #11658 Fix bug in computing the time to wait in parallel decorator using fork (if timeout was given).
    
    diff -r 99045c72f54c -r 5186d5944d0f sage/parallel/use_fork.py
    a b  
    106106                            raise RuntimeError, "SIGALRM"
    107107                        oldest = min([X[1] for X in workers.values()])
    108108                        signal.signal(signal.SIGALRM, mysig)
    109                         signal.alarm(int(walltime() - oldest)+1)
     109                        signal.alarm(max(int(timeout - (walltime()-oldest)), 1))
    110110                    try:
    111111                        pid = os.wait()[0]
    112112                        signal.signal(signal.SIGALRM, signal.SIG_IGN)