def stop(self, graceful=False):
self.stop_flag.set()<EOL>if graceful:<EOL><INDENT>self._logger.info('<STR_LIT>')<EOL>try:<EOL><INDENT>for _, worker_process in self.worker_threads:<EOL><INDENT>worker_process.join()<EOL><DEDENT><DEDENT>except KeyboardInterrupt:<EOL><INDENT>self._logger.info('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>self._logger.info('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self._logger.info('<STR_LIT>')<EOL><DEDENT>
Set the stop-flag.

If `graceful=True`, this method blocks until the workers to finish
executing any tasks they might be currently working on.