Skip to content

Commit

Permalink
add rake task for getting squeue text output (#841)
Browse files Browse the repository at this point in the history
Add a rake task for getting squeue text output to help with generating test fixtures.
  • Loading branch information
johrstrom authored Aug 26, 2024
1 parent 8d959b8 commit e6ba866
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"

require_relative 'lib/tasks/slurm'

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
17 changes: 17 additions & 0 deletions lib/tasks/slurm.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

require_relative '../ood_core'
require_relative '../ood_core/job/adapters/slurm'

namespace :slurm do

desc 'Get squeue output in the format this gem expects'
task :squeue do
fields = OodCore::Job::Adapters::Slurm::Batch.new.all_squeue_fields
args = OodCore::Job::Adapters::Slurm::Batch.new.squeue_args(options: fields.values)

single_job = `squeue #{args.join(' ')}`.split("\n")[0...2]

puts single_job
end
end

0 comments on commit e6ba866

Please sign in to comment.