Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docker/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,23 @@ CREATE TRIGGER categories_moddatetime
EXECUTE PROCEDURE moddatetime (updated_at);


CREATE TABLE micro_phases (
id SERIAL PRIMARY KEY,
run_id uuid NOT NULL REFERENCES runs(id) ON DELETE CASCADE ON UPDATE CASCADE,
name text NOT NULL,
start_time bigint NOT NULL,
end_time bigint NOT NULL,
created_at timestamp with time zone DEFAULT now(),
updated_at timestamp with time zone
);

CREATE INDEX "micro_phases_run_id" ON "micro_phases" USING HASH ("run_id");
CREATE TRIGGER micro_phases_moddatetime
BEFORE UPDATE ON micro_phases
FOR EACH ROW
EXECUTE PROCEDURE moddatetime (updated_at);


CREATE TABLE phase_stats (
id SERIAL PRIMARY KEY,
run_id uuid NOT NULL REFERENCES runs(id) ON DELETE CASCADE ON UPDATE CASCADE,
Expand Down
8 changes: 8 additions & 0 deletions lib/scenario_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,7 @@ def _run_flows(self):
'read-notes-stdout': cmd_obj.get('read-notes-stdout', False),
'ignore-errors': cmd_obj.get('ignore-errors', False),
'read-sci-stdout': cmd_obj.get('read-sci-stdout', False),
'sub-phase-expansion-pattern': cmd_obj.get('sub-phase-expansion-pattern', None),
'detail_name': flow['container'],
'detach': cmd_obj.get('detach', False),
})
Expand Down Expand Up @@ -1656,6 +1657,13 @@ def _read_and_cleanup_processes(self):
for match in re.findall(r'^GMT_SCI_R=(\d+)$', stdout, re.MULTILINE):
self._sci['R'] += int(match)

if ps.get('sub-phase-expansion-pattern', None):
print('Pattern is', ps['sub-phase-expansion-pattern'])

for match in re.finditer(ps['sub-phase-expansion-pattern'], stdout, re.MULTILINE):
self.__phases[match['phase_name']] = {'start': int(match['start_time']), 'name': match['phase_name'], 'end': int(match['end_time']) }
DB().query("INSERT INTO micro_phases (run_id, name, start_time, end_time) VALUES (%s, %s, %s, %s)", (self._run_id, match['phase_name'], match['start_time'], match['end_time']))

if stderr is not None:
print('stderr from process:', ps['cmd'], stderr)
self._add_to_current_run_log(f"{ps['container_name']} (ID: {id(ps['ps'])}; CMD: {ps['cmd']}); STDERR", stderr)
Expand Down
1 change: 1 addition & 0 deletions lib/schema_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def check_usage_scenario(self, usage_scenario):
Optional("shell"): And(str, Use(self.not_empty)),
Optional("log-stdout"): bool,
Optional("log-stderr"): bool,
Optional("sub-phase-expansion-pattern"): And(str, Use(self.not_empty)),
}],

}],
Expand Down
Loading