惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
G
Google Developers Blog
Spread Privacy
Spread Privacy
I
InfoQ
V
V2EX
S
Schneier on Security
小众软件
小众软件
C
CERT Recently Published Vulnerability Notes
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Stack Overflow Blog
Stack Overflow Blog
T
Threat Research - Cisco Blogs
L
Lohrmann on Cybersecurity
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Attack and Defense Labs
Attack and Defense Labs
云风的 BLOG
云风的 BLOG
The Hacker News
The Hacker News
S
SegmentFault 最新的问题
C
Cybersecurity and Infrastructure Security Agency CISA
NISL@THU
NISL@THU
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
Latest news
Latest news
S
Secure Thoughts
Project Zero
Project Zero
MongoDB | Blog
MongoDB | Blog
I
Intezer
Security Latest
Security Latest
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
N
Netflix TechBlog - Medium
V2EX - 技术
V2EX - 技术
量子位
T
Threatpost
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog
T
Tor Project blog
A
Arctic Wolf
Microsoft Security Blog
Microsoft Security Blog
T
The Exploit Database - CXSecurity.com
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
C
Check Point Blog
博客园 - Franky
Google DeepMind News
Google DeepMind News
The Register - Security
The Register - Security
The GitHub Blog
The GitHub Blog
L
LINUX DO - 热门话题

博客园 - 岌岌可危

免费的打印管理软件easyjen 书籍链接 CrowdStrike引起的一次失败又成功的故障恢复 简单四则运算器 作业之打印金字塔 方差计算,使用类和常规方式 python作业 简单java servlet的登录脚本,部署到docker 如何在Windows Server 2016上重置用户“管理员”的密码 sublimeCodeIntel在windows下安装的坑 python pip安装失败 如何创建和编译动态链接库并且在另一应用程序中调用它。 Visual Studio2019 cannot open source Django创建模型。 Django创建视图 Django创建项目和应用 无Admin权限安装python 嵌入版本和PIP,并安装Django python,Django安装在windows上 一段代码实现RPC DCOM和RPC,两者的认证过程有什么区别?
huey在windows下使用的坑
岌岌可危 · 2022-09-26 · via 博客园 - 岌岌可危

在windows上使用huey会有坑如下。

redis,phthon环境已经安装好。

安装好huey后,使用如下实例:

1.demo.py 任务worker文件,简单的加法

from config import huey

@huey.task()
def add(a, b):
return a + b

2.直接运行worker

python huey_consumer.py -w 1 -k process demo.huey

使用process模型就会报错

C:\Users\prokher\Desktop\HueyTest>huey_consumer.py -w 1 -k process main.huey
[2017-03-11 00:30:20,280] INFO:huey.consumer:2688:Huey consumer started with 1 process, PID 2688
[2017-03-11 00:30:20,280] INFO:huey.consumer:2688:Scheduler runs every 1 seconds.
[2017-03-11 00:30:20,280] INFO:huey.consumer:2688:Periodic tasks are enabled.
[2017-03-11 00:30:20,295] INFO:huey.consumer:2688:The following commands are available:
+ count_beans
Traceback (most recent call last):
  File "C:\Program Files\Python36\Scripts\huey_consumer.py", line 49, in <module>
    consumer_main()
  File "C:\Program Files\Python36\Scripts\huey_consumer.py", line 45, in consumer_main
    consumer.run()
  File "c:\program files\python36\lib\site-packages\huey\consumer.py", line 439, in run
    self.start()
  File "c:\program files\python36\lib\site-packages\huey\consumer.py", line 430, in start
    self.scheduler.start()
  File "c:\program files\python36\lib\multiprocessing\process.py", line 105, in start
    self._popen = self._Popen(self)
  File "c:\program files\python36\lib\multiprocessing\context.py", line 223, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "c:\program files\python36\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "c:\program files\python36\lib\multiprocessing\popen_spawn_win32.py", line 65, in __init__
    reduction.dump(process_obj, to_child)
  File "c:\program files\python36\lib\multiprocessing\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'Consumer._create_process.<locals>._run'

C:\Users\prokher\Desktop\HueyTest>Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\program files\python36\lib\multiprocessing\spawn.py", line 99, in spawn_main
    new_handle = reduction.steal_handle(parent_pid, pipe_handle)
  File "c:\program files\python36\lib\multiprocessing\reduction.py", line 82, in steal_handle
    _winapi.PROCESS_DUP_HANDLE, False, source_pid)
OSError: [WinError 87] The parameter is incorrect
3. git上已经有报告
https://github.com/coleifer/huey/issues/208

4.如果使用thread方式则没有问题

python huey_consumer.py -w 2 -k thread demo.huey