python - Using fabric to run parallel task -
i want use fabric lib run parallel task via ssh , , defined script following(running on windows) :
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')
but when run script , return following errors , can body me what's wrong ? many thanks~
[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 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 explicit self file "c:\python27\lib\pickle.py", line 748, in save_global (obj, module, name)) pickle.picklingerror: can't pickle <function inner @ 0x01fdd1f0>: it's not found 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__
Comments
Post a Comment