Skip to content

lha and systemd use native symbols and enforce native symbols - #1041

Open
johrstrom wants to merge 2 commits into
masterfrom
lha-submit-host-bug
Open

johrstrom wants to merge 2 commits into
masterfrom
lha-submit-host-bug

Conversation

@johrstrom

Copy link
Copy Markdown
Contributor

Please review our Contributing Guide before submitting a pull request.

What does this PR do?

This fixes #313 by using symbols against a native hash to extract submit_host_override

Related issue

Closes #313

Testing

  • Tests included
  • No tests needed — reason: ___

Checklist

  • Follows project code style and conventions
  • Documentation provided (if new feature, adapter or behavior change)
  • This is a large feature and was discussed in an issue first (if applicable)

Anything else?

Comments on specific changes below

@qos = qos && qos.to_s
@gpus_per_node = gpus_per_node && gpus_per_node.to_i
@native = native
@native = native.is_a?(Hash) ? native.symbolize_keys : native

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason the bug exists at all is because OnDemand symbolizes keys

https://github.com/OSC/ondemand/blob/a8120980652cae4b92c5bfb1afb49649d0c66da4/apps/dashboard/app/models/batch_connect/app.rb#L432

So I felt it's best to just symbolize keys here to enforce that within this code base.

Note that a test like this continues to work because even though strings are given, we cast to symbols here.

def test_submit_host_with_override
launcher = launcher_instance
script = build_script(native: { 'submit_host_override' => 'other.osc.edu' })
assert_equal('other.osc.edu', launcher.submit_host(script))
end

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

submit_host_override does not work for linuxhost adapter

1 participant