Skip to content

Commit

Permalink
Merge pull request #155 from OSC/linux-host-adapter
Browse files Browse the repository at this point in the history
Renames Fork to LinuxHost adapter
  • Loading branch information
ericfranz committed Oct 8, 2019
2 parents 05b5fe0 + 5a96c12 commit 09c3494
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
Expand Up @@ -51,10 +51,10 @@ def self.build_fork(config)
module Adapters
# An adapter object that describes the communication with a remote host
# for job management.
class Fork < Adapter
class LinuxHost < Adapter
using Refinements::ArrayExtensions

require "ood_core/job/adapters/fork/launcher"
require "ood_core/job/adapters/linux_host/launcher"

def initialize(ssh_hosts:, launcher:)
@launcher = launcher
Expand Down
Expand Up @@ -8,11 +8,11 @@
# Object used for simplified communication SSH hosts
#
# @api private
class OodCore::Job::Adapters::Fork::Launcher
class OodCore::Job::Adapters::LinuxHost::Launcher
attr_reader :debug, :site_timeout, :session_name_label, :singularity_bin,
:site_singularity_bindpath, :default_singularity_image, :ssh_hosts,
:strict_host_checking, :submit_host, :tmux_bin, :username
# The root exception class that all Fork adapter-specific exceptions inherit
# The root exception class that all LinuxHost adapter-specific exceptions inherit
# from
class Error < StandardError; end

Expand Down Expand Up @@ -195,7 +195,7 @@ def script_email_on_event(script, event)
).result(binding.tap {|bnd|
{
'email_recipients' => script.email.map{|addr| Shellwords.escape(addr)}.join(', '),
'job_name' => (script.job_name) ? script.job_name : 'Fork_Adapter_Job',
'job_name' => (script.job_name) ? script.job_name : 'LinuxHost_Adapter_Job',
'job_status' => event
}.each{
|key, value| bnd.local_variable_set(key, value)
Expand Down
Expand Up @@ -4,6 +4,6 @@ Greetings,
Your job <%= job_name %> has <%= job_status %>.
- The OnDemand Fork Adapter
- The OnDemand Linux Host Adapter
EMAIL_CONTENT
fi
@@ -1,9 +1,9 @@
require "spec_helper"
require "ood_core/job/adapters/fork"
require "ood_core/job/adapters/fork/launcher"
require "ood_core/job/adapters/linux_host"
require "ood_core/job/adapters/linux_host/launcher"


describe OodCore::Job::Adapters::Fork::Launcher do
describe OodCore::Job::Adapters::LinuxHost::Launcher do
def build_script(opts = {})
OodCore::Job::Script.new({
accounting_id: nil,
Expand Down Expand Up @@ -81,7 +81,7 @@ def content
it "raises an error" do
expect{
subject.start_remote_session(build_script({content: ""}))
}.to raise_error(OodCore::Job::Adapters::Fork::Launcher::Error)
}.to raise_error(OodCore::Job::Adapters::LinuxHost::Launcher::Error)
end
end

Expand All @@ -90,7 +90,7 @@ def content
allow(Open3).to receive(:capture3).and_return(['remote_host', '', exit_failure])
expect{
subject.start_remote_session(build_script)
}.to raise_error(OodCore::Job::Adapters::Fork::Launcher::Error)
}.to raise_error(OodCore::Job::Adapters::LinuxHost::Launcher::Error)
end
end
end
Expand Down Expand Up @@ -118,7 +118,7 @@ def content

expect{
subject.stop_remote_session('job', 'remote_host')
}.to raise_error(OodCore::Job::Adapters::Fork::Launcher::Error)
}.to raise_error(OodCore::Job::Adapters::LinuxHost::Launcher::Error)
end
end
end
Expand Down Expand Up @@ -185,7 +185,7 @@ def content

expect{
subject.list_remote_sessions
}.to raise_error(OodCore::Job::Adapters::Fork::Launcher::Error)
}.to raise_error(OodCore::Job::Adapters::LinuxHost::Launcher::Error)
end
end
end
Expand Down
@@ -1,7 +1,7 @@
require "spec_helper"
require "ood_core/job/adapters/fork"
require "ood_core/job/adapters/linux_host"

describe OodCore::Job::Adapters::Fork do
describe OodCore::Job::Adapters::LinuxHost do
let(:launcher) { double() }
let(:ssh_hosts) { [
'owens-login01.hpc.osc.edu',
Expand Down Expand Up @@ -157,8 +157,8 @@ def build_script(opts = {})
end
end

context "when OodCore::Job::Adapters::Fork::Launcher::Error is raised" do
before { expect(launcher).to receive(:start_remote_session).and_raise(OodCore::Job::Adapters::Fork::Launcher::Error) }
context "when OodCore::Job::Adapters::LinuxHost::Launcher::Error is raised" do
before { expect(launcher).to receive(:start_remote_session).and_raise(OodCore::Job::Adapters::LinuxHost::Launcher::Error) }

it "raises OodCore::JobAdapterError" do
expect { adapter.submit(build_script) }.to raise_error(OodCore::JobAdapterError)
Expand Down Expand Up @@ -216,8 +216,8 @@ def build_script(opts = {})
end
end

context "when OodCore::Job::Adapters::Fork::Launcher::Error is raised" do
before { expect(launcher).to receive(:list_remote_sessions).and_raise(OodCore::Job::Adapters::Fork::Launcher::Error) }
context "when OodCore::Job::Adapters::LinuxHost::Launcher::Error is raised" do
before { expect(launcher).to receive(:list_remote_sessions).and_raise(OodCore::Job::Adapters::LinuxHost::Launcher::Error) }

it "raises OodCore::JobAdapterError" do
expect { adapter.info_all }.to raise_error(OodCore::JobAdapterError)
Expand Down Expand Up @@ -303,8 +303,8 @@ def build_script(opts = {})
end
end

context "when OodCore::Job::Adapters::Fork::Launcher::Error is raised" do
before { expect(launcher).to receive(:stop_remote_session).and_raise(OodCore::Job::Adapters::Fork::Launcher::Error) }
context "when OodCore::Job::Adapters::LinuxHost::Launcher::Error is raised" do
before { expect(launcher).to receive(:stop_remote_session).and_raise(OodCore::Job::Adapters::LinuxHost::Launcher::Error) }

it "raises OodCore::JobAdapterError" do
expect { adapter.delete('jobid@owens-login01.hpc.osc.edu') }.to raise_error(OodCore::JobAdapterError)
Expand Down

0 comments on commit 09c3494

Please sign in to comment.