runner.py

runner.py Run, Attach, Schedule, Repeat, Chain and React to commands.


Keywords
runner, process, asyncio, python, python3
License
MIT
Install
pip install runner.py==0.5

Documentation

runner.py Run, Attach, Schedule, Repeat, Chain and React to commands.

https://travis-ci.org/mariocesar/run.py.svg?branch=master

Install and Use

Install with pip.

pip install runner.py

A simple example on how to use it.

import asyncio

from runnerpy.runner import Runner

if __name__ == '__main__':
    loop = asyncio.get_event_loop()

    runner = Runner(loop)
    runner.run('python manage.py runserver')
    runner.run('celery -A project worker -l INFO')

    runner.start()

Now a Django app will run along the celery worker. Hit ctrl+c to stop both.

Some examples:

import asyncio

from runnerpy.runner import Runner

if __name__ == '__main__':
    loop = asyncio.get_event_loop()

    runner = Runner(loop)
    runner.run('cp -ar dist/static public/static')
    runner.run('pg_dump --all')

    runner.start()

Follow updates in log, stop when apt update finish

import asyncio

from runnerpy.runner import Runner

if __name__ == '__main__':
    loop = asyncio.get_event_loop()

    runner = Runner(loop)
    runner.run('sudo apt update', essential=True)
    runner.run('tail -f /var/log/syslog)

    runner.start()