view service/wifi/tasks.py @ 605:ad4c4d7c1fb9

reasoning output using treq, and keep writing to PUT calls forever (but not as fast as the reasoning loop runs) Ignore-this: 1633b16dc315082f759041d42e848ced
author drewp@bigasterisk.com
date Tue, 23 Jul 2019 17:30:46 -0700
parents d0830394bf7b
children 540dd68af9f2
line wrap: on
line source

from invoke import task

JOB = 'wifi'
PORT = 9070
TAG = f'bang6:5000/{JOB}_x86:latest'

@task
def build_image(ctx):
    ctx.run(f'docker build --network=host -t {TAG} .')

@task(pre=[build_image])
def push_image(ctx):
    ctx.run(f'docker push {TAG}')

@task(pre=[build_image])
def shell(ctx):
    ctx.run(f'docker run --name {JOB}_shell --rm -it --cap-add SYS_PTRACE --net=host {TAG} /bin/bash', pty=True)

@task(pre=[build_image])
def local_run(ctx):
    ctx.run(f'docker run --name {JOB}_local --rm -it --net=host {TAG} python3 wifi.py -v', pty=True)

@task(pre=[push_image])
def redeploy(ctx):
    ctx.run(f'supervisorctl -s http://bang:9001/ restart {JOB}_{PORT}')