CloudVE / CloudVE/pyeventsystem
How to handle inheritance of dispatch
- Dominant language
- Python
- Stars
- 1
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Thank you for helping me.
What's the best practice to handle inheritance of dispatch?
I am trying to extend spot instance in google cloud. But when I am subclassing GCPInstanceService, I encounter such error :
`cloudbridge.interfaces.exceptions.CloudBridgeBaseException: CloudBridgeBaseException: Event 'provider.compute.instances.get' has multiple subscribed handlers at priority '2500', with function names [get, get]. Each priority must only have a single corresponding handler. from exception type:
`
The code I am writing:
`class GCPInstanceServiceEx(GCPInstanceService):
def __init__(self, provider):
super(GCPInstanceServiceEx, self).__init__(provider)
@dispatch(event="provider.compute.instances_ex.create",
priority=BaseInstanceService.STANDARD_EVENT_PRIORITY)
def create(self, label, image, vm_type, subnet,
key_pair=None, vm_firewalls=None, user_data=None,
launch_config=None, custom_labels=None, spot=False, **kwargs):
`
I only overwrite the create function, but it looks like the get function in GCPInstanceService got registered twice?
How could I avoid such exception except removing the dispatch in parent class or explicit overwrite all the fuc in parent class?
Is it possible to close the pyeventsystem middleware in production ?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.