570 } |
570 } |
571 |
571 |
572 |
572 |
573 /* collective operations */ |
573 /* collective operations */ |
574 |
574 |
|
575 def all_tables: List[SQL.Table] = |
|
576 List( |
|
577 Base.table, |
|
578 Workers.table, |
|
579 Progress.table, |
|
580 Sessions.table, |
|
581 Pending.table, |
|
582 Running.table, |
|
583 Results.table, |
|
584 Host.Data.Node_Info.table) |
|
585 |
575 def init_database(db: SQL.Database, build_context: Build_Process.Context): Unit = { |
586 def init_database(db: SQL.Database, build_context: Build_Process.Context): Unit = { |
576 val tables = |
587 for (table <- all_tables) db.create_table(table) |
577 List( |
|
578 Base.table, |
|
579 Workers.table, |
|
580 Progress.table, |
|
581 Sessions.table, |
|
582 Pending.table, |
|
583 Running.table, |
|
584 Results.table, |
|
585 Host.Data.Node_Info.table) |
|
586 |
|
587 for (table <- tables) db.create_table(table) |
|
588 |
588 |
589 val old_pending = Data.read_pending(db) |
589 val old_pending = Data.read_pending(db) |
590 if (old_pending.nonEmpty) { |
590 if (old_pending.nonEmpty) { |
591 error("Cannot init build process, because of unfinished " + |
591 error("Cannot init build process, because of unfinished " + |
592 commas_quote(old_pending.map(_.name))) |
592 commas_quote(old_pending.map(_.name))) |
593 } |
593 } |
594 |
594 |
595 for (table <- tables) db.using_statement(table.delete())(_.execute()) |
595 for (table <- all_tables) db.using_statement(table.delete())(_.execute()) |
596 |
596 |
597 db.using_statement(Base.table.insert()) { stmt => |
597 db.using_statement(Base.table.insert()) { stmt => |
598 stmt.string(1) = build_context.build_uuid |
598 stmt.string(1) = build_context.build_uuid |
599 stmt.string(2) = Isabelle_System.getenv("ML_PLATFORM") |
599 stmt.string(2) = Isabelle_System.getenv("ML_PLATFORM") |
600 stmt.string(3) = build_context.store.options.make_prefs(Options.init(prefs = "")) |
600 stmt.string(3) = build_context.store.options.make_prefs(Options.init(prefs = "")) |