mirror of
https://gitlab.com/scemama/qmcchem.git
synced 2024-12-21 20:03:31 +01:00
Cleaning after Ctrl-C
This commit is contained in:
parent
453a29d607
commit
b66cddbe4d
@ -833,12 +833,13 @@ let run ?(daemon=true) ezfio_filename =
|
||||
|
||||
(* Handle signals *)
|
||||
let handler s =
|
||||
Printf.printf "Dataserver received the %s signal... killing\n%!" (Signal.to_string s);
|
||||
Watchdog.kill ();
|
||||
in
|
||||
List.iter [
|
||||
Signal.int ;
|
||||
Signal.term ;
|
||||
Signal.quit ;
|
||||
Signal.int
|
||||
]
|
||||
~f:(fun x -> Signal.Expert.handle x handler)
|
||||
;
|
||||
|
@ -71,6 +71,7 @@ let run ezfio_filename dataserver =
|
||||
|
||||
let terminate () =
|
||||
(* Clean up the temp directory *)
|
||||
Watchdog.kill ();
|
||||
Unix.chdir Qmcchem_config.dev_shm;
|
||||
let command =
|
||||
Printf.sprintf "rm -rf -- \"%s\" " tmpdir
|
||||
@ -96,14 +97,13 @@ let run ezfio_filename dataserver =
|
||||
|
||||
(* Signal handler to Kill properly all the processes *)
|
||||
let handler s =
|
||||
Printf.printf "Forwarder received the %s signal... killing\n" (Signal.to_string s);
|
||||
Printf.printf "Forwarder received the %s signal... killing\n%!" (Signal.to_string s);
|
||||
terminate ();
|
||||
Watchdog.kill ();
|
||||
in
|
||||
List.iter [
|
||||
Signal.int ;
|
||||
Signal.term ;
|
||||
Signal.quit ;
|
||||
Signal.int
|
||||
]
|
||||
~f:(fun x -> Signal.Expert.handle x handler)
|
||||
;
|
||||
|
@ -7,8 +7,8 @@ let full_run ?(start_dataserver=true) ezfio_filename =
|
||||
and scheduler =
|
||||
Scheduler.find ()
|
||||
in
|
||||
Printf.printf "Scheduler : %s\n" (Scheduler.to_string scheduler);
|
||||
Printf.printf "Launcher : %s\n" (Launcher.to_string launcher );
|
||||
Printf.printf "Scheduler : %s\n%!" (Scheduler.to_string scheduler);
|
||||
Printf.printf "Launcher : %s\n%!" (Launcher.to_string launcher );
|
||||
|
||||
|
||||
(* Create the node file *)
|
||||
@ -147,13 +147,13 @@ let run a d ?q ?s ezfio_filename =
|
||||
|
||||
(* Signal handler to Kill properly all the processes *)
|
||||
let handler s =
|
||||
Printf.printf "Received the %s signal... killing\n" (Signal.to_string s);
|
||||
Printf.printf "QMC=Chem received the %s signal... killing\n%!" (Signal.to_string s);
|
||||
Watchdog.kill ();
|
||||
in
|
||||
List.iter [
|
||||
Signal.int ;
|
||||
Signal.term ;
|
||||
Signal.quit ;
|
||||
Signal.int
|
||||
]
|
||||
~f:(fun x -> Signal.Expert.handle x handler)
|
||||
;
|
||||
|
@ -8,7 +8,7 @@ let _threads = ref [] ;;
|
||||
let kill () =
|
||||
let kill pid =
|
||||
Signal.send_i Signal.int (`Pid pid);
|
||||
Printf.printf "Killed %d\n" (Pid.to_int pid)
|
||||
Printf.printf "Killed %d\n%!" (Pid.to_int pid)
|
||||
in
|
||||
List.iter ~f:kill (!_list);
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user