IOError: [Errno 4] Interrupted function call

0

I have a process that waits for a certain period of time (Hours) to move to the next cycle of the loop. In some occasions it usually throws an exception interrupting the process.

  

IOError: [Errno 4] Interrupted function call

The traceback of the error indicates that the time.sleep () line is where the fault occurs.

The following code was used for the process:

import time
from multiprocessing import freeze_support
import multiprocessing

#cantidad de horas a esperar por cada ciclo
HORA_ESPERA = 1


def worker(q):
    while True:
        try:
            time.sleep(HORA_ESPERA*3600)
        except Exception as e:
            # si falla esperar 60 segundos
            time.sleep(60)

    return

queue = multiprocessing.Queue()
p = multiprocessing.Process(target=worker, args=(queue,))
p.daemon = True
p.start()
queue.put('mensaje al worker')
queue.close()

I do not understand why the time.sleep failed

    
asked by Blasito 21.07.2018 в 13:49
source

0 answers