Skip to content
This repository has been archived by the owner on Jul 28, 2020. It is now read-only.

Raise exception if a Task is trying to send an Event that is not declared in zenaton_boot.py #35

Closed
florianjourda opened this issue Jun 26, 2019 · 5 comments

Comments

@florianjourda
Copy link

Issue: in a task, I am sending an event MyEvent, but I forgot to import MyEvent in zenaton_boot.py. It seems that then Zenaton created a event from a new class 'workflow.MyEvent' on the fly instead of using 'my_module.my_workflow.MyEvent', making logic like isinstanceof(event, MyEvent) not working in the rest of my code downstream.

Solution:

  • quick: Raise an exception when trying to create an event whose class is not imported in zenaton_boot.py explaining that I need to add the import
  • better: have a different system for imports in zenaton_boot.py, like telling Zenaton to import all Zenaton objects in a tree (ìmport my_workflows`=> would also import everything under)
@florianjourda
Copy link
Author

@pcorpet

@pcorpet
Copy link
Contributor

pcorpet commented Jun 26, 2019

It should work without having it in boot. See https://github.com/zenaton/zenaton-python/blob/master/zenaton/services/serializer.py#L216

The trouble is that it's reloaded from your workflow file but under a different python module workflow.MyEvent.

pcorpet added a commit to pcorpet/zenaton-python that referenced this issue Jun 26, 2019
@geomagilles
Copy link
Contributor

@florianjourda can you confirm it's fixed with last version of Agent ans SDK (0.3.4), please?

@pcorpet
Copy link
Contributor

pcorpet commented Jul 1, 2019

Yep I confirm it's fixed.

@geomagilles
Copy link
Contributor

thx!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants