Skip to content
This repository was archived by the owner on Sep 8, 2024. It is now read-only.

Conversation

@forslund
Copy link
Collaborator

==== Tech Notes ====
A single thread handling scheduled events. The skills interact with this
using the self.schedule_event() self.schedule_repeating_event
self.update_event() and self.remove_event().

This is an improvement over scheduledSkill since each skill creates
their own Thread and has to handle storing/restoring scheduled events
between starts.

All pending events are stored in a json file at shutdown for future
sessions.

==== Documentation Notes ====
Needs to be documented

==== Protocol Notes ====
new messagebus event handlers:

  • mycroft.scheduler.schedule_event
  • mycroft.scheduler.remove_event
  • mycroft.scheduler.update_event

@penrods can you check so I touched all the parts you imagined.

@forslund forslund requested a review from penrods August 30, 2017 17:35
@forslund forslund force-pushed the feature/event_scheduler branch 3 times, most recently from bf19d95 to af60315 Compare August 30, 2017 17:46
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.6%) to 38.338% when pulling af60315 on forslund:feature/event_scheduler into 2e479dd on MycroftAI:dev.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.6%) to 38.338% when pulling af60315 on forslund:feature/event_scheduler into 2e479dd on MycroftAI:dev.

@forslund forslund added CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) type: feature labels Aug 30, 2017
Copy link
Contributor

@penrods penrods left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple minor nitpicks since I think this is gonna be a major API for people to use. Really close, I like it!


def schedule_event(self, handler, datetime, data={}, name=None):
"""
schedule a single event
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: Uppercase the first word in these descriptions

Args:
handler: method to be called
datetime: time for calling the handler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets write/doc it like this:
when (datetime): when the handler should be called
data (dict, optional): data to send when the handler is called
name (str, optional): friendly name for the event

So rename "datetime" to "when". Make sense?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nemas problemas, I'll copy this to the wiki as an example for future reference

Args:
handler: method to be called
datetime: time for calling the handler
frequency: time in sconds between calls
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above for frequency. Can it be a float or just int? Inquiring devs want to know.

====  Tech Notes ====
A single thread handling scheduled events. The skills interact with this
using the self.schedule_event() self.schedule_repeating_event
self.update_event() and self.remove_event().

This is an improvement over scheduledSkill since each skill creates
their own Thread and has to handle storing/restoring scheduled events
between starts.

All pending events are stored in a json file at shutdown for future
sessions.

====  Documentation Notes ====
Needs to be documented

==== Protocol Notes ====
new messagebus event handlers:
- mycroft.scheduler.schedule_event
- mycroft.scheduler.remove_event
- mycroft.scheduler.update_event
@forslund forslund force-pushed the feature/event_scheduler branch from af60315 to 7c7fb86 Compare September 1, 2017 20:51
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.6%) to 40.316% when pulling 7c7fb86 on forslund:feature/event_scheduler into 8420ec3 on MycroftAI:dev.

@forslund
Copy link
Collaborator Author

forslund commented Sep 1, 2017

Doc-strings updated

@penrods
Copy link
Contributor

penrods commented Sep 12, 2017

Argh, Codacy is right about the two default values data={}. Bad practice. Let's fix those real quick, just change the defaults to data=None, then add "if data=None: data={}". Good to teach the children well.

@forslund forslund force-pushed the feature/event_scheduler branch from 1319ba7 to 11f0544 Compare September 12, 2017 06:03
@forslund
Copy link
Collaborator Author

Yeah, deep down I know this but apparently I've gotten lazy. Good thing we got this bot now :)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.6%) to 40.232% when pulling 11f0544 on forslund:feature/event_scheduler into 5b31047 on MycroftAI:dev.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.6%) to 40.221% when pulling 11f0544 on forslund:feature/event_scheduler into 5b31047 on MycroftAI:dev.

@penrods penrods merged commit 5ddf125 into MycroftAI:dev Sep 12, 2017
@forslund forslund deleted the feature/event_scheduler branch June 7, 2018 07:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants