Skip to content

Commit

Permalink
fix lsf return nil for job info (#76)
Browse files Browse the repository at this point in the history
Fixes #75
  • Loading branch information
nickjer authored Jan 26, 2018
1 parent 38cdd5a commit f9a8099
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]
### Fixed
- Fixed bug where LSF adapter would sometimes return `nil` when getting job
info. [#75](https://github.com/OSC/ood_core/issues/75)
- Fixed list of allocated nodes for LSF adapter when single node is expanded
for each core. [#71](https://github.com/OSC/ood_core/issues/71)
- Clean up children processes in forked Batch Connect main script before
Expand Down
9 changes: 8 additions & 1 deletion lib/ood_core/job/adapters/lsf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,14 @@ def submit(script, after: [], afterok: [], afternotok: [], afterany: [])
def info(id)
# TODO: handle job arrays
job = batch.get_job(id: id)
job ? info_for_batch_hash(job) : nil
if job
info_for_batch_hash(job)
else
Info.new(
id: id,
status: :completed
)
end
rescue Batch::Error => e
raise JobAdapterError, e.message
end
Expand Down
8 changes: 8 additions & 0 deletions spec/job/adapters/lsf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ def build_script(opts = {})
it "returns running status with info attrs mapped" do
expect(adapter.info("542935")).to eq(expected_info)
end

context "when can't find job" do
let(:batch) { double(get_job: nil) }

it "returns completed OodCore::Job::Info object" do
expect(adapter.info("542935")).to eq(OodCore::Job::Info.new(id: "542935", status: :completed))
end
end
end

describe "#info_all" do
Expand Down

0 comments on commit f9a8099

Please sign in to comment.