Skip to content

Commit

Permalink
s/workflow/workload
Browse files Browse the repository at this point in the history
  • Loading branch information
richhickey committed Jan 17, 2025
1 parent 81794e9 commit c5a524c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions src/main/clojure/clojure/core/async/flow.clj
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
:mixed-exec/:io-exec/:compute-exec -> ExecutorService
These can be used to specify the ExecutorService to use for the
corresonding workflow, in lieu of the lib defaults.
corresonding workload, in lieu of the lib defaults.
N.B. The flow is not started. See 'start'"
[config] (impl/create-flow config))
Expand Down Expand Up @@ -210,18 +210,18 @@
fn.
process accepts an option map with keys:
:workflow - one of :mixed, :io or :compute
:compute-timeout-ms - if :workflow is :compute, this timeout (default 5000 msec)
:workload - one of :mixed, :io or :compute
:compute-timeout-ms - if :workload is :compute, this timeout (default 5000 msec)
will be used when getting the return from the future - see below
A :workflow supplied as an option to process will override
any :workflow returned by the :describe fn of the process. If neither
A :workload supplied as an option to process will override
any :workload returned by the :describe fn of the process. If neither
are provded the default is :mixed.
The :compute workload is not allowed for proc impls that
provide :introduce (as I/O is presumed).
In the :workflow context of :mixed or :io, this dictates the type of
In the :workload context of :mixed or :io, this dictates the type of
thread in which the process loop will run, _including its calls to
transform/introduce_.
Expand All @@ -237,7 +237,7 @@
When :compute is specified transform must not block!"
([process-impl-map] (process process-impl-map nil))
([process-impl-map {:keys [workflow timeout-ms]
([process-impl-map {:keys [workload timeout-ms]
:or {timeout-ms 5000} :as opts}]
(impl/proc process-impl-map opts)))

Expand Down
12 changes: 6 additions & 6 deletions src/main/clojure/clojure/core/async/flow/impl.clj
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,13 @@

(defn proc
"see lib ns for docs"
[{:keys [describe init transition transform introduce] :as impl} {:keys [workflow compute-timeout-ms]}]
[{:keys [describe init transition transform introduce] :as impl} {:keys [workload compute-timeout-ms]}]
(assert (= 1 (count (keep identity [transform introduce]))) "must provide exactly one of :transform or :introduce")
(let [{:keys [params ins] :as desc} (describe)
workflow (or workflow (:workflow desc) :mixed)]
workload (or workload (:workload desc) :mixed)]
(assert (not (and ins introduce)) "can't specify :ins when :introduce")
(assert (or (not params) init) "must have :init if :params")
(assert (not (and introduce (= workflow :compute))) "can't specify :introduce and :compute")
(assert (not (and introduce (= workload :compute))) "can't specify :introduce and :compute")
(reify
clojure.core.protocols/Datafiable
(datafy [_]
Expand All @@ -229,11 +229,11 @@
spi/ProcLauncher
(describe [_] desc)
(start [_ {:keys [pid args ins outs resolver]}]
(let [comp? (= workflow :compute)
transform (cond-> transform (= workflow :compute)
(let [comp? (= workload :compute)
transform (cond-> transform (= workload :compute)
#(.get (futurize transform {:exec (spi/get-exec resolver :compute)})
compute-timeout-ms TimeUnit/MILLISECONDS))
exs (spi/get-exec resolver (if (= workflow :mixed) :mixed :io))
exs (spi/get-exec resolver (if (= workload :mixed) :mixed :io))
io-id (zipmap (concat (vals ins) (vals outs)) (concat (keys ins) (keys outs)))
control (::flow/control ins)
;;TODO rotate/randomize after control per normal alts?
Expand Down

0 comments on commit c5a524c

Please sign in to comment.