(+default-cache ??)
()
default cache for storing procedure results
default cache for storing procedure results
(defprocedure name config & body)
defining a procedure
(defprocedure -hello- {:mode :sync} ([] (Thread/sleep 1000) :DONE))
(defprocedure -print-hello- {:id-fn :timestamp :arglist [:timestamp :params :instance] :params {:b 2}} ([t params instance] (println "INSTANCE: " instance) (Thread/sleep 500) (println "ENDED" t)))
defining a procedure (defprocedure -hello- {:mode :sync} ([] (Thread/sleep 1000) :DONE)) (defprocedure -print-hello- {:id-fn :timestamp :arglist [:timestamp :params :instance] :params {:b 2}} ([t params instance] (println "INSTANCE: " instance) (Thread/sleep 500) (println "ENDED" t)))
(invoke-base instance args)
constructs a standard procedure
(def -proc- {:handler + :result (promise)})
(invoke-base -proc- [1 2 3])
@(:result -proc-) => {:type :success, :data 6}
constructs a standard procedure (def -proc- {:handler + :result (promise)}) (invoke-base -proc- [1 2 3]) @(:result -proc-) => {:type :success, :data 6}
(invoke-intern-procedure name config body)
(invoke-intern-procedure _ name config body)
creates the form for defining the procedure
(invoke-intern-procedure '-hello- {:mode :sync} '([] (Thread/sleep 1000)))
creates the form for defining the procedure (invoke-intern-procedure '-hello- {:mode :sync} '([] (Thread/sleep 1000)))
(max-inputs func num)
finds the maximum number of inputs that a function can take
(max-inputs (fn ([a]) ([a b])) 4) => 2
(max-inputs (fn [& more]) 4) => 4
(max-inputs (fn ([a])) 0) => throws
finds the maximum number of inputs that a function can take (max-inputs (fn ([a]) ([a b])) 4) => 2 (max-inputs (fn [& more]) 4) => 4 (max-inputs (fn ([a])) 0) => throws
(procedure tk arglist)
creates a procedure for computation
@((procedure {:name "ID" :handler (fn [id params instance] ; (println (-> instance :retry :count)) (if (= 5 (-> instance :retry :count)) (-> instance :retry :count) (throw (Exception.)))) :retry {:handle [{:on #{Exception} :apply (fn [state e]) :limit (fn [state count]) :wait (fn [state count])}] :count 0 :state {:a 1 :b 2} :limit 10 :wait 100}} [:id :params :instance]) "ID" {} {:mode :async :cached false}) => 5
creates a procedure for computation @((procedure {:name "ID" :handler (fn [id params instance] ; (println (-> instance :retry :count)) (if (= 5 (-> instance :retry :count)) (-> instance :retry :count) (throw (Exception.)))) :retry {:handle [{:on #{Exception} :apply (fn [state e]) :limit (fn [state count]) :wait (fn [state count])}] :count 0 :state {:a 1 :b 2} :limit 10 :wait 100}} [:id :params :instance]) "ID" {} {:mode :async :cached false}) => 5
(procedure-display proc)
displays the procedure
displays the procedure
(procedure-invoke {:keys [id-fn handler arglist time] :as procedure} & args)
the full invocation for the procedure, incorporating middleware and retry
the full invocation for the procedure, incorporating middleware and retry
(procedure-kill {:keys [registry name id]})
kills a running procedure (def -proc- ((procedure {:name "hello" :id :1 :handler (fn [] (Thread/sleep 1000000000))} [])))
(Thread/sleep 100) (procedure-kill -proc-) => true
kills a running procedure (def -proc- ((procedure {:name "hello" :id :1 :handler (fn [] (Thread/sleep 1000000000))} []))) (Thread/sleep 100) (procedure-kill -proc-) => true
(procedure-running? {:keys [thread] :as p})
checks if a procedure is running
(def -proc- ((procedure {:name "hello" :id :1 :handler (fn [] (Thread/sleep 1000000000))} [])))
(procedure-running? -proc-) => true
checks if a procedure is running (def -proc- ((procedure {:name "hello" :id :1 :handler (fn [] (Thread/sleep 1000000000))} []))) (procedure-running? -proc-) => true
(wrap-exception f)
creates a handler for retrying computation
creates a handler for retrying computation
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close