Conversation
Avoid writing 'from bisheng. worker import bisheng_celery' that depends on submodules
我发现worker的task中存在比较多如下写法: ```python from bisheng.worker import bisheng_celery ``` 目前这种写法依赖task中存在`from bisheng.worker.main import bisheng_celery`的写法,而`bisheng/worker/__init__.py`中将所有task注册导致目前的写法正常。 目前,如果我将`bisheng/worker/test/test.py`和`bisheng/worker/workflow/tasks.py`中`from bisheng.worker.main import bisheng_celery`的写法注释掉,则task中的import bisheng_celery将会报错,例如file_worker中的代码显示: <img width="641" height="132" alt="image" src="https://github.com/user-attachments/assets/e2f54037-3eb8-4076-b688-7f5fead82ae4" /> 这是一种看起来比较奇怪的现象:`workflow/tasks.py`和`test/test.py`的import影响了`knowledge/file_worker.py`,究其原因是因为`bisheng/worker/__init__.py`中将所有task注册导致表现正常,我认为更合理的做法应该是将`from bisheng.worker.main import bisheng_celery`加到我修改地方,保证`from bisheng.worker import bisheng_celery`的写法正常
# Conflicts: # src/backend/bisheng/worker/knowledge/rebuild_knowledge_worker.py
…o feat/2.3.0-beta1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.