# -*- coding: utf-8 -*-
from nuka.task import Task
class mytask(Task):
def do(self):
res = self.sh(['ls', '/var'])
return dict(res, changed=1)
def diff(self):
res = self.sh(['ls', '/var'])
diff=self.texts_diff('', res['stdout'])
return dict(res, diff=diff)
#!bin/python
import nuka
from nuka.hosts import DockerContainer
from tasks import mytask
async def do_tasks(host):
res = await mytask()
print(res.stdout)
nuka.run(do_tasks(DockerContainer('pyconfr')))
$ pip install nuka
$ pip install nuka[full]
$ pip install \
-e git+git@github.com:bearstech/nuka.git#egg=nuka[full]
$ python do_task.py -h
% ./list_hosts | ./benches.py -q -d .01
Got 296 valid results for 296 hosts in 15.19s
min max avg count
connect 0.000009 0.000057 0.000012 296
auth_time 0.185978 9.049197 7.170807 296
timeouts 0.000000 0.000000 0.000000 296