인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

인프런 커뮤니티 질문&답변

vpdtlrdl님의 프로필 이미지
vpdtlrdl

작성한 질문수

우리를 위한 프로그래밍 : 파이썬 중급 (Inflearn Original)

병렬성 2 - Futures(5-1)

done, not_done 관련 질문입니다

작성

·

196

0

예제에서 나온

str(result.done)

str(result.not_done) 

에 관해서 질문드립니다.

concurrent.futures.wait()를 사용할 때는 2개의 튜플이 반환되고

각각 done과 not_done 이라는 이름이 붙어서 반환이 된다고 공식 문서에서 설명하고 있는데,

result.done과 result.not_done 과 같은 형식으로 함수나 메소드처럼 사용할 수 있는 건가요?

 

 

 

답변 1

0

좋은사람님의 프로필 이미지
좋은사람
지식공유자

concurrent.futures.wait(fstimeout=Nonereturn_when=ALL_COMPLETED)

Wait for the Future instances (possibly created by different Executor instances) given by fs to complete. Returns a named 2-tuple of sets. The first set, named done, contains the futures that completed (finished or cancelled futures) before the wait completed. The second set, named not_done, contains the futures that did not complete (pending or running futures).

 

맞습니다.

2개의 튜플이고 첫 번째 Set은 완료된 future, 두 번째 Set은 pending 또는 실행중인 future를

반환합니다.

 

보통은 메소드처럼 사용한다기 보다는 futures 담긴 작업들이 종료되기를 대기할 때 사용합니다.

vpdtlrdl님의 프로필 이미지
vpdtlrdl

작성한 질문수

질문하기