Skip to content

Instantly share code, notes, and snippets.

@chr5tphr
Last active April 8, 2019 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chr5tphr/733ab03443f05ca567ca687afaed2f65 to your computer and use it in GitHub Desktop.
Save chr5tphr/733ab03443f05ca567ca687afaed2f65 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "rexml/document"
fd = IO.popen(["/opt/ge/bin/lx-amd64/qstat", "-j", ENV.fetch("JOB_ID", "0"), "-xml"])
doc = REXML::Document.new(fd.read)
xpath = "/detailed_job_info/djob_info/element/JB_ja_tasks/element[JAT_task_number/text()=1]/JAT_granted_destin_identifier_list/element/JG_qhostname/text()"
STDOUT << REXML::XPath.first(doc, xpath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment