Skip to content

Commit

Permalink
rewrite server with asyncio
Browse files Browse the repository at this point in the history
Summary: Rewrite the server to use asyncio and be multithreaded. Allows handling multiple clients.

Test Plan: Tests updated. Later test also tests multiple db writes simultaneously.
  • Loading branch information
JasonKChow committed Feb 10, 2025
1 parent 396fbaa commit ad30dbc
Show file tree
Hide file tree
Showing 14 changed files with 449 additions and 434 deletions.
7 changes: 5 additions & 2 deletions aepsych/database/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# LICENSE file in the root directory of this source tree.

import datetime
import io
import json
import logging
import os
Expand Down Expand Up @@ -440,12 +441,14 @@ def record_outcome(
self._session.add(outcome_entry)
self._session.commit()

def record_strat(self, master_table: tables.DBMasterTable, strat: Strategy) -> None:
def record_strat(
self, master_table: tables.DBMasterTable, strat: io.BytesIO
) -> None:
"""Record a strategy in the database.
Args:
master_table (tables.DBMasterTable): The master table.
strat (Strategy): The strategy.
strat (BytesIO): The strategy in buffer form.
"""
strat_entry = tables.DbStratTable()
strat_entry.strat = strat
Expand Down
Loading

0 comments on commit ad30dbc

Please sign in to comment.