Segregate lola logs to a specific directory

This commit is contained in:
Jeremy Dormitzer 2019-11-22 18:20:25 -05:00
parent 273b1f4fe0
commit bc9f4d5d3c

View File

@ -3305,10 +3305,18 @@ Some functions to make my day job easier.
(substitute-in-file-name (format "$WORKON_HOME/%s/bin/activate" venv))
callback))
(defun get-latest-log ()
(car (last (directory-files default-directory
nil
"[[:digit:]-]+T[[:digit:]:]+\\.log"))))
(defun get-latest-lola-log (prefix)
(lambda ()
(concat
"~/lola/logs/"
(car (last (directory-files "~/lola/logs"
nil
(concat prefix "[[:digit:]-]+T[[:digit:]:]+\\.log")))))))
(defun lola-log-file (prefix)
(format "~/lola/logs/%s%s.log"
prefix
(format-time-string "%Y-%m-%dT%H:%M:%S")))
(defun python-service-setup (venv &optional env-file)
(lambda (done)
@ -3332,9 +3340,9 @@ Some functions to make my day job easier.
(format
"gunicorn -c server/web/gunicorn.conf.py \
-b 127.0.0.1:7200 bin.start_web:init_and_create_flask_app\\(\\) \
&> %s.log"
(format-time-string "%Y-%m-%dT%H:%M:%S"))))
:file #'get-latest-log
&> %s"
(lola-log-file "lola-server-"))))
:file (get-latest-lola-log "lola-server-")
:inhibit-process-filter t
:cwd "~/lola/lola-server"
:stop-signal 'int
@ -3360,10 +3368,10 @@ Some functions to make my day job easier.
:args (lambda ()
(list
"-c"
(format "python bin/start_web.py &> %s.log"
(format-time-string "%Y-%m-%dT%H:%M:%S"))))
(format "python bin/start_web.py &> %s"
(lola-log-file "travel-svc-"))))
:cwd "~/lola/lola-travel-service"
:file #'get-latest-log
:file (get-latest-lola-log "travel-svc-")
:inhibit-process-filter t
:stop-signal 'int
:truncate-output t
@ -3373,10 +3381,17 @@ Some functions to make my day job easier.
(prodigy-define-service
:name "travel-service celery worker"
:tags '(lola)
:command "python"
:args '("bin/start_celery_workers.py"
"-Q"
"default,io_pool,cpu_pool,priority_io_pool,priority_cpu_pool")
:command "bash"
:args (lambda ()
(list
"-c"
(concat "python "
"bin/start_celery_workers.py "
"-Q "
"default,io_pool,cpu_pool,priority_io_pool,priority_cpu_pool "
(format "&> %s" (lola-log-file "travel-svc-celery-")))))
:file (get-latest-lola-log "travel-svc-celery-")
:inhibit-process-filter t
:cwd "~/lola/lola-travel-service"
:stop-signal 'int
:truncate-output t