V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
V2EX  ›  fanhaipeng0403  ›  全部回复第 18 页 / 共 33 页
回复总数  641
1 ... 14  15  16  17  18  19  20  21  22  23 ... 33  
2019 年 1 月 4 日
回复了 zhangqilin 创建的主题 职场话题 后端工作 1 年 2 个月感慨
@liprais 不大么~
SEO:
深圳市成为智能交通系统有限公司 怎么样
深圳市成为智能交通系统有限公司 薪资待遇
深圳市成为智能交通系统有限公司 拖欠工资
深圳市成为智能交通系统有限公司 好不好
深圳市成为智能交通系统有限公司 无赖公司
深圳市成为智能交通系统有限公司 招聘信息
深圳市成为智能交通系统有限公司 信用怎么样
深圳市成为智能交通系统有限公司 企业架构
深圳市成为智能交通系统有限公司 公司氛围
深圳市成为智能交通系统有限公司 福利
深圳市成为智能交通系统有限公司 产品介绍
深圳市成为智能交通系统有限公司 企业咨询
深圳市成为智能交通系统有限公司 产品口碑
2019 年 1 月 3 日
回复了 fanhaipeng0403 创建的主题 Python 分享个 celery 的监控脚本吧
@zhoudaiyu 看了~我最近也要处理这个事情~
db.session.close()

每次都关掉,绝对会解决
2019 年 1 月 3 日
回复了 0x11901 创建的主题 职场话题 关于自身技术发展的疑惑?
和我想的差不多·~
2019 年 1 月 3 日
回复了 hauzi 创建的主题 程序员 各位大佬写代码的时候一般戴耳机么?听些什么呢?
2019 年 1 月 3 日
回复了 YuuuZeee 创建的主题 Python Celery 可以启动多个线程嘛=-=
import asyncio

async def slow_operation(n):
await asyncio.sleep(n)
print('Slow operation {} complete'.format(n))
return n


loop = asyncio.get_event_loop()
done, _ = loop.run_until_complete(
asyncio.wait([
slow_operation(1),
slow_operation(2),
slow_operation(9),
slow_operation(2),
slow_operation(1),
slow_operation(2),
slow_operation(3),
]))
for fut in done:
print("return value is {}".format(fut.result()))

然后用 uvloop
2019 年 1 月 3 日
回复了 YuuuZeee 创建的主题 Python Celery 可以启动多个线程嘛=-=
y worker -A app.tasks.celery -l INFO -Q default -c 20 (每个队列多搞几个 worker ) -n default_worker.%%i
2019 年 1 月 3 日
回复了 YuuuZeee 创建的主题 Python Celery 可以启动多个线程嘛=-=
from time import sleep
from concurrent.futures import ThreadPoolExecutor\ ProcessPoolExecutor
def child_1():
sleep(9)
print(1)


def child_2():
sleep(2)
print(2)



def child_3():
sleep(3)
print(3)



def child_4():
sleep(1)
print(4)


def child_5():
sleep(2)
print(5)



with ThreadPoolExecutor\ProcessPoolExecutor(max_workers=5) as executor:
executor.submit(child_1)
executor.submit(child_2)
executor.submit(child_3)
executor.submit(child_4)
executor.submit(child_5)


t1= executor.submit(child_1)
t2=executor.submit(child_2)
t3=executor.submit(child_3)
t4=executor.submit(child_4)
t5=executor.submit(child_5)

print(t1.result())
2019 年 1 月 3 日
回复了 0x8192dd 创建的主题 Android 发现很多人不理解各大渠道强制要求适配 API26+的意义
作死的头像
2019 年 1 月 3 日
回复了 hahiru 创建的主题 职场话题 我再帮同事开发办公软件我就是狗。
销售 副业 写代码 ??? 6666
引起不适,block
2019 年 1 月 2 日
回复了 karnaugh 创建的主题 程序员 大家对这种印着 api 的超大鼠标垫有兴趣么
有毛用,看还不如 google 快
2019 年 1 月 2 日
回复了 babywhisper 创建的主题 程序员 😍发现一个持续部署的好东西: Buddy
mark
2019 年 1 月 1 日
回复了 zhoudaiyu 创建的主题 Python 问个问题,关于 Celery 的 worker 和 beat
@zhoudaiyu

可以使用 celery 提供的信号接口,监测每个任务的执行时间,然后发给 statsd 或者 promethus 之类的

https://github.com/getredash/redash/blob/master/redash/metrics/celery.py

这个是代码例子
2019 年 1 月 1 日
回复了 babywhisper 创建的主题 程序员 😍发现一个持续部署的好东西: Buddy
@mercury233 捞一波是一波
2019 年 1 月 1 日
回复了 babywhisper 创建的主题 程序员 😍发现一个持续部署的好东西: Buddy
插眼
2018 年 12 月 31 日
回复了 fanhaipeng0403 创建的主题 Python 问大家一个关于 async 和 await 的问题, 新年快乐~
In [1]: import asyncio
...:
...: try:
...: # pylint: disable=invalid-name
...: asyncio_run = asyncio.run # type: ignore
...: except AttributeError:
...:
...: def asyncio_run(main, debug=False):
...: """Minimal re-implementation of asyncio.run (since 3.7)."""
...: loop = asyncio.new_event_loop()
...: asyncio.set_event_loop(loop)
...: loop.set_debug(debug)
...: try:
...: return loop.run_until_complete(main)
...: finally:
...: asyncio.set_event_loop(None)
...: loop.close()
...:
...: async def slow_operation_1(m):
...: await asyncio.sleep(m)
...: print('Slow operation {} complete'.format(m))
...: return m
...:
...:
...:
...: async def slow_operation_2(n):
...: await asyncio.sleep(n)
...: print('Slow operation {} complete'.format(n))
...:
...: return await slow_operation_1(m=n+1)
...:
...: result = asyncio_run(slow_operation_2(2))
...:
...: print(result)
...:

Slow operation 2 complete
Slow operation 3 complete
3
2018 年 12 月 29 日
回复了 zhoudaiyu 创建的主题 Python 问个问题,关于 Celery 的 worker 和 beat
RabbitMQ is feature-complete, stable, durable and easy to install. It ’ s an excellent choice for a production environment.

官方文档推荐的~
@zhoudaiyu
2018 年 12 月 29 日
回复了 zhoudaiyu 创建的主题 Python 问个问题,关于 Celery 的 worker 和 beat
建议用 rabittmq。
还算稳定,分享下我的配置



CELERY_IGNORE_RESULT = True
CELERY_BROKER_URL = '‘ xxxx ’
CELERY_TIMEZONE = 'xxx'
CELERY_DEFAULT_QUEUE = 'default'
CELERY_CREATE_MISSING_QUEUES = 'default'

BROKER_HEARTBEAT = 24*60*60*2

CELERY_ENABLE_UTC = False
CELERY_DISABLE_RATE_LIMITS = True
CELERYD_MAX_TASKS_PER_CHILD = 10
BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 1800}
CELERYD_FORCE_EXECV = True
BROKER_POOL_LIMIT = None
1 ... 14  15  16  17  18  19  20  21  22  23 ... 33  
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2728 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 26ms · UTC 12:04 · PVG 20:04 · LAX 05:04 · JFK 08:04
♥ Do have faith in what you're doing.