• 카테고리

    질문 & 답변
  • 세부 분야

    프로그래밍 언어

  • 해결 여부

    미해결

multi process 에러 질문입니다.

21.12.17 17:52 작성 조회수 1.55k

0

- concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
 
아래 코드를 실행했을 때 위와 같은 에러가 발생합니다. 순차실행시는 정상 작동하고, 리스트를 5개정도 줄였을 때도 작동하였습니다. stackoverflow 등을 찾아봤지만 전혀 답을 찾을 수 없어서 올립니다. 위 오류의 원인과 해결책을 알려주시면 감사하겠습니다.
 
 
if __name__ == "__main__":
worker = min(10, len(process_list))
# 시작 시간
start_tm = time.time()
# Futures
futures_list = []

with ProcessPoolExecutor(max_workers=worker) as excutor:
for process_item in process_list:
# future 반환
future = excutor.submit(CODE_EXEC, process_item)
futures_list.append(future)
print('Scheduled for {} : {}'.format(process_list, future))

# as_completed 결과 출력
for future in as_completed(futures_list):
result = future.result()
done = future.done()
cancelled = future.cancelled

# future 결과 확인
print('Future Result : {}, Done : {}'.format(result, done))
print('Future Cancelled : {}'.format(cancelled))

답변 1

답변을 작성해보세요.

1

 worker의 줄여보시고 사용자의 프로세스의 수 또는 cpu 코어

운영체제의 실행 상태에 따라서 실행이 안 될 수도 있어요!

worker의 수를 줄여서 최적의 실행 환경을 찾아보세요

코드상의 예외가 아니라 운영체제에서 발생하는 에러는 제어할 수 없어여~