X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fdaemon.ml;h=6e6a5fd9634631ef433eaeeadc6e5fc97e1c6e60;hb=50a4457bd64045abfdc88237a934fadff0bb7f84;hp=ac0f1ff7e7f5ffb45791f6ae82d631144f6d47a1;hpb=2ce29ff559f9bc36733ab2dde5b657eaa76ea8a6;p=whenjobs.git diff --git a/daemon/daemon.ml b/daemon/daemon.ml index ac0f1ff..6e6a5fd 100644 --- a/daemon/daemon.ml +++ b/daemon/daemon.ml @@ -78,6 +78,7 @@ let rec init j d = ~proc_get_jobs ~proc_cancel_job ~proc_start_job + ~proc_get_job (Rpc_server.Unix addr) Rpc.Tcp (* not TCP, this is the same as SOCK_STREAM *) Rpc.Socket @@ -167,6 +168,18 @@ and proc_start_job jobname = | Not_found -> `error "job not found" | exn -> `error (Printexc.to_string exn) +and proc_get_job serial = + try + let serial = big_int_of_string serial in + let pid = BigIntMap.find serial !serialmap in + let job, dir, serial, start_time = IntMap.find pid !runningmap in + { Whenproto_aux.job_name = job.job_name; + job_serial = string_of_big_int serial; + job_tmpdir = dir; job_start_time = Int64.of_float start_time } + with + | Not_found -> failwith "job not found" + | exn -> failwith (Printexc.to_string exn) + (* Reload the jobs file. *) and reload_file () = let file = sprintf "%s/jobs.cmo" !jobsdir in @@ -192,6 +205,7 @@ and reload_file () = | exn -> failwith (Printexc.to_string exn) in + let s = Whenstate.copy_prev_state !state s in state := s; (* Re-evaluate all when jobs. *)