Workflow Run Databases

Schedulers maintain two sqlite databases to record information on run history:

$HOME/cylc-run/<workflow-id>/log/db  # public workflow DB
$HOME/cylc-run/<workflow-id>/.service/db  # private workflow DB

The private DB is for use only by the scheduler. The identical public DB is provided for use by external commands such as cylc workflow-state, and cylc report-timings. If the public DB gets locked for too long by an external reader, the scheduler will eventually delete it and replace it with a new copy of the private DB, to ensure that both correctly reflect the workflow state.

You can interrogate the public DB with the sqlite3 command line tool, the sqlite3 module in the Python standard library, or any other sqlite interface.

$ sqlite3 ~/cylc-run/foo/log/db << _END_
> .headers on
> select * from task_events where name is "foo";
> _END_
name|cycle|time|submit_num|event|message
foo|1|2017-03-12T11:06:09Z|1|submitted|
foo|1|2017-03-12T11:06:09Z|1|output completed|started
foo|1|2017-03-12T11:06:09Z|1|started|
foo|1|2017-03-12T11:06:19Z|1|output completed|succeeded
foo|1|2017-03-12T11:06:19Z|1|succeeded|

The diagram shown below contains the database tables, their columns, and how the tables are related to each other. For more details on how to interpret the diagram, refer to the Entity–relationship model Wikipedia article.

graph { node [label = "\N", shape = plaintext]; edge [color = gray50, minlen = 2, style = dashed]; rankdir = "LR"; "absolute_outputs" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">absolute_outputs</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><FONT>cycle</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>name</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>output</FONT></TD></TR></TABLE></FONT>>]; "broadcast_events" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">broadcast_events</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><FONT>time</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>change</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>point</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>namespace</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>key</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>value</FONT></TD></TR></TABLE></FONT>>]; "broadcast_states" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">broadcast_states</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>point</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>namespace</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>key</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><FONT>value</FONT></TD></TR></TABLE></FONT>>]; "inheritance" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">inheritance</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>namespace</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><FONT>inheritance</FONT></TD></TR></TABLE></FONT>>]; "task_action_timers" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">task_action_timers</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>cycle</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>name</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>ctx_key</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><FONT>ctx</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>delays</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>num</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>delay</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>timeout</FONT></TD></TR></TABLE></FONT>>]; "task_events" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">task_events</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><FONT>name</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>cycle</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>time</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>submit_num</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>event</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>message</FONT></TD></TR></TABLE></FONT>>]; "task_jobs" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">task_jobs</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>cycle</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>name</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>submit_num</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><FONT>flow_nums</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>is_manual_submit</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>try_num</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>time_submit</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>time_submit_exit</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>submit_status</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>time_run</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>time_run_exit</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>run_signal</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>run_status</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>platform_name</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>job_runner_name</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>job_id</FONT></TD></TR></TABLE></FONT>>]; "task_late_flags" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">task_late_flags</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>cycle</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>name</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><FONT>value</FONT></TD></TR></TABLE></FONT>>]; "task_outputs" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">task_outputs</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>cycle</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>name</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>flow_nums</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><FONT>outputs</FONT></TD></TR></TABLE></FONT>>]; "task_pool" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">task_pool</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>cycle</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>name</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>flow_nums</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><FONT>status</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>is_held</FONT></TD></TR></TABLE></FONT>>]; "task_prerequisites" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">task_prerequisites</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>cycle</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>name</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>flow_nums</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>prereq_name</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>prereq_cycle</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>prereq_output</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><FONT>satisfied</FONT></TD></TR></TABLE></FONT>>]; "task_states" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">task_states</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>name</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>cycle</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>flow_nums</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><FONT>time_created</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>time_updated</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>submit_num</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>status</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>flow_wait</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>is_manual_submit</FONT></TD></TR></TABLE></FONT>>]; "task_timeout_timers" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">task_timeout_timers</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>cycle</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>name</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><FONT>timeout</FONT></TD></TR></TABLE></FONT>>]; "tasks_to_hold" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">tasks_to_hold</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><FONT>name</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>cycle</FONT></TD></TR></TABLE></FONT>>]; "workflow_flows" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">workflow_flows</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>flow_num</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><FONT>start_time</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>description</FONT></TD></TR></TABLE></FONT>>]; "workflow_params" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">workflow_params</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>key</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><FONT>value</FONT></TD></TR></TABLE></FONT>>]; "workflow_template_vars" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">workflow_template_vars</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>key</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><FONT>value</FONT></TD></TR></TABLE></FONT>>]; "xtriggers" [label=<<FONT FACE="Helvetica"><TABLE BORDER="0" CELLBORDER="1" CELLPADDING="4" CELLSPACING="0"><TR><TD><B><FONT POINT-SIZE="16">xtriggers</FONT></B></TD></TR><TR><TD ALIGN="LEFT"><u><FONT>signature</FONT></u></TD></TR><TR><TD ALIGN="LEFT"><FONT>results</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>absolute_outputs</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>broadcast_events</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>broadcast_states</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>inheritance</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>tasks_to_hold</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>workflow_flows</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>workflow_params</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>workflow_template_vars</FONT></TD></TR><TR><TD ALIGN="LEFT"><FONT>xtriggers</FONT></TD></TR></TABLE></FONT>>]; "task_states" -- "task_events" [taillabel=<<FONT>0..N</FONT>>,headlabel=<<FONT>{0,1}</FONT>>]; "task_states" -- "task_jobs" [taillabel=<<FONT>0..N</FONT>>,headlabel=<<FONT>{0,1}</FONT>>]; "task_pool" -- "task_action_timers" [taillabel=<<FONT>0..N</FONT>>,headlabel=<<FONT>{0,1}</FONT>>]; "task_pool" -- "task_late_flags" [taillabel=<<FONT>{0,1}</FONT>>,headlabel=<<FONT>{0,1}</FONT>>]; "task_pool" -- "task_outputs" [taillabel=<<FONT>0..N</FONT>>,headlabel=<<FONT>{0,1}</FONT>>]; "task_pool" -- "task_prerequisites" [taillabel=<<FONT>0..N</FONT>>,headlabel=<<FONT>{0,1}</FONT>>]; "task_pool" -- "task_timeout_timers" [taillabel=<<FONT>{0,1}</FONT>>,headlabel=<<FONT>{0,1}</FONT>>]; subgraph { rank=same rankdir=LR "absolute_outputs" "broadcast_events" "broadcast_states" "inheritance" "tasks_to_hold" "workflow_flows" "workflow_params" "workflow_template_vars" "xtriggers" } }