Skip to content

Commit

Permalink
a few fixes that caome up in testing
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Jan 17, 2025
1 parent c2405ef commit 05261b6
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 13 deletions.
6 changes: 3 additions & 3 deletions asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "/static/css/main.02152627.css",
"main.js": "/static/js/main.56147897.js",
"main.js": "/static/js/main.4186a3e6.js",
"static/media/roboto-all-500-normal.woff": "/static/media/roboto-all-500-normal.0ab669b7a0d19b178f57.woff",
"static/media/roboto-all-700-normal.woff": "/static/media/roboto-all-700-normal.a457fde362a540fcadff.woff",
"static/media/roboto-all-400-normal.woff": "/static/media/roboto-all-400-normal.c5d001fa922fa66a147f.woff",
Expand Down Expand Up @@ -36,10 +36,10 @@
"static/media/roboto-greek-ext-700-normal.woff2": "/static/media/roboto-greek-ext-700-normal.bd9854c751441ccc1a70.woff2",
"index.html": "/index.html",
"main.02152627.css.map": "/static/css/main.02152627.css.map",
"main.56147897.js.map": "/static/js/main.56147897.js.map"
"main.4186a3e6.js.map": "/static/js/main.4186a3e6.js.map"
},
"entrypoints": [
"static/css/main.02152627.css",
"static/js/main.56147897.js"
"static/js/main.4186a3e6.js"
]
}
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Pioreactor"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><script defer="defer" src="/static/js/main.56147897.js"></script><link href="/static/css/main.02152627.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Pioreactor"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><script defer="defer" src="/static/js/main.4186a3e6.js"></script><link href="/static/css/main.02152627.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
26 changes: 25 additions & 1 deletion pioreactorui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,18 @@ def _get_app_db_connection():
) # TODO: until next OS release which implements a native sqlite3 base64 function

db.row_factory = _make_dicts
db.execute("PRAGMA foreign_keys = 1")
db.executescript(
"""
PRAGMA journal_mode=WAL;
PRAGMA synchronous = 1; -- aka NORMAL, recommended when using WAL
PRAGMA temp_store = 2; -- stop writing small files to disk, use mem
PRAGMA busy_timeout = 15000;
PRAGMA foreign_keys = ON;
PRAGMA synchronous = NORMAL;
PRAGMA auto_vacuum = INCREMENTAL;
PRAGMA cache_size = -20000;
"""
)

return db

Expand All @@ -180,6 +191,19 @@ def _get_temp_local_metadata_db_connection():
pioreactor_config.get("storage", "temporary_cache")
)
db.row_factory = _make_dicts
db.executescript(
"""
PRAGMA journal_mode=WAL;
PRAGMA synchronous = 1; -- aka NORMAL, recommended when using WAL
PRAGMA temp_store = 2; -- stop writing small files to disk, use mem
PRAGMA busy_timeout = 15000;
PRAGMA foreign_keys = ON;
PRAGMA synchronous = NORMAL;
PRAGMA auto_vacuum = INCREMENTAL;
PRAGMA cache_size = -20000;
"""
)

return db


Expand Down
18 changes: 15 additions & 3 deletions pioreactorui/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1709,9 +1709,9 @@ def update_experiment_profile() -> ResponseReturnValue:
):
abort(404, "must end in .yaml")

except Exception:
except Exception as e:
# publish_to_error_log(msg, "create_experiment_profile")
return abort(400, "Invalid filename")
abort(400, str(e))

filepath = Path(env["DOT_PIOREACTOR"]) / "experiment_profiles" / experiment_profile_filename

Expand All @@ -1728,10 +1728,22 @@ def update_experiment_profile() -> ResponseReturnValue:
def get_experiment_profiles() -> ResponseReturnValue:
try:
profile_path = Path(env["DOT_PIOREACTOR"]) / "experiment_profiles"
files = sorted(profile_path.glob("*.y*ml"), key=os.path.getmtime, reverse=True)
files = sorted(profile_path.glob("*.y*ml"), key=lambda f: f.stat().st_mtime, reverse=True)

parsed_yaml = []
for file in files:
# allow empty files, it's annoying to users otherwise (and maybe theres a bug that wipes yamls?)
if file.stat().st_size == 0:
parsed_yaml.append(
{
"experimentProfile": {
"experiment_profile_name": f"temporary name: {file.stem}"
},
"file": str(file),
}
)
continue

try:
profile = yaml_decode(file.read_bytes(), type=Profile)
parsed_yaml.append({"experimentProfile": profile, "file": str(file)})
Expand Down
8 changes: 4 additions & 4 deletions static/js/main.56147897.js → static/js/main.4186a3e6.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions static/js/main.4186a3e6.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion static/js/main.56147897.js.map

This file was deleted.

0 comments on commit 05261b6

Please sign in to comment.