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

Engine and BambooDjangoRuntime ProcessMixin are confusing #110

Open
Randix6644 opened this issue Aug 12, 2022 · 0 comments
Open

Engine and BambooDjangoRuntime ProcessMixin are confusing #110

Randix6644 opened this issue Aug 12, 2022 · 0 comments

Comments

@Randix6644
Copy link

Randix6644 commented Aug 12, 2022

BambooDjangoRuntime的集合多个mixin
正常来说, 如果我想更改其中某一个功能, 例如Process的某些行为, 例如die 的方法, 我可以

class BambooDjangoRuntime(
    CustomProcessMixin,
)

或者

class CustomeRuntime(BambooDjangoRuntime):
    def die(self, process_id: int):
        do something()

但是经过测试这不符合预期。 因为我发现在pipeline/eri/celery/tasks.py 里面executeschedule 的方法里面:runtime = BambooDjangoRuntime() , runtime 是hardcode的, 即调用Engine(CustomeRuntime()).run_pipeline(pipeline) 时不会调用CustomeRuntime().die方法的。

文档没有特别说明, 另外一点是在自编写的component 里面, 如果在自定义组件的实例里面也无法保存属性, 只能通过data来传递。
因为每一次自定义component的schedule的调用都是一个新对象。

lastly, 能否将类似ProcessMixin或者一些其他类似的update 方法:e.g Process.objects.filter(id=process_id).update(suspended=True, suspended_by=by)
改为

obj = Process.get(id=process_id)
obj.suspended=True
obj.suspended_by = by
obj.save()

这用用户可以利用Django post_save的signal 去做一些自定义的行为。 例如我希望Process die的时候可以回调推送数据到websocket。

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

No branches or pull requests

1 participant