Liking cljdoc? Tell your friends :D

std.scheduler.spawn


*defaults*clj


*delay*clj


*group*clj


*interval*clj


*job*clj


*spawn*clj


*spawn-id*clj


*timing*clj


add-jobclj

(add-job spawn job-id job)

adds job to the spawn

adds job to the spawn
raw docstring

clearclj

(clear runtime program-id)

clears the program and past spawn information

clears the program and past spawn information
raw docstring

count-jobsclj

(count-jobs spawn)

returns the number of jobs

returns the number of jobs
raw docstring

count-spawnclj

(count-spawn runtime program-id)

counts all running spawns

counts all running spawns
raw docstring

create-handlerclj

(create-handler {:keys [type] :as program} spawn)

creates a run handler

(create-handler (assoc defaults :type :basic) (create-spawn)) => fn?

creates a run handler

(create-handler (assoc *defaults* :type :basic)
                (create-spawn))
=> fn?
raw docstring

create-handler-basicclj

(create-handler-basic program spawn)

creates a basic handler

creates a basic handler
raw docstring

create-handler-constantclj

(create-handler-constant {:keys [args-fn] :as program} spawn)

creates a constant handler

creates a constant handler
raw docstring

create-spawnclj

(create-spawn)
(create-spawn {:keys [create-fn continue-fn interval global full state]
               :as program}
              spawn-id)

creates a new spawn

(-> (create-spawn (merge defaults {:interval 1}) "spawn.1") (spawn-info)) => {:id "spawn.1", :status :created, :duration "0ms", :jobs {:submitted 0 :succeeded 0 :errored 0 :waiting 0}, :state nil}

creates a new spawn

(-> (create-spawn (merge *defaults* {:interval 1})
                  "spawn.1")
    (spawn-info))
=> {:id "spawn.1", :status :created, :duration "0ms",
    :jobs {:submitted 0 :succeeded 0 :errored 0 :waiting 0}, :state nil}
raw docstring

earliest-spawnclj

(earliest-spawn runtime program-id)

returns earliest created spawn

returns earliest created spawn
raw docstring

get-all-spawnclj

(get-all-spawn runtime program-id)

returns all running spawns

returns all running spawns
raw docstring

get-jobclj

(get-job spawn job-id)
(get-job spawn job-id ks)

retrieves a job given key

(-> (doto (create-spawn) (add-job "j.1" {:id "j.1"}))

(get-job "j.1"))

=> {:id "j.1"}

retrieves a job given key

(-> (doto (create-spawn)
      (add-job "j.1" {:id "j.1"}))

    (get-job "j.1"))
=> {:id "j.1"}
raw docstring

get-programclj

(get-program runtime program-id)

gets the program given runtime and program-id

(get-program |rt3| :test-program) => {}

gets the program given runtime and program-id

(get-program |rt3| :test-program)
=> {}
raw docstring

get-propsclj

(get-props spawn)
(get-props spawn k)

gets the spawn prop given key

(-> (create-spawn) (get-props :submitted)) => 0

gets the spawn prop given key

(-> (create-spawn)
    (get-props :submitted))
=> 0
raw docstring

get-spawnclj

(get-spawn runtime program-id spawn-id)

gets running spawn with id

gets running spawn with id
raw docstring

get-stateclj

(get-state runtime program-id)

gets the global state for the program-id

(get-state |rt3| :test-program) => {}

gets the global state for the program-id

(get-state |rt3| :test-program)
=> {}
raw docstring

handler-runclj

(handler-run {:keys [args-fn main-fn merge-fn success-fn error-fn]}
             {:keys [state] :as spawn}
             {:keys [time return] job-id :id :as job})

handles the

(let [ret (h/incomplete) job {:id "j.0" :time 0 :return ret} spawn (doto (create-spawn) (add-job "j.0" job)) result {:task (handler-run defaults spawn job)}] (assoc result :return @ret :meta @(:output spawn))) => (contains-in {:task ["j.0" 0] :return nil :meta {:status :success, :data nil, :exception nil, :time 0, :start integer? :end integer?}})

handles the 

 (let [ret (h/incomplete)
       job {:id "j.0"
            :time 0
            :return ret}
       spawn (doto (create-spawn)
               (add-job "j.0" job))
       result {:task (handler-run *defaults* spawn job)}]
   (assoc result :return @ret :meta @(:output spawn)))
=> (contains-in {:task ["j.0" 0]
                  :return nil
                  :meta {:status :success,
                         :data nil, :exception nil,
                         :time 0,
                         :start integer?
                         :end integer?}})
raw docstring

kill-allclj

(kill-all runtime program-id)

kills all the running tasks

(-> (doto |rt3| (kill-all :test-program)) (count-spawn :test-program)) => 0

kills all the running tasks

(-> (doto |rt3|
      (kill-all :test-program))
    (count-spawn :test-program))
=> 0
raw docstring

kill-spawnclj

(kill-spawn runtime program-id spawn-id)

stops a spawn and all jobs

(kill-spawn |rt3| :test-program "s1") => spawn?

stops a spawn and all jobs

(kill-spawn |rt3| :test-program "s1")
=> spawn?
raw docstring

latestclj

(latest runtime program-id)

returns the latest active or past spawn

returns the latest active or past spawn
raw docstring

latest-spawnclj

(latest-spawn runtime program-id)

returns latest created spawn

returns latest created spawn
raw docstring

latest-stoppedclj

(latest-stopped runtime program-id)

returns the most recently stopped spawn

returns the most recently stopped spawn
raw docstring

list-job-idsclj

(list-job-ids spawn)

lists all job ids

lists all job ids
raw docstring

list-jobsclj

(list-jobs spawn)

list all jobs

list all jobs
raw docstring

list-spawnclj

(list-spawn runner program-id)
(list-spawn runtime program-id order)

lists all running spawns

lists all running spawns
raw docstring

list-stoppedclj

(list-stopped runtime program-id)

lists all stopped spawns

lists all stopped spawns
raw docstring

remove-jobclj

(remove-job spawn job-id)

removes a job given key

removes a job given key
raw docstring

runclj

(run runtime program-id)
(run runtime program-id opts spawn-id)

constructs and starts a spawn loop

constructs and starts a spawn loop
raw docstring

schedule-timingclj

(schedule-timing type props last)
(schedule-timing type props last now)

calculates the timing for the next schedule

(schedule-timing :constant {:interval 1000} 500 635) => [1500 865]

calculates the timing for the next schedule

(schedule-timing :constant {:interval 1000} 500 635)
=> [1500 865]
raw docstring

send-resultclj

(send-result {:keys [output] :as spawn} result)

sends the result to spawn output

sends the result to spawn output
raw docstring

set-propsclj

(set-props spawn k v & more)

updates the spawn props

(-> (create-spawn) (set-props :submitted inc :errored 4 :started true) (select-keys [:submitted :errored :started])) => {:submitted 1, :errored 4, :started true}

updates the spawn props

(-> (create-spawn)
    (set-props :submitted inc :errored 4 :started true)
    (select-keys [:submitted :errored :started]))
=> {:submitted 1, :errored 4, :started true}
raw docstring

spawn-infoclj

(spawn-info {:keys [id board props output state exit] :as spawn})

returns the spawn info

returns the spawn info
raw docstring

spawn-loopclj

(spawn-loop runtime
            {:keys [time-fn continue-fn] :as program}
            {:keys [props exit board] :as spawn})

creates a spawn loop

creates a spawn loop
raw docstring

spawn-save-pastclj

(spawn-save-past runtime program-id {spawn-id :id :as spawn})

helper function to move spawn from :running to :past

helper function to move spawn from :running to :past
raw docstring

spawn-statusclj

(spawn-status {:keys [props exit] :as spawn})

returns the spawn status

returns the spawn status
raw docstring

spawn?clj

(spawn? obj)

checks that object is a spawn

checks that object is a spawn
raw docstring

stop-allclj

(stop-all runtime program-id)

stops all the running tasks

(-> (doto |rt3| (stop-all :test-program)) (count-spawn :test-program)) => 0

stops all the running tasks

(-> (doto |rt3|
      (stop-all :test-program))
    (count-spawn :test-program))
=> 0
raw docstring

stop-spawnclj

(stop-spawn runtime program-id spawn-id)

stop a spawn and waits for jobs to finish

stop a spawn and waits for jobs to finish
raw docstring

update-jobclj

(update-job spawn job-id f & args)

updates a job given key

updates a job given key
raw docstring

wrap-scheduleclj

(wrap-schedule {:keys [type] :as program} {:keys [props] :as spawn} schedule-fn)

wrapper for the schedule function

wrapper for the schedule function
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close