-
Notifications
You must be signed in to change notification settings - Fork 142
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: 修复在其他文件中使用publish发布任务并指定task_id时获取task_id报错 #110
Closed
Closed
Conversation
This file contains 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
还是要发下报错截图呢,因为你在 f'10秒内推送了 {self.count_per_minute} 条消息,累计推送了 {self.publish_msg_num_total} 条消息到 {self._queue_name} 队列中') 这里加taskid是不适合的,这个地方使用过统计,没有和某条任务消息关联. |
funboost版本: 43.0 生产者 async def restart_data_annotation_task(
task_id: str = Body(),
app_id: str = Body(),
begin_time: str = Body(),
end_time: str = Body(),
wait_annotation_num: int = Body(),
startup_mode: str = Body(),
):
data_annotation_consumer.data_annotation.publish(
{
"app_id": app_id,
"start_time": begin_time,
"end_time": end_time,
"wait_annotation_num": wait_annotation_num,
"startup_mode": "full" if startup_mode == "0" else "increment",
},
task_id=task_id,
) 消费者 @boost(
BoosterParams(
queue_name="queue_data_annotation",
qps=10,
broker_kind=BrokerEnum.REDIS_STREAM,
concurrent_mode=ConcurrentModeEnum.ASYNC,
is_using_distributed_frequency_control=True,
user_custom_record_process_info_func=save_to_postgresql,
)
)
async def data_annotation(
app_id,
start_time,
end_time,
wait_annotation_num,
startup_mode="full",
):
task_id = funboost_current_task().task_id 报错信息:
|
你把这个 funboost/core/current_task.py 的改成
就是这行 except (AttributeError,LookupError) as e: 增加 LookupError 试试. |
这样可以,不报错了,感谢指点 |
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.
在非消费函数的文件中使用publish方法发布任务时,使用的TaskIdLoggger由于无法通过get_current_taskid()获取到task_id报错