X-Git-Url: https://code.consxy.com/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Faws%2Faws.lisp;h=ad224af7439ad7b56ba4ba2a0e17f0cc79fc6935;hb=a50fef6f3bacc24a838e81092104f3082b15bad4;hp=1d3745b27cd59886ad20722d5332710c0ca5b3ad;hpb=3fdc12a393fbbd099417398018d2fada7e751358;p=candle diff --git a/src/main/aws/aws.lisp b/src/main/aws/aws.lisp index 1d3745b..ad224af 100644 --- a/src/main/aws/aws.lisp +++ b/src/main/aws/aws.lisp @@ -26,6 +26,7 @@ (values-list retn)))) (defun start-shutdown-thread () + (log:info "Starting AWS shutdown thread") (sb-thread:make-thread (lambda () (loop @@ -40,15 +41,21 @@ (sleep 30))) :name "AWS Shutdown Thread")) +(defmethod candle:shutdown-system ((job-system (eql :aws))) + (log:info "Shutting down AWS box for exit") + ; If there's a job going, we need to wait for it to finish + (sb-thread:with-mutex (*aws-mutex*)) + (stop-aws-box)) + (defun aws-command (cmd &rest args) (with-output-to-string (out) - (sb-ext:run-program - *aws-exec* - (append - (list "ec2" cmd) - args) - :output out - :error *error-output*))) + (sb-ext:run-program + *aws-exec* + (append + (list "ec2" cmd) + args) + :output out + :error *error-output*))) (defun describe-property (property) (read-from-string @@ -95,22 +102,22 @@ (let* ((out nil) (code nil)) - (setf out - (with-output-to-string (out-str) - (setf code - (sb-ext:process-exit-code - (sb-ext:run-program - *ssh-exec* - (list - "-o" - "StrictHostKeyChecking=no" - "-o" - "UserKnownHostsFile=/dev/null" - "-i" - *aws-keyfile* - (describe-property "PublicIpAddress") - (format nil "cd ~A ; ~A run" *remote-work-dir* *remote-candle-location*)) - :output out-str - :error out-str - :wait t))))) - (values (zerop code) out))) + (setf out + (with-output-to-string (out-str) + (setf code + (sb-ext:process-exit-code + (sb-ext:run-program + *ssh-exec* + (list + "-o" + "StrictHostKeyChecking=no" + "-o" + "UserKnownHostsFile=/dev/null" + "-i" + *aws-keyfile* + (describe-property "PublicIpAddress") + (format nil "cd ~A ; ~A run" *remote-work-dir* *remote-candle-location*)) + :output out-str + :error out-str + :wait t))))) + (values (zerop code) out)))