Skip to content

Commit 5af7622

Browse files
committed
Make consistent event_ and statistics_ table names
1 parent 95c4382 commit 5af7622

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,11 @@ Note: when POSTing or PUTing events, `software_version` and `storage_name` must
217217
EMS database tables beforehand. However, the `file_path` entry will be automatically created in
218218
the `file_` table, if not there yet.
219219

220+
221+
## Statistics collection and display
222+
223+
To see stats on the Web UI homepage, you must run statistics collection script (ideally, run
224+
it periodically from cron).
225+
226+
The statistics collection script is part of this repository, see [README](ems-stat-collector/README.md)
227+
for details.

ems-stat-collector/src/orm/ems.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class File(Base):
2828

2929

3030
class Event(Base):
31-
__tablename__ = "event"
31+
__tablename__ = "event_"
3232
file_guid: Mapped[int] = mapped_column(ForeignKey("file_.file_guid"), primary_key=True)
3333
file: Mapped[File] = relationship()
3434
event_number: Mapped[int] = mapped_column(primary_key=True)
@@ -42,7 +42,7 @@ class Event(Base):
4242

4343

4444
class Statistics(Base):
45-
__tablename__ = "statistics"
45+
__tablename__ = "statistics_"
4646
id: Mapped[int] = mapped_column(primary_key=True)
4747
json_stats: Mapped[str]
4848
time_written: Mapped[datetime.datetime] = mapped_column(

ems.bmn-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ title: BM@N Event Metadata System
2727
pages:
2828
- name: BM@N Events
2929
api_url: /event_api/v1
30-
db_table_name: event
30+
db_table_name: event_
3131
default_limit_web: 100
3232
parameters:
3333
- name: track_number

src/jvmMain/kotlin/Application.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ fun Application.main() {
107107
try {
108108
connEMD = newEMDConnection(config, this@get.context, forStatsGetting = true)!!
109109
connEMD.createStatement()
110-
.executeQuery("SELECT json_stats FROM statistics ORDER BY id DESC LIMIT 1")
110+
.executeQuery("SELECT json_stats FROM statistics_ ORDER BY id DESC LIMIT 1")
111111
.let { resultSet ->
112112
if (resultSet.next()) {
113113
val r = resultSet.getString("json_stats")
114114
call.response.header("Content-Type", "application/json")
115115
call.respondText(r)
116116
} else {
117-
call.respond(HttpStatusCode.NotFound, "No data in EMS statistics table")
117+
call.respond(HttpStatusCode.NotFound, "No data in EMS statistics_ table")
118118
}
119119
}
120120
} catch (err: Exception) {

testing/docker-ems-catalogue/schema.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ create table test_event
7171
primary_vertex bool not null
7272
);
7373

74-
CREATE TABLE statistics (
74+
CREATE TABLE statistics_ (
7575
id serial primary key,
7676
json_stats character varying NOT NULL,
7777
time_written time without time zone

0 commit comments

Comments
 (0)