Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hostname doesn't give correct host all the time #42

Closed
nickjer opened this issue Jun 27, 2017 · 1 comment
Closed

Hostname doesn't give correct host all the time #42

nickjer opened this issue Jun 27, 2017 · 1 comment
Assignees
Labels

Comments

@nickjer
Copy link
Contributor

nickjer commented Jun 27, 2017

This line:

"host=$(hostname)\n[[ -e \"#{before_file}\" ]] && source \"#{before_file}\""

uses hostname to get the host of the machine.

At Arizona, this gives:

┌─[jnicklas@i1n5][~]
└─▪ hostname
i1n5

which we are unable to SSH to from the OnDemand node. Maybe this can be fixed by the sys admins, but an alternative solution may need to be looked into. For example:

┌─[jnicklas@i1n5][~]
└─▪ hostname -A
i1n5.ocelote.hpc.arizona.edu i1n5.cm.cluster i1n5.ib.cluster 

where I am able to successfully SSH to i1n5.ocelote.hpc.arizona.edu from the OnDemand node.

@nickjer nickjer added the bug label Jun 27, 2017
@nickjer nickjer self-assigned this Jun 27, 2017
@ericfranz
Copy link
Contributor

Discussed offline. We will do this:

+# bash script content to set the "host" env var to the host that
+# the server we are connecting to is running on
+def set_hostname
+  context.fetch(:set_hostname, "host=$(hostname)")
+end

# Source in a developer defined script before running the main script
def before_script
  context.fetch(:before_script) do
    before_file = context.fetch(:before_file, "before.sh").to_s

-   "host=$(hostname)\n[[ -e \"#{before_file}\" ]] && source \"#{before_file}\""
+   "[[ -e \"#{before_file}\" ]] && source \"#{before_file}\""
  end.to_s
end

# ...

# The base script template
def base_script
  # ...

+ #{set_hostname}
  #{before_script}
  • Setting the host (which is used in the connection parameters) is a separate concern from creating an optional before_script to do other setup. So we separate this into separate steps.
  • In cluster config I can override this with custom script string to set the host parameter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants