Skip to content

Commit

Permalink
force utf-8 encoding to avoid non-ASCII character errors (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
johrstrom authored Aug 23, 2024
1 parent 63c2b3c commit 3bb5a24
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/slurm_squeue_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ def gpu_jobs_pending
end

def cluster_info
sinfo_out = sinfo.split('/')
sinfo_out = sinfo.to_s.force_encoding('UTF-8').split('/')
running_jobs = 0
pending_jobs = 0
squeue_jobs_running.split("\n").each{ |line| running_jobs += 1 }
squeue_jobs_pending.split("\n").each{ |line| pending_jobs += 1 }
squeue_jobs_running.to_s.force_encoding('UTF-8').split("\n").each{ |line| running_jobs += 1 }
squeue_jobs_pending.to_s.force_encoding('UTF-8').split("\n").each{ |line| pending_jobs += 1 }

sinfo_out.each{ |line|
# Strip extra chars returned by Slurm
Expand Down Expand Up @@ -210,6 +210,8 @@ def setup
rescue => e
# TODO Add logging and a flash message that was removed from the controller
# SlurmSqueueClientNotAvailable.new(cluster_id, cluster_title, e)
warn("error occured #{e}:#{e.message}")
warn(e.backtrace.join("\n"))
end

# Return the active jobs as percent of available jobs
Expand Down

0 comments on commit 3bb5a24

Please sign in to comment.