std.scheduler
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-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-state
(get-state runner)(get-state runner id)gets the global state for the program-id
(get-state |rt3| :test-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-stopped
(latest-stopped runner)(latest-stopped runner id)returns the most recently stopped spawn
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: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:stopped?
added in 3.0
(runner:stopped? {:keys [runtime], :as runner})checks if runner has stopped
(-> (doto |run| (runner:kill)) (runner:stopped?)) => 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