-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
114 lines (97 loc) · 3.5 KB
/
justfile
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
#!/usr/bin/env just --justfile
set dotenv-required
# Source the .env file
set dotenv-load := true
# List recipes
list:
@just --list --unsorted
# Setup the environment
install:
conda env create -f environment.yml
git clone --branch v1.16.0 https://github.com/mbari-org/aidata ./src/aidata
python -m pip install -r src/aidata/requirements.txt
python -m pip install https://github.com/redis/redis-py/archive/refs/tags/v5.0.9.zip
# Update the conda environment. Run this command after checking out any code changes
update:
conda env update --file environment.yml --prune
python -m pip install https://github.com/redis/redis-py/archive/refs/tags/v5.0.9.zip
# Kill existing uvicorn processes
kill-uvicorn:
#!/usr/bin/env bash
if pgrep -f "uvicorn main:app"; then
pkill -f "uvicorn main:app"
fi
# Run the FastAPI server
run-server: kill-uvicorn
#!/usr/bin/env bash
echo "FastAPI server running at http://localhost:8002"
echo "FastAPI docs running at http://localhost:8002/docs"
export PYTHONPATH=$PWD/src:/Users/dcline/Dropbox/code/aidata
cd src/app && conda run -n fastapi-vss --no-capture-output uvicorn main:app --port 8002 --reload
run-server-prod: build-docker
#!/usr/bin/env bash
tag=$(git describe --tags --always)
GIT_VERSION=$tag COMPOSE_PROJECT_NAME=fastapi-vss docker-compose -f compose.yml down --remove-orphans && \
GIT_VERSION=$tag COMPOSE_PROJECT_NAME=fastapi-vss docker-compose -f compose.yml up -d
# Build the Docker image
build-docker:
#!/usr/bin/env bash
tag=$(git describe --tags --always)
docker build -t mbari/fastapi-app:$tag .
# Build the CUDA Docker image
build-docker-cuda:
#!/usr/bin/env bash
tag=$(git describe --tags --always)
docker build -t mbari/fastapi-app:$tag -f Dockerfile.cuda .
build-docker-no-cache:
#!/usr/bin/env bash
tag=$(git describe --tags --always)
docker build --no-cache -t mbari/fastapi-app:$tag .
run-docker:
echo "FastAPI server running at http://localhost:8001"
docker run -p "8001:80" mbari/fastapi-app
# Default recipe
default:
just run-server
test_all_ids:
#!/usr/bin/env bash
curl -X 'POST' \
'http://localhost:8002/ids/cfe' \
-H 'accept: application/json' \
-d ''
process_atolla:
#!/usr/bin/env bash
cd ./tests/images/atolla
curl -X 'POST' \
'http:/localhost:8002/knn/3/i2map' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F '[email protected];type=image/png'
curl -X 'POST' \
'http:/localhost:8002/knn/3/i2map' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F '[email protected];type=image/png'
curl -X 'POST' \
'http:/localhost:8002/knn/3/i2map' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F '[email protected];type=image/png'
process_copepods:
#!/usr/bin/env bash
cd ./tests/images/copepod
curl -X 'POST' \
'http:/localhost:8002/knn/3/902111-CFE' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F '[email protected];type=image/png'
curl -X 'POST' \
'http:/localhost:8002/knn/3/902111-CFE' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F '[email protected];type=image/png'
curl -X 'POST' \
'http:/localhost:8002/knn/3/902111-CFE' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F '[email protected];type=image/png'