-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yaml
116 lines (99 loc) · 2.57 KB
/
Taskfile.yaml
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
version: 3
env:
VENV: '{{default (printf "%s/%s" .ROOT_DIR ".venv") .VENV}}'
# ENV and CONFIG_DIR are used in local development only to locate the config and secrets files
ENV: '{{default "local" .ENV}}'
CONFIG_DIR: '{{default "./env" .CONFIG_DIR}}'
PROJECT_NAME: '{{default "datahub-pg-lineage" .PROJECT_NAME}}'
dotenv:
- "{{.CONFIG_DIR}}/{{.ENV}}/.env"
- ".env"
tasks:
debug:
cmds:
- "echo ENV: {{.ENV}}"
- "echo VENV: {{.VENV}}"
- "echo CONFIG_DIR: {{.CONFIG_DIR}}"
setup:
desc: setup the development environment
cmds:
- poetry install --with dev
build:
desc: build the python package
cmds:
- poetry build
publish:
desc: publish the python package
cmds:
- poetry publish
flake:
internal: true
cmds:
- poetry run flake8 datahub_postgres_lineage
format:
internal: true
cmds:
- poetry run black --check .
# - poetry run isort --check-only .
typings:
internal: true
cmds:
- poetry run mypy .
lint:
desc: lint the python package
deps:
- flake
- format
- typings
wait:
cmds:
- sleep {{.SLEEP}}
vars:
SLEEP: 5
run:
desc: run the ingestion pipeline
vars:
recipe: '{{default (printf "env/%s/recipe.yaml" .ENV) .recipe }}'
cmds:
- poetry run datahub ingest -c {{.recipe}}
start:
desc: start a local databases
cmds:
- >
docker-compose
-p {{.PROJECT_NAME}}
-f env/local/docker-compose.yaml
up -d
status:
- docker-compose -p {{.PROJECT_NAME}} -f env/local/docker-compose.yaml ps sample-db | grep 'sample-db'
stop:
desc: stop the development databases
cmds:
- >
docker-compose
-p {{.PROJECT_NAME}}
-f env/local/docker-compose.yaml
down
preconditions:
- sh: docker-compose -p {{.PROJECT_NAME}} -f env/local/docker-compose.yaml ps sample-db | grep 'sample-db'
msg: database is not running
clean:
desc: remove the development databases
cmds:
- >
docker-compose
-p {{.PROJECT_NAME}}
-f env/local/docker-compose.yaml
down -v
sample-view:
desc: create a sample view
cmds:
- psql -f {{.CONFIG_DIR}}/{{.ENV}}/sample.sql
status:
- psql -At -c "select 1 from information_schema.views where table_name = 'names'" | grep "1"
- psql -At -c "select 1 from information_schema.views where table_name = 'emails'" | grep "1"
psql:
interactive: true
desc: open psql to the database
cmds:
- psql {{.CLI_ARGS}}