Mercurial > code > home > repos > homeauto
comparison service/reasoning/tasks.py @ 756:f3f667769aef
python 3! and some types and cleanups
Ignore-this: 3453a547ee745fa83668f36956c835cd
author | drewp@bigasterisk.com |
---|---|
date | Fri, 14 Feb 2020 00:07:23 -0800 |
parents | a93fbf0d0daa |
children |
comparison
equal
deleted
inserted
replaced
755:ffcad6bf9c57 | 756:f3f667769aef |
---|---|
1 from invoke import task | 1 from invoke import Collection, task |
2 import sys | |
3 sys.path.append('/my/proj/release') | |
4 from serv_tasks import serv_tasks | |
2 | 5 |
3 JOB='reasoning' | 6 ns = Collection() |
4 PORT=9071 | 7 serv_tasks(ns, 'serv.n3', 'reasoning') |
5 | 8 |
6 TAG=f'bang6:5000/{JOB}_x86:latest' | 9 @ns.add_task |
10 @task(pre=[ns['build']]) | |
11 def local_run_mock(ctx): | |
12 ctx.run(f'docker run --name reasoning_local_run_mock --rm -it -p 9071:9071 -v `pwd`:/opt --dns 10.2.0.1 --dns-search bigasterisk.com --net=host bang6:5000/reasoning:latest python3 reasoning.py -iro --mockoutput', pty=True) | |
7 | 13 |
8 @task | 14 @ns.add_task |
9 def build_image(ctx): | 15 @task(pre=[ns['build']]) |
10 ctx.run(f'docker build --network=host -t {TAG} .') | 16 def pytype(ctx): |
11 | 17 ctx.run(f'docker run ' |
12 @task(pre=[build_image]) | 18 f'--name reasoning_pytype ' |
13 def push_image(ctx): | 19 f'--rm -it ' |
14 ctx.run(f'docker push {TAG}') | 20 f'-v `pwd`:/opt ' |
15 | 21 f'--dns 10.2.0.1 ' |
16 @task | 22 f'--dns-search bigasterisk.com ' |
17 def shell(ctx): | 23 f'--net=host bang6:5000/reasoning:latest ' |
18 ctx.run(f'docker run --name {JOB}_shell --rm -it --cap-add SYS_PTRACE -v `pwd`:/mnt --dns 10.2.0.1 --dns-search bigasterisk.com --net=host {TAG} /bin/bash', pty=True) | 24 f'pytype --pythonpath /usr/local/lib/python3.6/dist-packages:. ' |
19 | 25 f'--jobs 4 ' |
20 @task(pre=[build_image]) | 26 f'actions.py ' |
21 def local_run(ctx): | 27 f'escapeoutputstatements.py ' |
22 ctx.run(f'docker run --name {JOB}_local --rm -it ' | 28 f'graphop.py ' |
23 f'-p {PORT}:{PORT} ' | 29 f'httpputoutputs.py ' |
24 f'-v `pwd`:/mnt ' | 30 f'inference.py ' |
25 f'-v `pwd`/index.html:/opt/index.html ' | 31 f'inputgraph.py ' |
26 f'--dns 10.2.0.1 --dns-search bigasterisk.com ' | 32 f'private_ipv6_addresses.py ' |
27 f'--net=host ' | 33 f'rdflibtrig.py ' |
28 f'{TAG} ' | 34 f'reasoning.py', pty=True) |
29 f'python /mnt/{JOB}.py -iro', pty=True) | |
30 | |
31 @task(pre=[build_image]) | |
32 def local_run_mock(ctx): | |
33 ctx.run(f'docker run --name {JOB}_local_run_mock --rm -it -p {PORT}:{PORT} -v `pwd`:/mnt --dns 10.2.0.1 --dns-search bigasterisk.com --net=host {TAG} python /mnt/{JOB}.py -iro --mockoutput', pty=True) | |
34 | |
35 @task(pre=[push_image]) | |
36 def redeploy(ctx): | |
37 ctx.run(f'supervisorctl -s http://bang:9001/ restart {JOB}_{PORT}') |