Skip to content

Commit

Permalink
Added a gif for the example and tiny improvements to the code
Browse files Browse the repository at this point in the history
  • Loading branch information
d-krupke committed Jun 13, 2024
1 parent 86ed79b commit 3822306
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions 06_coding_patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -691,4 +691,8 @@ actually have to build a task queues where the solver is run by workers. Using
multiprocessing can still be useful for the worker to remain responsive for stop
signals while the solver is running.

| ![Interactive Solver with Streamlit using multiprocessing](https://github.com/d-krupke/cpsat-primer/blob/main/images/streamlit_solver.gif) |
| :----------------------------------------------------------------------------------------------------------------------------------------: |
| _Using multiprocessing, one can build a responsive interface for a solver._ |

---
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3125,6 +3125,10 @@ actually have to build a task queues where the solver is run by workers. Using
multiprocessing can still be useful for the worker to remain responsive for stop
signals while the solver is running.

| ![Interactive Solver with Streamlit using multiprocessing](https://github.com/d-krupke/cpsat-primer/blob/main/images/streamlit_solver.gif) |
| :----------------------------------------------------------------------------------------------------------------------------------------: |
| _Using multiprocessing, one can build a responsive interface for a solver._ |

---


Expand Down
4 changes: 3 additions & 1 deletion examples/embedding_cpsat/solver_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,7 @@ def __del__(self):
"""Cleans up the process when the object is deleted."""
if self.process.is_alive():
self.interrupt()
self.process.join()
self.process.join(timeout=1)
if self.process.is_alive():
self.process.terminate()
self.process.close()
Binary file added images/streamlit_solver.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3822306

Please sign in to comment.