def read(db: SQL.Database): Session_Context = { def ignore_error(msg: String) = {
progress.echo_warning( "Ignoring bad database " + db + " for session " + quote(name) +
if_proper(msg, ":\n" + msg))
default
} try { val command_timings = store.read_command_timings(db, name) val elapsed = Time.seconds(Markup.Elapsed.get(store.read_session_timing(db, name))) new Session_Context(
name, deps, ancestors, session_prefs, sources_shasum, timeout,
elapsed, command_timings, build_uuid)
} catch { case ERROR(msg) => ignore_error(msg) case exn: java.lang.Error => ignore_error(Exn.message(exn)) case _: XML.Error => ignore_error("XML.Error")
}
}
database_server match { case Some(db) => if (store.session_info_exists(db)) read(db) else default case None => using_option(store.try_open_database(name))(read) getOrElse default
}
}
}
def clean_process_output(): Unit = synchronized {
process_output_file.delete
}
/* options */
val build_progress_delay: Time = session_options.seconds("build_progress_delay") val build_timing_threshold: Time = session_options.seconds("build_timing_threshold") val editor_timing_threshold: Time = session_options.seconds("editor_timing_threshold")
privatedef nodes_status_progress(state: Document.State = get_state()): Unit = { val result =
synchronized { lazyval now = progress.now() for (id <- state.progress_theories if !nodes_changed(id)) nodes_changed += id val nodes_status1 =
nodes_changed.foldLeft(nodes_status)({ case (status, state_id) =>
state.theory_snapshot(state_id, build_blobs) match { case None => status case Some(snapshot) =>
Exn.Interrupt.expose()
status.update_node(now,
snapshot.state, snapshot.version, snapshot.node_name,
threshold = editor_timing_threshold)
}
}) val result = if (nodes_changed.isEmpty) None else {
Some(Progress.Nodes_Status(now,
nodes_domain, nodes_status1,
session = resources.session_background.session_name,
old = Some(nodes_status)))
}
privateval future_result: Future[Result] =
Future.thread("build", uninterruptible = true) { val info = session_background.sessions_structure(session_name) val options = Host.node_options(info.options, node_info) val store = build_context.store
val session_sources =
Store.Sources.load(session_background.base, cache = store.cache.compress)
val env =
Isabelle_System.Settings.env(
List("ISABELLE_ML_DEBUGGER" -> options.bool("ML_debugger").toString))
val session_heaps =
session_background.info.parent match { case None => Nil case Some(logic) => store.session_heaps(session_background, logic = logic)
}
val use_prelude = if (session_heaps.isEmpty) Thy_Header.ml_roots.map(_._1) else Nil
val eval_store = if (store_heap) {
(if (info.theories.nonEmpty) List("ML_Heap.share_common_data ()") else Nil) :::
List("ML_Heap.save_child " +
ML_Syntax.print_string_bytes(File.platform_path(store.output_heap(session_name))))
} else Nil
def session_blobs(node_name: Document.Node.Name): List[(Command.Blob, Document.Blobs.Item)] =
session_background.base.theory_load_commands.get(node_name.theory) match { case None => Nil case Some(load_commands) => val syntax = session_background.base.theory_syntax(node_name) val master_dir = Path.explode(node_name.master_dir) for {
(command_span, command_offset) <- load_commands
file <- command_span.loaded_files(syntax).files
} yield { val src_path = Path.explode(file) val blob_name = Document.Node.Name(File.symbolic_path(master_dir + src_path))
val bytes = session_sources(blob_name.node).bytes val text = bytes.text val chunk = Symbol.Text_Chunk(text) val content = Some((SHA1.digest(bytes), chunk))
for ((blob_name, i) <- snapshot.node_files.tail.zipWithIndex) { val xml = snapshot.switch(blob_name).xml_markup()
export_(Export.MARKUP + (i + 1), xml)
}
export_(Export.MARKUP, snapshot.xml_markup())
export_(Export.MESSAGES, snapshot.messages.map(_._1))
}
}
session.all_messages += Session.Consumer[Any]("build_session_output") { case msg: Prover.Output => val message = msg.message if (msg.is_system) session.resources.log(Protocol.message_text(message))
if (msg.is_stdout) {
session.synchronized { stdout ++= Symbol.encode(XML.content(message)) }
} elseif (msg.is_stderr) {
session.synchronized { stderr ++= Symbol.encode(XML.content(message)) }
} elseif (msg.is_exit) { val err = "Prover terminated" +
(msg.properties match { case Markup.Process_Result(result) => ": " + result.print_rc case _ => ""
})
session.errors(List(err))
} case _ =>
}
val result2 =
build_errors match { case Exn.Res(build_errs) => val errs = build_errs ::: document_errors if (errs.nonEmpty) {
result1.error_rc.output(
errs.flatMap(s => split_lines(Output.error_message_text(s))) :::
errs.map(Protocol.Error_Message_Marker.apply))
} elseif (progress.stopped && result1.ok) {
result1.copy(rc = Process_Result.RC.interrupt)
} else result1 case Exn.Exn(Exn.Interrupt()) => if (result1.ok) result1.copy(rc = Process_Result.RC.interrupt) else result1 case Exn.Exn(exn) => throw exn
}
val process_result = if (result2.ok) result2 elseif (was_timeout) result2.error(Output.error_message_text("Timeout")).timeout_rc elseif (result2.interrupted) result2.error(Output.error_message_text("Interrupt")) else result2
val store_session =
store.output_session(session_name, store_heap = process_result.ok && store_heap)
session.clean_process_output()
/* output heap */
val output_shasum =
store_session.heap match { case Some(path) => SHA1.shasum(ML_Heap.write_file_digest(path), session_name) case None => SHA1.no_shasum
}
val log_lines = process_result.out_lines.filterNot(Protocol_Message.Marker.test)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.