std.scheduler

*no-limit*

dynamic

clear

(clear runner)(clear runner id)

clears the program and past spawn information

count-spawn

(count-spawn runner)(count-spawn runner id)

counts all running spawns

create-program

added in 3.0

(create-program program)

creates a runner program

(create-program {:type :constant :id :hello :interval 10})

earliest-spawn

(earliest-spawn runner)(earliest-spawn runner id)

returns earliest created spawn

get-all-spawn

(get-all-spawn runner)(get-all-spawn runner id)

returns all running spawns

get-program

(get-program runner)(get-program runner id)

gets the program given runtime and program-id

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

get-props

added in 3.0

(get-props {:keys [runtime], :as runner} program-id)(get-props {:keys [runtime], :as runner} program-id spawn-id)

gets the current props map for the runner

get-spawn

(get-spawn runner program-id spawn-id)

gets running spawn with id

get-state

(get-state runner)(get-state runner id)

gets the global state for the program-id

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

install

added in 3.0

(install {:keys [runtime], :as runner} program)

installs a program

installed?

added in 3.0

(installed? {:keys [runtime], :as runner} program-id)

checks if program is installed

(test-scaffold (fn runner _ (installed? runner :world))) => true

kill-all-spawn

(kill-all-spawn runner)(kill-all-spawn runner id)

kills all the running tasks

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

kill-spawn

(kill-spawn runner program-id spawn-id)

stops a spawn and all jobs

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

latest

(latest runner)(latest runner id)

returns the latest active or past spawn

latest-spawn

(latest-spawn runner)(latest-spawn runner id)

returns latest created spawn

latest-stopped

(latest-stopped runner)(latest-stopped runner id)

returns the most recently stopped spawn

list-spawn

(list-spawn runner)(list-spawn runner id)

lists all running spawns

list-stopped

(list-stopped runner)(list-stopped runner id)

lists all stopped spawns

runner

added in 3.0

(runner)(runner m)

creates and starts a runner

(-> (runner {:id “runner”}) (h/comp:kill))

runner:create

added in 3.0

(runner:create)(runner:create m)

creates a runner

(runner:create {:id “runner”}) => runner?

runner:health

added in 3.0

(runner:health runner)

returns health of runner

(runner:health |run|) => {:status :ok}

runner:info

added in 3.0

(runner:info {:keys [runtime], :as runner})

returns runner info

(h/with:component runner (runner:create {}) (runner:info runner)) => {:executors {:core {:threads 0, :active 0, :queued 0, :terminated false}, :scheduler {:threads 0, :active 0, :queued 0, :terminated false}}, :programs {}}

runner:kill

added in 3.0

(runner:kill {:keys [runtime], :as runner})

kills the runner

runner:start

added in 3.0

(runner:start {:keys [runtime], :as runner})

starts up the runner

(-> (runner:start |runner|) (runner:info)) => {:executors {:core {:threads 0, :active 0, :queued 0, :terminated false}, :scheduler {:threads 0, :active 0, :queued 0, :terminated false}}, :programs {}}

runner:started?

added in 3.0

(runner:started? {:keys [runtime], :as runner})

checks if runner is started

(runner:started? |run|) => true

runner:stop

added in 3.0

(runner:stop {:keys [runtime], :as runner})

stops the runner

runner:stopped?

added in 3.0

(runner:stopped? {:keys [runtime], :as runner})

checks if runner has stopped

(-> (doto |run| (runner:kill)) (runner:stopped?)) => true

runner?

added in 3.0

(runner? obj)

checks if object is a runner

(runner? |run|) => true

set-interval

added in 3.0

(set-interval {:keys [runtime], :as runner} program-id interval)(set-interval {:keys [runtime], :as runner} program-id spawn-id interval)

manually overrides the interval for a spawn/program

spawn

added in 3.0

(spawn runner program-id)(spawn {:keys [runtime], :as runner} program-id opts spawn-id)

spawns a runner that contains the program

stop-all-spawn

(stop-all-spawn runner)(stop-all-spawn runner id)

stops all the running tasks

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

stop-spawn

(stop-spawn runner program-id spawn-id)

stop a spawn and waits for jobs to finish

trigger

added in 3.0

(trigger runner program-id)(trigger runner program-id t)

triggers the program manually, without spawning

(test-scaffold (fn runner q (trigger runner :world) (trigger runner :world) (count q))) => 2

uninstall

added in 3.0

(uninstall {:keys [runtime], :as runner} program-id)

uninstalls a program

unspawn

added in 3.0

(unspawn {:keys [runtime], :as runner} program-id)

unspawns the running program