def run_slave(url): slave = Slave(url) while True: task, status_code = slave.fetch_next_task() if status_code != HTTP_404_NOT_FOUND: slave.process_task(task) print() else: print() print('PID {}: No tasks found! Sleeping for 2 second...' .format(os.getpid())) time.sleep(2)