Mercurial > code > home > repos > homeauto
annotate service/arduinoNode/tasks.py @ 1424:458355ee1b99
arduinonode: per-device-type timing stats
Ignore-this: de560ed6044cef5dacbf5d9b6334df99
darcs-hash:c0164f22d20b5673d1f42ffa4462ef4ed87b608d
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Wed, 07 Aug 2019 20:55:00 -0700 |
parents | ba56263fe3b2 |
children | c3c2418d138c |
rev | line source |
---|---|
1423 | 1 from invoke import task |
2 | |
3 JOB = 'arduinoNode' | |
4 PORT = 9059 | |
5 TAG = f'bang6:5000/{JOB.lower()}:latest' | |
6 ANSIBLE_TAG = JOB | |
7 | |
8 @task | |
9 def build_image(ctx): | |
10 ctx.run(f'docker build -t {TAG} .') | |
11 | |
12 @task(pre=[build_image]) | |
13 def push_image(ctx): | |
14 ctx.run(f'docker push {TAG}') | |
15 | |
16 @task(pre=[build_image]) | |
17 def shell(ctx): | |
18 ctx.run(f'docker run --name={JOB}_shell --rm -it --cap-add SYS_PTRACE --net=host --device=/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A900cepU-if00-port0 -v `pwd`/config:/opt/config {TAG} /bin/bash', pty=True) | |
19 | |
20 @task(pre=[build_image]) | |
21 def local_run(ctx): | |
22 ctx.run(f'docker run --name={JOB}_local --rm -it -p 9059:9059 --device=/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A900cepU-if00-port0 --net=host --dns 10.2.0.1 --dns-search bigasterisk.com {TAG} python ./arduinoNode.py -v', pty=True) | |
23 | |
24 @task | |
25 def push_config(ctx): | |
26 ctx.run(f'docker run --rm --net=host -v `pwd`/config:/opt/config bang6:5000/arduino_node python pushConfig.py arduino/') | |
27 | |
28 @task(pre=[push_image]) | |
29 def redeploy(ctx): | |
30 ctx.run(f'sudo /my/proj/ansible/playbook -l bang -t {ANSIBLE_TAG}') | |
31 | |
32 @task | |
33 def lightsout(ctx): | |
34 ctx.run(rf'curl http://bang:9059/output\?s\=http://projects.bigasterisk.com/room/speakersStrips\&p\=http://projects.bigasterisk.com/room/x -XPUT -v -d 199') | |
1424
458355ee1b99
arduinonode: per-device-type timing stats
drewp <drewp@bigasterisk.com>
parents:
1423
diff
changeset
|
35 |
458355ee1b99
arduinonode: per-device-type timing stats
drewp <drewp@bigasterisk.com>
parents:
1423
diff
changeset
|
36 @task |
458355ee1b99
arduinonode: per-device-type timing stats
drewp <drewp@bigasterisk.com>
parents:
1423
diff
changeset
|
37 def lightstest(ctx): |
458355ee1b99
arduinonode: per-device-type timing stats
drewp <drewp@bigasterisk.com>
parents:
1423
diff
changeset
|
38 ctx.run(rf'curl http://bang:9059/output\?s\=http://projects.bigasterisk.com/room/speakersStrips\&p\=http://projects.bigasterisk.com/room/x -XPUT -v -d 100; sleep 3; curl http://bang:9059/output\?s\=http://projects.bigasterisk.com/room/speakersStrips\&p\=http://projects.bigasterisk.com/room/x -XPUT -v -d 199') |