Skip to content

Commit

Permalink
change default of slow_callback_duration
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolai committed Sep 23, 2019
1 parent ab9b0ae commit 920588e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rasa/core/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ async def _pull_model_and_fingerprint(

async with model_server.session() as session:
try:
set_log_level()
# set_log_level()
params = model_server.combine_parameters()
async with session.request(
"GET",
Expand Down
5 changes: 3 additions & 2 deletions rasa/utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def configure_colored_logging(loglevel):
)


def enable_async_loop_debugging(event_loop: AbstractEventLoop) -> AbstractEventLoop:
def enable_async_loop_debugging(event_loop: AbstractEventLoop,
slow_callback_duration: float = 0.1) -> AbstractEventLoop:
logging.info(
"Enabling coroutine debugging. Loop id {}.".format(id(asyncio.get_event_loop()))
)
Expand All @@ -49,7 +50,7 @@ def enable_async_loop_debugging(event_loop: AbstractEventLoop) -> AbstractEventL

# Make the threshold for "slow" tasks very very small for
# illustration. The default is 0.1 (= 100 milliseconds).
event_loop.slow_callback_duration = 0.001
event_loop.slow_callback_duration = slow_callback_duration

# Report all mistakes managing asynchronous resources.
warnings.simplefilter("always", ResourceWarning)
Expand Down
3 changes: 2 additions & 1 deletion tests/core/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
def loop():
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop = rasa.utils.io.enable_async_loop_debugging(loop)
loop = rasa.utils.io.enable_async_loop_debugging(loop,
slow_callback_duration=0.1)
yield loop
loop.close()

Expand Down

0 comments on commit 920588e

Please sign in to comment.