Skip to content

Dev_Administrator Procedures

Adrien Pavão edited this page Jun 15, 2021 · 25 revisions

Administrator procedures

Delete all contents of database

In codalab-competitions folder, on the CodaLab instance:

docker-compose up -d
docker-compose exec django bash
python manage.py reset_db
python manage.py migrate
python manage.py syncdb --migrate
exit
docker-compose restart
docker-compose up -d

Add yourself to "staff" and "superuser"

This gives access to health/simple_status and more.

docker-compose exec django bash
# python manage.py shell_plus
>>> user = ClUser.objects.get(username="your username")
>>> user.is_superuser = True
>>> user.is_staff = True
>>> user.save()

Erase user

/!/ First step: check the user's email address to ensure you won't erase an account under the demand of another user /!/

docker-compose exec django bash
# python manage.py shell_plus
>>> user = ClUser.objects.get(username="user name")    # or (email="user email")
>>> user.delete() # ??? Don't seem to work at all ???

Change username

Hint: only accept to change the username if the request is sent from the user's email address.

docker-compose exec django bash
# python manage.py shell_plus
>>> user = ClUser.objects.get(username="new_username") # check if 'new_username' already exists
>>> user = ClUser.objects.get(username="old_username")    # or (email="user email"), good to check if the person who contacted us owns the account
>>> user.username = 'new_username'
>>> user.save()

Some platform admin functionalities

How to flush the default queue?

Log into each worker to check if they are stuck:

docker logs -f compute_worker

If one worker is stuck then restart it:

docker stop compute_worker
docker rm compute_worker
big command from the wiki

Go to RabbitMQ interface: https://<CODALAB-URL>/admin_monitoring_links/

In "Queues" tab we find the queue and restart it

This one is the default queue (virtual host: "/"):

default_queue

To determine the workers linked to this queue, click on its name, then open the "Consumers" tab

Clone this wiki locally