Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document that ReminderScheduled doesn't work for certain channels #4340

Closed
zfallahnejad opened this issue Aug 28, 2019 · 13 comments
Closed

Document that ReminderScheduled doesn't work for certain channels #4340

zfallahnejad opened this issue Aug 28, 2019 · 13 comments
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework type:docs 📖 Improvements to the documenation. Adding missing pieces or improving existing ones.

Comments

@zfallahnejad
Copy link

zfallahnejad commented Aug 28, 2019

rasa 1.2.4
rasa-sdk 1.2.0
Python 3.6.5
Operating system: Ubuntu
I defined an action to reset the value of a couple of slots. These slots were filled by a form action (like restaurant_form). I want to reset these slots, two minutes after someone filled the form. I used ReminderScheduled to call my action. But nothing happened. Is there something wrong?

class ResetRestaurantSlots(Action):

    def name(self):
        return "action_reset_restaurant_slots"

    def run(self, dispatcher, tracker, domain):
        return [SlotSet("cuisine", None), SlotSet("num_people", None), SlotSet("outdoor_seating", None), SlotSet("preferences", None), SlotSet("feedback", None)]
def submit(
        self,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any],
    ) -> List[Dict]:
        """Define what the form has to do
            after all required slots are filled"""

        # utter submit template
        dispatcher.utter_template("utter_submit", tracker)
        return [ReminderScheduled('action_reset_restaurant_slots', datetime.now() + timedelta(minutes=2), kill_on_user_message=False)]
@zfallahnejad zfallahnejad added the type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors. label Aug 28, 2019
@sara-tagger
Copy link
Collaborator

Thanks for raising this issue, @tabergma will get back to you about it soon✨

Please also check out the docs and the forum in case your issue was raised there too 🤗

@tabergma
Copy link
Contributor

I could reproduce the issue with the formbot example.

The _schedule_reminders function (https://github.com/RasaHQ/rasa/blob/master/rasa/core/processor.py#L413) seems to correctly schedule the event, however, handle_reminder (https://github.com/RasaHQ/rasa/blob/master/rasa/core/processor.py#L241) is not called.

@tmbo tmbo added the area:rasa-oss 🎡 Anything related to the open source Rasa framework label Sep 10, 2019
@tabergma tabergma self-assigned this Sep 19, 2019
@tabergma
Copy link
Contributor

Setting the log level to debug for all libraries gives you the following output:

...
2019-09-19 17:44:22 WARNING  asyncio  - Executing <Handle <TaskWakeupMethWrapper object at 0x150f9c6d8> created at /Users/tabergma/.virtualenv/rasa/lib/python3.6/site-packages/aiohttp/helpers.py:656> took 18.421 seconds
2019-09-19 17:44:22 DEBUG    apscheduler.scheduler  - Looking for jobs to run
2019-09-19 17:44:22 INFO     apscheduler.scheduler  - Removed job 4e7e7d8c-daf4-11e9-a28c-acde48001122
2019-09-19 17:44:22 DEBUG    apscheduler.scheduler  - No jobs; waiting until a job is added
2019-09-19 17:44:22 WARNING  asyncio  - Executing <Handle functools.partial(<function AsyncIOScheduler.wakeup at 0x139083048>, <apscheduler.schedulers.asyncio.AsyncIOScheduler object at 0x1510e8588>) created at /Users/tabergma/.virtualenv/rasa/lib/python3.6/site-packages/apscheduler/schedulers/asyncio.py:21> took 0.001 seconds
Run time of job "action_reset_restaurant_slots__sender_id:default (trigger: date[2019-09-19 17:44:18 CEST], next run at: 2019-09-19 17:44:18 CEST)" was missed by 0:00:03.484885
2019-09-19 17:44:22 WARNING  asyncio  - Executing <Handle <TaskWakeupMethWrapper object at 0x1503cdd68> created at /Users/tabergma/.virtualenv/rasa/lib/python3.6/site-packages/sanic/server.py:770> took 0.001 seconds
...

This is after the ReminderScheduled should have been executed. The log indicates that the job execution was missed. The warning WARNING asyncio - Executing <Handle <TaskWakeupMethWrapper object at 0x150f9c6d8> created at /Users/tabergma/.virtualenv/rasa/lib/python3.6/site-packages/aiohttp/helpers.py:656> took 18.421 seconds can be found all over the logs. According to the web the event loop is blocked by long-running blocking (synchronous) code (https://stackoverflow.com/questions/47414080/aws-iot-python-sdk-and-asyncio/47415716#47415716).

@tabergma tabergma removed their assignment Sep 20, 2019
@JEM-Mosig
Copy link

Same issue on rasa init bot with minimal modifications. This feature is critical for Carbon Bot. I'll look into it today, but any help is welcome.

@JEM-Mosig JEM-Mosig self-assigned this Nov 6, 2019
@JEM-Mosig
Copy link

When I add the logger to the __scheduler, I get

Bot loaded. Type a message and press enter (use '/stop' to exit): 
Your input ->  hi                                                                                                                                                                                     
...
2019-11-06 13:15:46 DEBUG    rasa.core.processor  - Action 'action_set_reminder' ended with events '['BotUttered(text: Setting reminder to trigger at 2019-11-06T13:15:51.651269, data: {"elements": null, "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}, metadata: {})', 'ReminderScheduled(action: action_react_to_reminder, trigger_date: 2019-11-06 13:15:51.651269, name: 299b3288-008f-11ea-8922-acde48001122)']'
2019-11-06 13:15:46 INFO     rasa.core.jobs  - Scheduler started
2019-11-06 13:15:46 INFO     rasa.core.jobs  - Added job "action_react_to_reminder__sender_id:default" to job store "default"
...
2019-11-06 13:15:46 DEBUG    rasa.core.lock_store  - Deleted lock for conversation 'default'.
2019-11-06 13:15:46 DEBUG    rasa.core.jobs  - Looking for jobs to run
2019-11-06 13:15:46 DEBUG    rasa.core.jobs  - Next wakeup is due at 2019-11-06 13:15:51.651269+01:00 (in 4.948948 seconds)
2019-11-06 13:15:46 DEBUG    rasa.core.jobs  - Looking for jobs to run
2019-11-06 13:15:46 DEBUG    rasa.core.jobs  - Next wakeup is due at 2019-11-06 13:15:51.651269+01:00 (in 4.948672 seconds)
Setting reminder to trigger at 2019-11-06T13:15:51.651269
Your input ->                                             

and then nothing happens. As Tanja pointed out, there is probably something blocking the event loop.

@JEM-Mosig
Copy link

JEM-Mosig commented Nov 6, 2019

The problem seems to be the command line, because it works just fine within Rasa X, whereas if I run on rasa shell I get

Task exception was never retrieved
future: <Task finished coro=<configure_app.<locals>.run_cmdline_io() done, defined at /Users/johannes/rasa/rasa/rasa/core/run.py:123> exception=TimeoutError()>

after waiting for a bit for the reminder to trigger.

@wochinge
Copy link
Contributor

I think the problem is that reminders don't work for certain channels (same as for the external actions / intents)

@wochinge
Copy link
Contributor

Changing this to a docs issue then.

@wochinge wochinge added type:docs 📖 Improvements to the documenation. Adding missing pieces or improving existing ones. and removed type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors. labels Jan 23, 2020
@akelad akelad changed the title ReminderScheduled event not working Document that ReminderScheduled doesn't work for certain channels Feb 5, 2020
@JEM-Mosig
Copy link

Changing this to a docs issue then.

@wochinge If we only document that this doesn't work, how should people test reminders and external events if they also are not supposed to run rasa x on the command line? E.g. for the reminderbot demo? #5189 (comment)

@erohmensing
Copy link
Contributor

@JEM-Mosig are you handling documenting which channels don't work in your PR?

@wochinge
Copy link
Contributor

I mean their are plenty of other channels available where reminders work with, right?

@JEM-Mosig
Copy link

It is not clear to me how I could run rasa shell with another channel. At least there is nothing about that in the docs.

@wochinge
Copy link
Contributor

wochinge commented Mar 2, 2020

It is not clear to me how I could run rasa shell with another channel. At least there is nothing about that in the docs.

Not with rasa shell but with rasa run (rasa shell is just shorthand for rasa run --channel ...)

@akelad akelad closed this as completed Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework type:docs 📖 Improvements to the documenation. Adding missing pieces or improving existing ones.
Projects
None yet
Development

No branches or pull requests

8 participants