let additional_queries target =
let module Target = Ketrew_target in
match Target.(build_process target) with
| `Long_running (plugin, _) ->
begin match Target.latest_run_parameters target with
| Some rp ->
begin match find_plugin plugin with
| Some m ->
let module Long_running = (val m : LONG_RUNNING) in
begin try
let c = Long_running.deserialize_exn rp in
Long_running.additional_queries c
with e ->
let log = Log.(s "Serialization exception: " % exn e) in
Log.(log @ error);
[]
end
| None ->
let log = Log.(s "Plugin not found: " % sf "%S" plugin) in
Log.(log @ error);
[]
end
| None ->
Log.(s "Target has no run-parameters: " % Target.log target @ error);
[]
end
| other -> []