-
Notifications
You must be signed in to change notification settings - Fork 6
/
tasks.py
42 lines (33 loc) · 1.34 KB
/
tasks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'''
Automate the build of the container and validation.
This uses invoke
To run:
inv build_container
Find out what tasks are available:
inv --list
'''
from invoke import task
import subprocess, datetime, yaml, toml
# from mdu_writer.verifications.meningotype_write import WriteMenigotypeVerify
@task
def update_singularity(c):
date = datetime.datetime.today().strftime("%d_%m_%y")
c.run("python3 update_meningotype.py")
c.run("git add *")
c.run(f"git commit -m updated singulairty {date}")
c.run("git push")
@task
def build_container(c):
config = toml.load("config.toml")
date = datetime.datetime.today().strftime("%d_%m_%y")
archive_dir = f"{config['archive_dir']}/{config['version']}_DB{date}"
print("Building container")
c.sudo(f'singularity build salmonella_typing.simg Singularity')
c.sudo(f"mkdir {archive_dir}") # make archive directory for this image
c.sudo(f"cp {config['container_dir']}/salmonella_typing.simg {archive_dir}") #copy to the archive directory
c.sudo(f"mv salmonella_typing.simg {config['container_dir']}") #move to the execution directory
@task
def push_verification(c):
config = toml.load("config.toml")
cfg_path = config['verification_path']
c.run(f"cd {cfg_path}/meningotype.wiki && git add Validation-Report.md && git status && git commit -m 'verification' && git push")