• 大小: 0.01M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-03-03
  • 语言: Python
  • 标签: gearman  worker管理  

资源简介

1.redis结构设置
  jcsworker_num: 5
  jcsworker_status:{pid:busy,pid:free}
  jcsworkerstop_flag:True/False


2.jcsworker_num从redis中读取

  执行过程中,状态上报,存到redis中 jcsworker_status:{pid:busy,pid:free}
 
  stop打破循环 
 

资源截图

代码片段和文件信息

#!/usr/bin/env python2.7 
import json
from gearman import GearmanClient
gearman_client = GearmanClient([‘127.0.0.1:4730‘])
param={“zxx“:“26““xxx“:“34“}
js=json.dumps(param)
gearman_request = gearman_client.submit_job(‘echo1‘js)
result_data = gearman_request.result
print result_data
                                                                                                                                                                                             
                                                                                                                                                                                             
                                                                                                                                                                                             
                                                                                                                                                 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-04-03 18:26  workermanager_v1\
     目录           0  2019-04-03 18:26  workermanager_v1\.idea\
     目录           0  2019-04-03 18:26  workermanager_v1\.idea\inspectionProfiles\
     文件         504  2018-11-08 02:16  workermanager_v1\.idea\inspectionProfiles\Project_Default.xml
     文件         197  2018-10-10 10:24  workermanager_v1\.idea\misc.xml
     文件         284  2018-10-10 10:24  workermanager_v1\.idea\modules.xml
     文件         188  2018-10-12 16:55  workermanager_v1\.idea\vcs.xml
     文件         455  2018-10-10 10:25  workermanager_v1\.idea\workermanager_v1.iml
     文件       10684  2018-11-08 02:16  workermanager_v1\.idea\workspace.xml
     目录           0  2019-04-03 18:26  workermanager_v1\workermanager\
     文件         261  2018-09-26 12:46  workermanager_v1\workermanager\README.md
     文件        1241  2018-09-26 12:46  workermanager_v1\workermanager\client.py
     文件        4586  2018-10-12 17:00  workermanager_v1\workermanager\mworker - single.py
     文件        5031  2018-10-11 21:13  workermanager_v1\workermanager\mworker.py
     文件         760  2018-09-26 12:46  workermanager_v1\workermanager\redisdb.py
     文件        6378  2018-10-11 21:00  workermanager_v1\workermanager\worker.py

评论

共有 条评论

相关资源