Skip to content
Snippets Groups Projects
Commit c3ebde15 authored by Rolf Niepraschk's avatar Rolf Niepraschk
Browse files

corr. check for python files

parent 975298b6
No related branches found
No related tags found
No related merge requests found
...@@ -4,10 +4,13 @@ ...@@ -4,10 +4,13 @@
(:require [devhub.config :as c] (:require [devhub.config :as c]
[cheshire.core :as che] [cheshire.core :as che]
[clojure.java.shell :refer [sh]] [clojure.java.shell :refer [sh]]
[clojure.java.io :as io]
[devhub.utils :as u] [devhub.utils :as u]
[com.brunobonacci.mulog :as µ])) [com.brunobonacci.mulog :as µ]))
(defn pp-file [conf task] (str (:PostScriptPy task) ".py")) (defn pp-file [conf task] (str (:PostScriptPy task) ".py"))
(defn pp-file-long [conf task] (str (:py-path conf) "/" (:PostScriptPy task) ".py"))
;;(defn pp-file-long [conf task] (str (:py-path conf) "/" (pp-file conf task)))
(defn exec (defn exec
"Executes a predefined *python3* script given with the `:PostScriptPy` key. "Executes a predefined *python3* script given with the `:PostScriptPy` key.
...@@ -24,8 +27,8 @@ ...@@ -24,8 +27,8 @@
```" ```"
[{conf :post} task] [{conf :post} task]
(let [ps (pp-file conf task)] (let [ps (pp-file conf task)]
(if-not (u/file? ps) (if-not (.exists (io/file (str (:py-path conf) "/" (pp-file conf task))))
(let [msg (str "no such postscript file: " ps)] (let [msg (str "no such postscript file: " (:py-path conf) "/" (pp-file conf task))]
(µ/log ::exec :error msg :req-id (:req-id task)) (µ/log ::exec :error msg :req-id (:req-id task))
(merge task {:error msg})) (merge task {:error msg}))
(let [res (sh (:py conf) ps (che/encode task) (che/encode (u/data task)) :dir (:py-path conf))] (let [res (sh (:py conf) ps (che/encode task) (che/encode (u/data task)) :dir (:py-path conf))]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment