Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
a0s committed Feb 27, 2021
1 parent 1ebfcc7 commit 2d318d5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ FROM ruby:3.0.0-buster
ENV LANG C.UTF-8
ENV DEBIAN_FRONTEND noninteractive

ENV NVIDIA_PUB_KEY "http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub"
ENV NVIDIA_REPO "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 /"
ENV NVIDIA_PUB_KEY "https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub"
ENV NVIDIA_REPO "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64 /"

WORKDIR /app

Expand All @@ -13,7 +13,7 @@ COPY \
Gemfile.lock \
application.rb \
exporter.rb \
nvidia_smi.rb \
n_vidia_smi.rb \
./

RUN \
Expand Down
2 changes: 1 addition & 1 deletion application.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'open3'
require_relative 'nvidia_smi'
require_relative 'n_vidia_smi'
require_relative 'exporter'

class Application
Expand Down
2 changes: 1 addition & 1 deletion exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Exporter < Sinatra::Base
get '/metrics' do
content_type 'text/plain'

nvidia_smi = NvidiaSMI.new(
nvidia_smi = NVidiaSMI.new(
binary_path: ENV['NVIDIA_SMI_EXPORTER_BINARY'],
name_prefix: ENV['NVIDIA_SMI_EXPORTER_NAME_PREFIX'],
query_list: ENV['NVIDIA_SMI_EXPORTER_QUERY'].to_s.split(','))
Expand Down
2 changes: 1 addition & 1 deletion nvidia_smi.rb → n_vidia_smi.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'active_support/core_ext/object/blank'

class NvidiaSMI
class NVidiaSMI
attr_reader :binary_path, :name_prefix, :query_list

def initialize(binary_path:, query_list:, name_prefix: nil)
Expand Down
2 changes: 1 addition & 1 deletion spec/nvidia_smi_spec.rb → spec/n_vidia_smi_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require_relative 'spec_helper'

describe NvidiaSMI do
describe NVidiaSMI do
describe '#parser' do
it { expect(subject.parse(fixture_load('stdout1.txt'))).to eq(JSON.load(fixture_load('result1.json'))) }
it { expect(subject.parse(fixture_load('stdout2.txt'))).to eq(JSON.load(fixture_load('result2.json'))) }
Expand Down

0 comments on commit 2d318d5

Please sign in to comment.