-
Notifications
You must be signed in to change notification settings - Fork 87
135 lines (115 loc) · 4.57 KB
/
Copy pathpython-apollo.yml
File metadata and controls
135 lines (115 loc) · 4.57 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Python-Apollo
on:
push:
branches: [develop, apollo_g7]
pull_request:
branches: [develop]
jobs:
test-python-apollo:
name: test-python-apollo
runs-on: ubuntu-latest
steps:
- name: Checkout Apollo
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build Apollo
run: ./gradlew classes
- name: Start Apollo
run: |
./gradlew bootRun > apollo.log 2>&1 &
# Wait for health endpoint
for i in $(seq 1 300); do
response=$(curl -s 'http://localhost:8080/apollo/health/index' 2>/dev/null || true)
if echo "$response" | grep -q '"status":"ready"'; then
echo "Apollo is ready (${i}s)"
break
fi
if [ $i -eq 300 ]; then
echo "FAIL: Apollo not ready after 300 seconds"
cat apollo.log
exit 1
fi
sleep 1
done
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Checkout python-apollo
uses: actions/checkout@v4
with:
repository: galaxy-genome-annotation/python-apollo
path: python-apollo
ref: master
- name: Install python-apollo
run: |
cd python-apollo
pip install 'biopython<1.86' apollo pytest
- name: Bootstrap test data
run: |
cd python-apollo
export ARROW_GLOBAL_CONFIG_PATH=$(pwd)/test-data/local-apollo2-arrow.yml
./bootstrap_apollo.sh --nodocker
- name: Diagnose test failures
run: |
cd python-apollo
export ARROW_GLOBAL_CONFIG_PATH=$(pwd)/test-data/local-apollo2-arrow.yml
python3 -c "
import traceback, json, sys
try:
from apollo import ApolloInstance
wa = ApolloInstance('http://localhost:8080/apollo', 'admin@local.host', 'password')
print('=== Organisms ===')
orgs = wa.organisms.get_organisms()
for o in orgs:
print(f\" {o.get('commonName')}: sequences={o.get('sequences')}\")
print()
print('=== Test load_gff3 ===')
feature_data = wa.annotations.load_gff3('test_organism', 'test-data/mrna-top.gff')
print(f'load_gff3 returned: {feature_data}')
print()
print('=== Remote API test ===')
import tempfile, tarfile, glob, os
with tempfile.NamedTemporaryFile(suffix='.tar.gz', delete=False) as archive:
archive_path = archive.name
with tarfile.open(archive_path, mode='w:gz') as tar:
base = 'test-data/dataset_1_files/data/'
for root, dirs, files in os.walk(base):
for f in files:
full = os.path.join(root, f)
arcname = os.path.relpath(full, base)
tar.add(full, arcname=arcname)
with tarfile.open(archive_path, mode='r:gz') as tar:
print(f' Archive has {len(tar.getmembers())} entries')
for m in tar.getmembers()[:5]:
print(f' {m.name}')
with open(archive_path, 'rb') as f:
result = wa.remote.add_organism('diag_remote_org', f)
print(f' add_organism result: {json.dumps(result, indent=2, default=str)[:500]}')
os.unlink(archive_path)
except Exception as e:
print(f'DIAGNOSTIC FAILED: {type(e).__name__}: {e}')
traceback.print_exc()
" 2>&1 || true
echo ""
echo "=== Apollo ERROR/WARN log lines ==="
grep -E 'ERROR|WARN' ../apollo.log | tail -200 || true
- name: Run tests
run: |
cd python-apollo
export ARROW_GLOBAL_CONFIG_PATH=$(pwd)/test-data/local-apollo2-arrow.yml
python -m pytest -v
- name: Print Apollo log on failure
if: failure()
run: |
echo "=== Delete-related log lines ==="
grep -iE 'deleteOrganism|features to delete|Deleted.*features|problem removing|not authorized to delete' apollo.log | tail -50 || true
echo ""
echo "=== Last 500 lines of Apollo log ==="
tail -500 apollo.log