annotate service/piNode/tasks.py @ 710:94610b5263e4

add browser_test server for playing with /graph resource Ignore-this: 6112c234b93e0fb99ffe918a022e5a49
author drewp@bigasterisk.com
date Mon, 03 Feb 2020 23:45:15 -0800
parents accbbd521ecd
children a93fbf0d0daa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
552
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
1 from invoke import task
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
2
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
3 JOB = 'piNode'
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
4 PORT = 9059
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
5 TAG = f'bang6:5000/{JOB.lower()}_pi:latest'
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
6 ANSIBLE_TAG = 'raspi_io_node'
365
cb3738b1a15a pi_base moves to base image project
drewp@bigasterisk.com
parents: 347
diff changeset
7
552
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
8 @task
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
9 def build_image(ctx):
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
10 ctx.run(f'docker build --network=host -t {TAG} .')
338
f64e20d3407e RgbPixelsAnimation and docker build updates
drewp@bigasterisk.com
parents:
diff changeset
11
628
accbbd521ecd wip for pytype support and separate device run loops on piNode
drewp@bigasterisk.com
parents: 627
diff changeset
12 @task
accbbd521ecd wip for pytype support and separate device run loops on piNode
drewp@bigasterisk.com
parents: 627
diff changeset
13 def build_image_check(ctx):
accbbd521ecd wip for pytype support and separate device run loops on piNode
drewp@bigasterisk.com
parents: 627
diff changeset
14 ctx.run(f'docker build --network=host -f Dockerfile.check -t bang6:5000/pinode_check:latest .')
accbbd521ecd wip for pytype support and separate device run loops on piNode
drewp@bigasterisk.com
parents: 627
diff changeset
15
552
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
16 @task(pre=[build_image])
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
17 def push_image(ctx):
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
18 ctx.run(f'docker push {TAG}')
338
f64e20d3407e RgbPixelsAnimation and docker build updates
drewp@bigasterisk.com
parents:
diff changeset
19
552
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
20 @task(pre=[build_image])
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
21 def shell(ctx):
627
c3f0a98fa65d lib upgrades; fix a static http server path
drewp@bigasterisk.com
parents: 552
diff changeset
22 ctx.run(f'docker run --name={JOB}_shell --rm -it --cap-add SYS_PTRACE --net=host --uts=host --cap-add SYS_RAWIO --device /dev/mem --privileged {TAG} /bin/bash', pty=True)
347
97f5cbcac00b pi read config over etcd
drewp@bigasterisk.com
parents: 338
diff changeset
23
628
accbbd521ecd wip for pytype support and separate device run loops on piNode
drewp@bigasterisk.com
parents: 627
diff changeset
24 @task(pre=[build_image_check])
accbbd521ecd wip for pytype support and separate device run loops on piNode
drewp@bigasterisk.com
parents: 627
diff changeset
25 def check(ctx):
accbbd521ecd wip for pytype support and separate device run loops on piNode
drewp@bigasterisk.com
parents: 627
diff changeset
26 ctx.run(f'docker run --name={JOB}_check --rm -it -v `pwd`:/opt --net=host bang6:5000/pinode_check:latest pytype -d import-error mypkg/piNode.py', pty=True)
accbbd521ecd wip for pytype support and separate device run loops on piNode
drewp@bigasterisk.com
parents: 627
diff changeset
27
accbbd521ecd wip for pytype support and separate device run loops on piNode
drewp@bigasterisk.com
parents: 627
diff changeset
28 @task(pre=[build_image_check])
accbbd521ecd wip for pytype support and separate device run loops on piNode
drewp@bigasterisk.com
parents: 627
diff changeset
29 def check_shell(ctx):
accbbd521ecd wip for pytype support and separate device run loops on piNode
drewp@bigasterisk.com
parents: 627
diff changeset
30 ctx.run(f'docker run --name={JOB}_check --rm -it -v `pwd`:/opt --net=host bang6:5000/pinode_check:latest /bin/bash', pty=True)
accbbd521ecd wip for pytype support and separate device run loops on piNode
drewp@bigasterisk.com
parents: 627
diff changeset
31
347
97f5cbcac00b pi read config over etcd
drewp@bigasterisk.com
parents: 338
diff changeset
32
552
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
33 @task(pre=[build_image])
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
34 def local_run(ctx):
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
35 ctx.run(f'docker run --name={JOB}_local --rm -it {TAG} python ./piNode.py -v', pty=True)
466
1122016d16eb stats handler, events output fix, build updaets
drewp@bigasterisk.com
parents: 365
diff changeset
36
552
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
37 @task(pre=[push_image])
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
38 def redeploy(ctx):
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
39 ctx.run(f'sudo /my/proj/ansible/playbook -l pi -t {ANSIBLE_TAG}')
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
40
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
41 @task
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
42 def push_config(ctx):
98384c3ccd33 update build and deps to use invoke and to use new lib layout, plus more stats collection
drewp@bigasterisk.com
parents: 466
diff changeset
43 ctx.run(f'docker run --rm --net=host -v `pwd`/config:/opt/config bang6:5000/arduino_node python pushConfig.py pi/')