~proc_cancel_job
~proc_start_job
~proc_get_job
+ ~proc_set_variables
(Rpc_server.Unix addr)
Rpc.Tcp (* not TCP, this is the same as SOCK_STREAM *)
Rpc.Socket
| Not_found -> failwith "job not found"
| exn -> failwith (Printexc.to_string exn)
+and proc_set_variables vars =
+ try
+ let vars = Array.map (
+ fun { Whenproto_aux.sv_name = name; sv_value = value } ->
+ name, variable_of_rpc value
+ ) vars in
+ let vars = Array.to_list vars in
+
+ if !debug then
+ Syslog.notice "remote call: set_variables (%s)"
+ (String.concat " "
+ (List.map (
+ fun (name, value) ->
+ sprintf "%s=%s" name (string_of_variable value)
+ ) vars));
+
+ List.iter (fun (name, _) -> check_valid_variable_name name) vars;
+
+ (* Update all the variables atomically. *)
+ let s = List.fold_left (
+ fun s (name, value) -> Whenstate.set_variable s name value
+ ) !state vars in
+ state := s;
+
+ (* Which jobs need to be re-evaluated? *)
+ let jobs = Whenstate.get_dependencies !state (List.map fst vars) in
+ reevaluate_whenjobs jobs;
+
+ `ok
+ with
+ Failure msg -> `error msg
+
(* Reload the jobs file. *)
and reload_file () =
let file = sprintf "%s/jobs.cmo" !jobsdir in
double f; /* C 'double' maps to an OCaml 'float' */
};
+struct set_variable {
+ variable_name sv_name;
+ variable sv_value;
+};
+typedef set_variable set_variable_list<>;
+
struct job {
job_name job_name;
string_big_int job_serial;
status cancel_job (string_big_int) = 7;
status start_job (job_name) = 8;
job get_job (string_big_int) = 9;
+ status set_variables (set_variable_list) = 10;
} = 1;
} = 0x20008081;