-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pick smaller changes from app restructure: Logging configuration and …
…docstrings for Andromeda (#253) * Allow configuring django log level * Add docstrings for the andromeda app * Add docs for scripts --------- Co-authored-by: Jeremiah Boby <[email protected]> Co-authored-by: 0xAda <[email protected]>
- Loading branch information
1 parent
b190108
commit a5b87a1
Showing
8 changed files
with
67 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
"""Script for clearing the connected database of all data.""" | ||
|
||
import os | ||
from os import getenv | ||
|
||
import psycopg2 | ||
|
||
with psycopg2.connect( | ||
user=getenv("SQL_USER"), | ||
password=getenv("SQL_PASSWORD"), | ||
host=getenv("SQL_HOST"), | ||
port=getenv("SQL_PORT"), | ||
database="template1", | ||
) as connection: | ||
connection.set_isolation_level(0) | ||
with connection.cursor() as cursor: | ||
cursor.execute(f"DROP DATABASE {os.getenv('SQL_DATABASE')}") | ||
cursor.execute(f"CREATE DATABASE {os.getenv('SQL_DATABASE')}") | ||
|
||
if __name__ == '__main__': | ||
with psycopg2.connect( | ||
user=getenv("SQL_USER"), | ||
password=getenv("SQL_PASSWORD"), | ||
host=getenv("SQL_HOST"), | ||
port=getenv("SQL_PORT"), | ||
database="template1", | ||
) as connection: | ||
connection.set_isolation_level(0) | ||
with connection.cursor() as cursor: | ||
cursor.execute(f"DROP DATABASE {os.getenv('SQL_DATABASE')}") | ||
cursor.execute(f"CREATE DATABASE {os.getenv('SQL_DATABASE')}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
"""App for the andromeda integration.""" | ||
|
||
from django.apps import AppConfig | ||
|
||
|
||
class AndromedaConfig(AppConfig): | ||
"""AppConfig for the andromeda integration.""" | ||
|
||
name = "andromeda" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
"""Serializers for the andromeda integration.""" | ||
|
||
from rest_framework import serializers | ||
|
||
|
||
class JobSubmitSerializer(serializers.Serializer): | ||
"""Serializer for job submissions associated with a challenge id.""" | ||
|
||
challenge_id = serializers.IntegerField() | ||
job_spec = serializers.JSONField() | ||
|
||
|
||
class JobSubmitRawSerializer(serializers.Serializer): | ||
"""Serializer for job submissions.""" | ||
|
||
job_spec = serializers.JSONField() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
"""URL routes for the andromeda integration.""" | ||
from django.urls import path | ||
|
||
from andromeda import views | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters