Skip to content

Commit 5439897

Browse files
new multi profiles
1 parent 5b4e5b4 commit 5439897

File tree

9 files changed

+53
-15
lines changed

9 files changed

+53
-15
lines changed

asset-manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"files": {
33
"main.css": "/static/css/main.02152627.css",
4-
"main.js": "/static/js/main.c1b772c6.js",
4+
"main.js": "/static/js/main.e18b8229.js",
55
"static/media/roboto-all-500-normal.woff": "/static/media/roboto-all-500-normal.0ab669b7a0d19b178f57.woff",
66
"static/media/roboto-all-700-normal.woff": "/static/media/roboto-all-700-normal.a457fde362a540fcadff.woff",
77
"static/media/roboto-all-400-normal.woff": "/static/media/roboto-all-400-normal.c5d001fa922fa66a147f.woff",
@@ -36,10 +36,10 @@
3636
"static/media/roboto-greek-ext-700-normal.woff2": "/static/media/roboto-greek-ext-700-normal.bd9854c751441ccc1a70.woff2",
3737
"index.html": "/index.html",
3838
"main.02152627.css.map": "/static/css/main.02152627.css.map",
39-
"main.c1b772c6.js.map": "/static/js/main.c1b772c6.js.map"
39+
"main.e18b8229.js.map": "/static/js/main.e18b8229.js.map"
4040
},
4141
"entrypoints": [
4242
"static/css/main.02152627.css",
43-
"static/js/main.c1b772c6.js"
43+
"static/js/main.e18b8229.js"
4444
]
4545
}

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +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.c1b772c6.js"></script><link href="/static/css/main.02152627.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
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.e18b8229.js"></script><link href="/static/css/main.02152627.css" rel="stylesheet"></head><body><div id="root"></div></body></html>

pioreactorui/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ def query_temp_local_metadata_db(
230230
cur = _get_temp_local_metadata_db_connection().execute(query, args)
231231
rv = cur.fetchall()
232232
cur.close()
233+
print(rv)
233234
return (rv[0] if rv else None) if one else rv
234235

235236

pioreactorui/api.py

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
from . import publish_to_experiment_log
4747
from . import publish_to_log
4848
from . import query_app_db
49+
from . import query_temp_local_metadata_db
4950
from . import structs
5051
from . import tasks
5152
from .config import env
@@ -59,7 +60,7 @@
5960
api = Blueprint("api", __name__, url_prefix="/api")
6061

6162

62-
def to_json_response(json: str) -> ResponseReturnValue:
63+
def as_json_response(json: str) -> ResponseReturnValue:
6364
return Response(json, mimetype="application/json")
6465

6566

@@ -538,7 +539,7 @@ def get_growth_rates(experiment: str) -> ResponseReturnValue:
538539
abort(400)
539540

540541
assert isinstance(growth_rates, dict)
541-
return attach_cache_control(to_json_response(growth_rates["json"]))
542+
return attach_cache_control(as_json_response(growth_rates["json"]))
542543

543544

544545
@api.route("/experiments/<experiment>/time_series/temperature_readings", methods=["GET"])
@@ -572,7 +573,7 @@ def get_temperature_readings(experiment: str) -> ResponseReturnValue:
572573
abort(400)
573574

574575
assert isinstance(temperature_readings, dict)
575-
return attach_cache_control(to_json_response(temperature_readings["json"]))
576+
return attach_cache_control(as_json_response(temperature_readings["json"]))
576577

577578

578579
@api.route("/experiments/<experiment>/time_series/od_readings_filtered", methods=["GET"])
@@ -607,7 +608,7 @@ def get_od_readings_filtered(experiment: str) -> ResponseReturnValue:
607608
abort(400)
608609

609610
assert isinstance(filtered_od_readings, dict)
610-
return attach_cache_control(to_json_response(filtered_od_readings["json"]))
611+
return attach_cache_control(as_json_response(filtered_od_readings["json"]))
611612

612613

613614
@api.route("/experiments/<experiment>/time_series/od_readings", methods=["GET"])
@@ -640,7 +641,7 @@ def get_od_readings(experiment: str) -> ResponseReturnValue:
640641
abort(400)
641642

642643
assert isinstance(raw_od_readings, dict)
643-
return attach_cache_control(to_json_response(raw_od_readings["json"]))
644+
return attach_cache_control(as_json_response(raw_od_readings["json"]))
644645

645646

646647
@api.route("/experiments/<experiment>/time_series/<data_source>/<column>", methods=["GET"])
@@ -674,7 +675,7 @@ def get_fallback_time_series(data_source: str, experiment: str, column: str) ->
674675
publish_to_error_log(str(e), "get_fallback_time_series")
675676
abort(400)
676677
assert isinstance(r, dict)
677-
return attach_cache_control(to_json_response(r["json"]))
678+
return attach_cache_control(as_json_response(r["json"]))
678679

679680

680681
@api.route("/experiments/<experiment>/media_rates", methods=["GET"])
@@ -1641,6 +1642,36 @@ def is_local_access_point_active() -> ResponseReturnValue:
16411642
### experiment profiles
16421643

16431644

1645+
@api.route("/experiment_profiles/running/experiments/<experiment>", methods=["GET"])
1646+
def get_running_profiles(experiment: str) -> ResponseReturnValue:
1647+
jobs = query_temp_local_metadata_db(
1648+
"""
1649+
SELECT
1650+
json_group_array(json_object(
1651+
'job_name', m.job_name,
1652+
'experiment', m.experiment,
1653+
'job_id', m.id,
1654+
'settings', (
1655+
SELECT json_group_object(s.setting, s.value)
1656+
FROM pio_job_published_settings s
1657+
WHERE s.job_id = m.id
1658+
)
1659+
)) as result
1660+
FROM
1661+
pio_job_metadata m
1662+
WHERE
1663+
m.is_running=1 and
1664+
m.experiment = (?) AND
1665+
m.job_name="experiment_profile"
1666+
""",
1667+
(experiment,),
1668+
one=True,
1669+
)
1670+
assert isinstance(jobs, dict)
1671+
1672+
return as_json_response(jobs["result"])
1673+
1674+
16441675
@api.route("/contrib/experiment_profiles", methods=["POST"])
16451676
def create_experiment_profile() -> ResponseReturnValue:
16461677
body = request.get_json()

pioreactorui/unit_api.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,12 @@ def stop_all_jobs_by_source(job_source: str) -> ResponseReturnValue:
306306
return create_task_response(task)
307307

308308

309+
@unit_api.route("/jobs/stop/job_id/<job_id>", methods=["PATCH", "POST"])
310+
def stop_all_jobs_by_id(job_id: int) -> ResponseReturnValue:
311+
task = tasks.pio_kill("--job-id", job_id)
312+
return create_task_response(task)
313+
314+
309315
@unit_api.route("/jobs/running/experiments/<experiment>", methods=["GET"])
310316
def get_running_jobs_for_experiment(experiment: str) -> ResponseReturnValue:
311317
jobs = query_temp_local_metadata_db(

static/js/main.c1b772c6.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/js/main.e18b8229.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)