From 96537e39ae2faa4c7801423055db26b86f875431 Mon Sep 17 00:00:00 2001 From: Nat Lasseter Date: Mon, 2 Mar 2020 14:30:43 +0000 Subject: Broke apart job running and metric collection. Jobs are now picked up automagically from lib/jobs --- lib/longboat/jobs/slurm_job_states.rb | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 lib/longboat/jobs/slurm_job_states.rb (limited to 'lib/longboat/jobs') diff --git a/lib/longboat/jobs/slurm_job_states.rb b/lib/longboat/jobs/slurm_job_states.rb deleted file mode 100644 index 74c7999..0000000 --- a/lib/longboat/jobs/slurm_job_states.rb +++ /dev/null @@ -1,31 +0,0 @@ -module Longboat - module Jobs - class SlurmJobStates - def initialize(collector) - @collector = collector - @collector.register!(self) - end - - def run - start_time = (Time.now - 15 * 60).strftime("%H:%M:%S") - raw = `sacct -a -P -o State -S #{start_time}`.lines.map(&:strip)[1..-1] - - tally = Hash.new{0} - - raw.each do |state| - tally[state] += 1 - end - - tally.each do |state, number| - @collector.report!( - "longboat_slurm_job_states", - number, - help: "Number of jobs in each state", - type: "gauge", - labels: {state: state} - ) - end - end - end - end -end -- cgit v1.2.1