open-autonomy icon indicating copy to clipboard operation
open-autonomy copied to clipboard

Timeout assignment in SharedState

Open Karrenbelt opened this issue 3 years ago • 0 comments
trafficstars

It will better to not task a developer with assigning each timeout manually in the setup of the SharedState. We should abstract this away as this can happen completely automatically on instantiation.

spun from PR on keep3r associated Trello ticket

for event, default_seconds in ABCIApp.event_to_timeout.items():
    overwrite_seconds = getattr(self.context.params, str(event), None)
    # skill = ...  # <<< should really log this too
    if overwrite_seconds:
        timeouts_to_events[event] = overwrite_seconds
        logging.info(f"{event} using overwrite: {overwrite_seconds}")
    else:
        timeouts_to_events[event] = default_seconds
        logging.info(f"{event} using default: {default_seconds}")

can associate skill with event more clearly too

class Event(Enum):
    ...
    @property
    def skill_public_id(self):
        author, skill = some_func(self.__module__)
        return PublicId(author, skill)  # or import from `__init__.py` ...

Karrenbelt avatar Aug 05 '22 09:08 Karrenbelt