Skip to content

Commit 0db5dfc

Browse files
committed
Start setup for search index in CI
1 parent 7d2aee1 commit 0db5dfc

4 files changed

Lines changed: 43 additions & 57 deletions

File tree

.github/workflows/develop.yml

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,52 @@ on:
66
- "develop"
77

88
jobs:
9-
clippy:
9+
build-search-index:
10+
name: "Build search index"
1011
runs-on: ubuntu-latest
1112
steps:
1213
- uses: actions/checkout@v2
14+
- uses: prefix-dev/setup-pixi@v0.9.2
15+
with:
16+
run-install: false
1317
- name: Install toolchain
1418
run: rustup toolchain install stable
15-
- name: Install clippy
16-
run: rustup component add clippy
17-
- name: Run clippy
19+
- name: Configure SSH
1820
run: |
19-
cd backend-rust
20-
cargo clippy --all-targets --all-features -- -D warnings
21+
mkdir -p ~/.ssh/
22+
echo "$SSH_KEY" > ~/.ssh/prod.key
23+
chmod 600 ~/.ssh/prod.key
24+
cat >>~/.ssh/config <<END
25+
Host prod
26+
HostName $SSH_HOST
27+
User $SSH_USER
28+
IdentityFile ~/.ssh/prod.key
29+
StrictHostKeyChecking no
30+
END
31+
env:
32+
SSH_USER: ${{ secrets.SSH_USERNAME }}
33+
SSH_KEY: ${{ secrets.SSHKEY }}
34+
SSH_HOST: ${{ secrets.HOST }}
2135

22-
test:
23-
runs-on: ubuntu-latest
24-
steps:
25-
- uses: actions/checkout@v2
26-
- name: Run tests
36+
- name: Download index data
37+
run: |
38+
mkdir -p search_preprocess/data
39+
cd search_preprocess/data
40+
../download_data.sh
41+
ls -lh
42+
- name: Build search index
2743
run: |
28-
cd backend-rust
29-
./download_test_data.sh
30-
cargo test --all-targets
44+
cd search_preprocess
45+
pixi install
46+
pixi run python src/preprocess_search_data.py
47+
pixi run python src/filter_search_data.py
48+
pixi run python src/preprocess_flying_site_data.py
49+
mkdir -p ../backend-rust/data
50+
cp ./data/search_data_*.jsonl ../backend-rust/data/
51+
cd ../backend-rust
52+
cargo run --bin preprocess_search_index --release
3153
32-
docker:
33-
runs-on: ubuntu-latest
34-
steps:
35-
- name: Set up Docker Buildx
36-
uses: docker/setup-buildx-action@v2
37-
- name: Login to Docker Hub
38-
uses: docker/login-action@v2
39-
with:
40-
username: ${{ secrets.DOCKERHUB_USERNAME }}
41-
password: ${{ secrets.DOCKERHUB_TOKEN }}
42-
- name: Build docker image
43-
uses: docker/build-push-action@v4
44-
with:
45-
push: true
46-
tags: hoff97/hikeandfly:develop
47-
cache-from: type=registry,ref=hoff97/hikeandfly:develop
48-
cache-to: type=inline
54+
ls -lh data/
55+
- name: Upload search index
56+
run: |
57+
scp -o StrictHostKeyChecking=no data/search_data_flying_sites.jsonl hikeandfly:~/data

search_preprocess/download_data.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
wget https://download1.graphhopper.com/public/europe/austria/photon-dump-austria-0.7-latest.jsonl.zst
2-
wget https://download1.graphhopper.com/public/europe/italy/photon-dump-italy-0.7-latest.jsonl.zst
3-
wget https://download1.graphhopper.com/public/europe/germany/photon-dump-germany-0.7-latest.jsonl.zst
4-
wget https://download1.graphhopper.com/public/europe/france-monacco/photon-dump-france-monacco-0.7-latest.jsonl.zst
5-
wget https://download1.graphhopper.com/public/europe/slovenia/photon-dump-slovenia-0.7-latest.jsonl.zst
62

73
zstd -d photon-dump-*.jsonl.zst
84

9-
wget https://service.dhv.de/dbfiles/managed/gelaendedaten/dhvxml/dhvgelaende_dhvxml_alle.zip?format=dhvxml&land=alle&nutzung=on
10-
unzip unzip dhvgelaende_dhvxml_alle.zip\?format=dhvxml\&land=alle\&nutzung=on
5+
wget "https://service.dhv.de/dbfiles/managed/gelaendedaten/dhvxml/dhvgelaende_dhvxml_alle.zip?format=dhvxml&land=alle&nutzung=on"
6+
unzip "dhvgelaende_dhvxml_alle.zip?format=dhvxml&land=alle&nutzung=on"

search_preprocess/pixi.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
authors = ["Frithjof Winkelmann <fwinkelmann97@gmail.com>"]
33
channels = ["conda-forge"]
44
name = "search_preprocess"
5-
platforms = ["osx-arm64"]
5+
platforms = ["osx-arm64", "osx-64", "linux-64", "linux-aarch64", "win-64"]
66
version = "0.1.0"
77

88
[tasks]

search_preprocess/src/preprocess_search_data.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -210,26 +210,7 @@ def preprocess_data():
210210
else:
211211
raise ValueError(f"Unsupported object type: {object_data['type']}")
212212

213-
c = list(categories.items())
214-
c.sort(key=lambda x: x[1], reverse=True)
215-
print(f"Found categories: {c}")
216-
categories_contained_once = [k for k, v in categories.items() if v == 1]
217-
218-
second_level = defaultdict(int)
219-
for name, count in categories.items():
220-
splitted = name.split(".")
221-
second_level[".".join(splitted[:2])] += count
222-
sl = list(second_level.items())
223-
sl.sort(key=lambda x: x[1], reverse=True)
224-
print(f"Found categories: {sl}")
225-
226213
df = pl.DataFrame(result)
227-
df = df.filter(
228-
pl.col("categories")
229-
.list.set_intersection(categories_contained_once)
230-
.list.len()
231-
== 0
232-
)
233214
print(df)
234215
df.write_ndjson(f"data/augmented_search_data_{region}.jsonl")
235216
df = df.drop("categories")

0 commit comments

Comments
 (0)