Nicer standalone engine inferface (#4480)
This commit is contained in:
@@ -249,6 +249,13 @@ class Engine:
|
|||||||
"""Shutdown the engine"""
|
"""Shutdown the engine"""
|
||||||
kill_process_tree(os.getpid(), include_parent=False)
|
kill_process_tree(os.getpid(), include_parent=False)
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
self.shutdown()
|
||||||
|
return False
|
||||||
|
|
||||||
def start_profile(self):
|
def start_profile(self):
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
loop.run_until_complete(self.tokenizer_manager.start_profile())
|
loop.run_until_complete(self.tokenizer_manager.start_profile())
|
||||||
|
|||||||
Reference in New Issue
Block a user