Skip to content

Useful Commands

sallybg edited this page Jun 12, 2025 · 4 revisions

Alembic

localhost

For running local Alembic upgrades

DB_PORT=5434 DB_DATABASE_NAME=mavedb DB_USERNAME=postgres DB_PASSWORD=postgres poetry run alembic upgrade head

and downgrades

DB_PORT=5434 DB_DATABASE_NAME=mavedb DB_USERNAME=postgres DB_PASSWORD=postgres poetry run alembic downgrade -1

for creating a revision

poetry run alembic revision -m "<message>"

to autogenerate a revision

DB_PORT=5434 DB_DATABASE_NAME=mavedb DB_USERNAME=postgres DB_PASSWORD=postgres poetry run alembic revision --autogenerate -m "<message>"

staging

ssh tunnel-mavedb-staging
DB_PORT=5434 DB_DATABASE_NAME=mavedb_staging DB_USERNAME=<username> DB_PASSWORD=<password> poetry run alembic upgrade head

production

ssh tunnel-mavedb-production
DB_PORT=5434 DB_DATABASE_NAME=mavedb DB_USERNAME=<username> DB_PASSWORD=<password> poetry run alembic upgrade head

Redis

Download Redis to box

sudo yum install gcc jemalloc-devel openssl-devel tcl tcl-devel -y
wget https://download.redis.io/releases/redis-7.2.5.tar.gz
tar xvzf redis-7.2.5.tar.gz
cd redis-7.2.5
make BUILD_TLS=yes

Connect to stage

src/redis-cli -h master.mavedb2-staging-arq-cache.ssidtu.usw2.cache.amazonaws.com --tls -p 6379

Connect to prod

src/redis-cli -h master.mavedb2-prod-arq-cache.ssidtu.usw2.cache.amazonaws.com --tls -p 6379

ARQ

Manually kicking off a mapping job:

Log into the box with some variation of:
ssh mavedb-prod-worker

Insert the IDs into the queue:

cd redis-7.2.5/
src/redis-cli -h master.mavedb2-prod-arq-cache.ssidtu.usw2.cache.amazonaws.com --tls -p 6379
lpush vrs_mapping_queue <score set id>
exit

Enqueue the manager job:

sudo docker container ls
sudo docker exec -it <container_id> bash
python3
import asyncio
from mavedb.worker.settings import RedisWorkerSettings
from arq import create_pool
async def add_to_worker(user):
     redis = await create_pool(RedisWorkerSettings)
     await redis.enqueue_job("variant_mapper_manager", "manual_1", user)

asyncio.run(add_to_worker(<user>))
exit()

Other useful redis-cli commands

View items in queue: LRANGE vrs_mapping_queue 0 -1

Clone this wiki locally