Skip to content

Commit

Permalink
Use in-memory sql for artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Oct 7, 2024
1 parent 24a4b7f commit 5e455ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
6 changes: 5 additions & 1 deletion hypha/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ def __init__(
):
"""Set up controller with SQLAlchemy database and S3 for file storage."""
if database_uri is None:
raise ValueError("Database URI is required.")
# create an in-memory SQLite database for testing
database_uri = "sqlite+aiosqlite:///:memory:"
logger.warning(
"Using in-memory SQLite database for artifact manager, all data will be lost on restart!!!"
)
self.engine = create_async_engine(database_uri, echo=False)
self.SessionLocal = async_sessionmaker(
self.engine, expire_on_commit=False, class_=AsyncSession
Expand Down
14 changes: 7 additions & 7 deletions hypha/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ def start_builtin_services(
executable_path=args.executable_path,
)

artifact_manager = ArtifactController(
store,
s3_controller=s3_controller,
workspace_bucket=args.workspace_bucket,
database_uri=args.database_uri,
)
artifact_manager = ArtifactController(
store,
s3_controller=s3_controller,
workspace_bucket=args.workspace_bucket,
database_uri=args.database_uri,
)

if args.enable_server_apps:
assert args.enable_s3, "Server apps require S3 to be enabled"
Expand Down Expand Up @@ -378,7 +378,7 @@ def get_argparser(add_help=True):
"--database-uri",
type=str,
default=None,
help="set database URI for the server",
help="set database URI for the artifact manager",
)
parser.add_argument(
"--workspace-bucket",
Expand Down

0 comments on commit 5e455ae

Please sign in to comment.