I am working on DoCplex problem in which I have 2 models. I am using ThreadPoolExecutor() to run the solves parallel. But is it possible to kill one of the solve once one of them is complete? I am using following code:
def work(slvr):
print("This is worker", slvr)
# do stuff
mdl= slvr.solve(clean_before_solve=True,log_output=True)
return mdl
with concurrent.futures.ThreadPoolExecutor() as executor:
future_to_area = {executor.submit(work, slvr): slvr for slvr in a}
for future in concurrent.futures.as_completed(future_to_area):
id = future_to_area[future]