免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2601 | 回复: 1
打印 上一主题 下一主题

关于 fabric 并行执行任务求助 [复制链接]

论坛徽章:
1
数据库技术版块每日发帖之星
日期:2016-04-24 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2016-04-25 14:17 |只看该作者 |倒序浏览
如下,我想使用 fabric 在多台机器上并行执行下面的 test_task 任务(Windows上运行该脚本),我在前面加上了 @parallel(pool_size=5) ,但是会报下面的错误,不知道是那边的问题,还请帮忙看下的,多谢
  
  
from fabric.api import *
  
env.hosts=[
         'builder@10.0.1.88:22',
         'builder@10.0.1.80:22',
         'builder@10.0.1.57:22',
         'builder@10.0.1.58:22',
         'builder@10.0.1.59:22',
           ]      
            
            
env.password = 'xxxxxx'
  
@parallel(pool_size=5)
def test_task():
     space_info = run('df -h | grep space')
  
  
  
  
报错如下:
  
[builder@10.0.1.88:22] Executing task 'update_setting_remote'
[builder@10.0.1.80:22] Executing task 'update_setting_remote'
[builder@10.0.1.57:22] Executing task 'update_setting_remote'
[builder@10.0.1.58:22] Executing task 'update_setting_remote'
[builder@10.0.1.59:22] Executing task 'update_setting_remote'
Traceback (most recent call last):
   File "C:\Python27\lib\site-packages\fabric\main.py", line 745, in main
     *args, **kwargs
   File "C:\Python27\lib\site-packages\fabric\tasks.py", line 412, in execute
     ran_jobs = jobs.run()
   File "C:\Python27\lib\site-packages\fabric\job_queue.py", line 137, in run
     _advance_the_queue()
   File "C:\Python27\lib\site-packages\fabric\job_queue.py", line 122, in _advance_the_queue
     job.start()
   File "C:\Python27\lib\multiprocessing\process.py", line 130, in start
     self._popen = Popen(self)
   File "C:\Python27\lib\multiprocessing\forking.py", line 277, in __init__
     dump(process_obj, to_child, HIGHEST_PROTOCOL)
   File "C:\Python27\lib\multiprocessing\forking.py", line 199, in dump
     ForkingPickler(file, protocol).dump(obj)
   File "C:\Python27\lib\pickle.py", line 224, in dump
     self.save(obj)
   File "C:\Python27\lib\pickle.py", line 331, in save
     self.save_reduce(obj=obj, *rv)
   File "C:\Python27\lib\pickle.py", line 419, in save_reduce
     save(state)
   File "C:\Python27\lib\pickle.py", line 286, in save
     f(self, obj) # Call unbound method with explicit self
   File "C:\Python27\lib\pickle.py", line 649, in save_dict
     self._batch_setitems(obj.iteritems())
   File "C:\Python27\lib\pickle.py", line 681, in _batch_setitems
     save(v)
   File "C:\Python27\lib\pickle.py", line 286, in save
     f(self, obj) # Call unbound method with explicit self
   File "C:\Python27\lib\pickle.py", line 748, in save_global
     (obj, module, name))
pickle.PicklingError: Can't pickle <function inner at 0x01FDD1F0>: it's not found as fabric.tasks.inner
Traceback (most recent call last):
   File "<string>", line 1, in <module>
   File "C:\Python27\lib\multiprocessing\forking.py", line 380, in main
     prepare(preparation_data)
   File "C:\Python27\lib\multiprocessing\forking.py", line 488, in prepare
     assert main_name not in sys.modules, main_name
AssertionError: __main__

论坛徽章:
1
数据库技术版块每日发帖之星
日期:2016-04-24 06:20:00
2 [报告]
发表于 2016-04-25 15:14 |只看该作者
查了下,windows下运行的已知问题。。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP