File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
src/clj/metafacture_playground Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 141141 :prep-tasks [" compile" [" release" ]]}}
142142
143143 :prep-tasks []
144+ :timeout [300000 ] ; after 5 minutes cancel the processing of a workflow
144145 :jvm-opts [" -Dclojure.tools.logging.factory=clojure.tools.logging.impl/slf4j-factory" ])
Original file line number Diff line number Diff line change 2020 (log/trace " Content" content)
2121 file-path))))
2222
23-
24- (defn process [flux data transformation]
23+ (defn process-in-timeout [flux data transformation]
2524 (let [inputfile (content->tempfile-path data " .data" )
2625 transformationFile (content->tempfile-path transformation " .fix" )
2726 out-path (content->tempfile-path " " " .txt" )
3433 (Flux/main (into-array [(content->tempfile-path flux " .flux" )]))
3534 (log/info " Executed flux file with Flux/main. Result in" out-path)
3635 (slurp out-path)))
36+
37+ (defn process
38+ " Runs process with a maximum wait of 1 min. Returns result or ::timeout."
39+ [flux data transformation]
40+ (let [fut (future (process-in-timeout flux data transformation))
41+ result (deref fut 60000 ::timeout )]
42+ (when (= result ::timeout )
43+ (future-cancel fut))
44+ result))
You can’t perform that action at this time.
0 commit comments