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

fix/abstract app init #130

Merged
merged 6 commits into from
Sep 19, 2023
Merged

fix/abstract app init #130

merged 6 commits into from
Sep 19, 2023

Conversation

JarbasAl
Copy link
Member

@JarbasAl JarbasAl commented Sep 12, 2023

skill_id and bus are now handled in super() , the call to self._startup should not be done anymore

makes OVOSSkill a subclass of BaseSkill and marks MycroftSkill for deprecation

the metaclass override of __call__ is problematic for OVOSAbstractApps such as PHAL*, OCP, Persona and CommonIOT, it is also only there as a compat layer for classic mycroft skills, we avoid the issue by only applying that to the MycroftSkill class itself but not to OVOSSkill (since it's no longer a subclass of MycroftSkill)

* PHAL error logs in comments below, fixed by not subclassing anymore from OVOSAbstractApp

@JarbasAl JarbasAl added the bug Something isn't working label Sep 12, 2023
@JarbasAl JarbasAl requested a review from a team September 12, 2023 16:46
skill_id and bus are now handled in super() , the call to self._startup should not be done anymore
@JarbasAl JarbasAl changed the title feat/sounds_playback in ovos-audio fix/abstract app init Sep 12, 2023
@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

❗ No coverage uploaded for pull request base (dev@e8540c0). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@          Coverage Diff           @@
##             dev     #130   +/-   ##
======================================
  Coverage       ?   58.96%           
======================================
  Files          ?       33           
  Lines          ?     3251           
  Branches       ?        0           
======================================
  Hits           ?     1917           
  Misses         ?     1334           
  Partials       ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Ramblurr
Copy link

Ramblurr commented Sep 12, 2023

This PR doesn't fix the problem.. the bus is still reinitialized.. here is a stacktrace with this pr running (printed inside the bus client's ctor)


File "/home/ovos/.venv/bin/hivemind-voice-sat", line 8, in <module>
  sys.exit(connect())
File "/home/ovos/.venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
  return self.main(*args, **kwargs)
File "/home/ovos/.venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
  rv = self.invoke(ctx)
File "/home/ovos/.venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
  return ctx.invoke(self.callback, **ctx.params)
File "/home/ovos/.venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
  return __callback(*args, **kwargs)
File "/home/ovos/.venv/lib/python3.11/site-packages/hivemind_voice_satellite/__main__.py", line 44, in connect
  phal = PHAL(bus=bus)
File "/home/ovos/.venv/lib/python3.11/site-packages/ovos_workshop/skills/mycroft_skill.py", line 85, in __call__
  return super().__call__(*args, **kwargs)
File "/home/ovos/.venv/lib/python3.11/site-packages/ovos_PHAL/service.py", line 43, in __init__
  bus = MessageBusClient()
File "/home/ovos/.venv/lib/python3.11/site-packages/ovos_bus_client/client/client.py", line 48, in __init__
  traceback.print_stack()I

Somewhere inside the ctor inheritance chain the bus is being set to None (i think)

@Ramblurr
Copy link

More debugging with log statemetns

HiveMind-voice-sat - hivemind_voice_satellite.__main__:connect:45 - INFO - XXX VoiceSat initializing PHAL with bus=<hivemind_bus_client.client.HiveMessageBusClient object at 0x7f90f66b50>
HiveMind-voice-sat - ovos_workshop.skills.mycroft_skill:__call__:71 - INFO - XXX _SkillMetaclass ctor bus is inside kwargs and is None?=False
HiveMind-voice-sat - ovos_workshop.skills.mycroft_skill:__call__:73 - WARNING - skill_id should be a kwarg, please update PHAL
HiveMind-voice-sat - ovos_workshop.skills.mycroft_skill:__call__:87 - WARNING - skill initialized without bus!! this is legacy behaviour and requires you to call skill.bind(bus) or skill._startup(skill_id, bus)
bus will be required starting on ovos-core 0.1.0
HiveMind-voice-sat - ovos_PHAL.service:__init__:43 - INFO - XXX PHAL ctor bus_is_null=True
HiveMind-voice-sat - ovos_PHAL.service:__init__:45 - INFO - XXX PHAL ctor kwargs bus_is_null=True
HiveMind-voice-sat - ovos_PHAL.service:__init__:47 - WARNING - XXX PHAL CTOR IS MAKING BUS CLIENT

So between this line and this line bus is being set to None.

🤯

@JarbasAl
Copy link
Member Author

expectation is PHAL -> OVOSAbstractApp -> OVOSSkill -> metaclass -> MycroftSkill , and args/kwargs get passed along

in practice we get first the call to the metaclass with PHAL kwargs, and then the other init methods are called after that

metaclass -> PHAL -> OVOSAbstractApp -> OVOSSkill -> MycroftSkill

the metaclass is not working as desired, all OVOSAbstractApp will be broken i think, moving from __new__ to __call__ in a metaclass was not the right choice. @NeonDaniel any ideas? IMHO we should just drop MycroftSkill compat soon instead of trying more deep magic

@JarbasAl JarbasAl marked this pull request as draft September 12, 2023 18:12
@JarbasAl JarbasAl marked this pull request as ready for review September 19, 2023 20:00
@JarbasAl JarbasAl merged commit e659917 into dev Sep 19, 2023
9 checks passed
@JarbasAl JarbasAl deleted the fix/abstractapp_init branch September 19, 2023 20:09
This was referenced Dec 29, 2023
@github-actions github-actions bot mentioned this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants