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

Added RunDB query #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions scripts/rundb.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
showMenu = (robot, res, runnumber) ->
robot.http("http://lbrundb.cern.ch/api/run/#{runnumber}/").get() (err, resp, body) ->
if err
res.send "Encountered an error!"
return
output = JSON.parse body
energy = output["beamenergy"]
fillid = output["fillid"]
velopos = output["veloPosition"]
mag = output["magnetState"]
dddbTag = output["dddbTag"]
condTag = output["conddbTag"]
avlumi = output["avLumi"]
endlumi = output["endlumi"]
betast = output["betaStar"]
avMu = output["avMu"]
state = output["state"]
runtype = output["runtype"]
activity= output["activity"]
LHCstate= output["LHCState"]
dest = output["destination"]
tck = output["tck"]


result = "Information for Run Number: #{runnumber}\n"

result += "_*Beam Energy*_: #{energy} GeV\n"
result += "_*Fill ID*_: #{fillid}\n"
result += "_*VELO Position*_: #{velopos}\n"
result += "_*Magnet Polarity*_: #{mag}\n"
result += "_*dddbTag*_: #{dddbTag}\n"
result += "_*conddbTag*_: #{condTag}\n"
result += "_*Average Luminosity*_: #{avlumi}\n"
result += "_*Run Luminosity*_: #{endlumi}\n"
result += "_*Beta Star*_: #{betast}\n"
result += "_*Average Mu*_: #{avMu}\n"
result += "_*State*_: #{state}\n"
result += "_*LHC State*_: #{LHCstate}\n"
result += "_*Run Type*_: #{runtype}\n"
result += "_*Activity*_: #{activity}\n"
result += "_*Destination*_: #{dest}\n"
result += "_*TCK*_: #{tck}\n"



res.reply result

module.exports = (robot) ->
robot.respond /rundb (.*)/i, (res) ->
runnumber = res.match[1]
showMenu robot, res, runnumber
return