Skip to content
Permalink
5f6af87028
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
352 lines (239 sloc) 12.1 KB
<head>
<title>VNC Server Startup</title>
<HTA:APPLICATION
ID="vnczeus"
APPLICATIONNAME="VNC Server Startup"
SCROLL="no"
SINGLEINSTANCE="no"
>
<style>
tr.bordered td {
border-bottom: 1px solid black;
}
</style>
</head>
<script language="VBScript">
Dim dtmStartTime
Sub window_onload
window.resizeTo 400,700
strUser = replace(CreateObject("WScript.Network").UserName, " ","")
document.getElementById(2).Value = strUser
squeue.location.href = "http://epyc.coventry.ac.uk/queue.php?userid=" & strUser
End Sub
Sub refresh_job_list
document.getElementById("squeue").src = "http://epyc.coventry.ac.uk/queue.php?userid=" & document.getElementById(2).Value
End Sub
Sub sleep (Timesec)
Set objwsh = CreateObject("WScript.Shell")
objwsh.Run "Timeout /T " & Timesec & " /nobreak" ,0 ,true
Set objwsh = Nothing
End Sub
function toggle
document.getElementById("cpus").disabled=document.getElementById("checkbox").checked
End function
function toggle1
document.getElementById("numnodes").disabled=Not document.getElementById("few").checked
End function
function toggle_exclude
document.getElementById("excludenode").disabled=Not document.getElementById("exclude").checked
End function
function toggle_include
document.getElementById("includenode").disabled=Not document.getElementById("include").checked
End function
function fullnode
if document.getElementById("docker").checked = true then
document.getElementById("cpus").Value=128
document.getElementById("cpus").disabled=True
else
document.getElementById("cpus").disabled=False
end if
End function
function toggle_exist
document.getElementById("host").disabled=Not document.getElementById("exist_job").checked
document.getElementById("new_job").checked=Not document.getElementById("exist_job").checked
document.getElementById("host").Value="XXXXXX"
if document.getElementById("exist_job").checked = true then
document.getElementByID("btnSubmit").Value="Reconnect"
else
document.getElementByID("btnSubmit").Value="Start VNC"
end if
document.getElementById("runtime").disabled=Not document.getElementById("new_job").checked
document.getElementById("cpus").disabled=Not document.getElementById("new_job").checked
document.getElementById("exclude").disabled=Not document.getElementById("new_job").checked
document.getElementById("include").disabled=Not document.getElementById("new_job").checked
End function
function toggle_new
document.getElementById("exist_job").checked=Not document.getElementById("new_job").checked
document.getElementById("runtime").disabled=Not document.getElementById("new_job").checked
document.getElementById("exclude").disabled=Not document.getElementById("new_job").checked
document.getElementById("include").disabled=Not document.getElementById("new_job").checked
document.getElementById("host").disabled=Not document.getElementById("exist_job").checked
if document.getElementById("exist_job").checked = true then
document.getElementByID("btnSubmit").Value="Reconnect"
else
document.getElementByID("btnSubmit").Value="Start VNC"
end if
End function
function reload
location.reload True
End function
Sub launch_terminal
if document.getElementById("login").Value="" then
MsgBox "Please enter your HPC username!"
Exit Sub
end if
if document.getElementById("pass").Value="" then
MsgBox "Please enter your HPC password!"
Exit Sub
end if
Set objShell = CreateObject("WScript.Shell")
cmd="..\tools\ssh.exe " & login.Value & "@epyc.coventry.ac.uk"
objShell.Run cmd,1,true
End Sub
Sub isEnter
If Window.Event.KeyCode = 13 Then
Submit
End If
End Sub
Sub Submit
Dim WshShell, objCmdExec
Dim strCmdTool, strCmdArgs
Dim strCmdOutput
strUser=document.getElementById("login").Value
'msgbox(strUser)
document.getElementById("squeue").src = "http://epyc.coventry.ac.uk/queue.php?userid=" & document.getElementById("login").Value
if document.getElementById("login").Value="" then
MsgBox "Please enter your HPC username!"
Exit Sub
end if
if document.getElementById("pass").Value="" then
MsgBox "Please enter your HPC password!"
Exit Sub
end if
if document.getElementById("cpus").Value>128 then
MsgBox "128CPUS max"
document.getElementById("cpus").Value=128
Exit Sub
else
ncpus="-N1 -n " & cpus.Value
end if
'document.getElementById(1).disabled = true
document.getElementById(1).Value = "Please Wait!"
FullName = replace(vnczeus.commandLine,chr(34),"")
arrFN=split(FullName,"\")
FileName = arrFN(ubound(arrFN))
SourceDir=replace(FullName,FileName,"")
if (document.getElementById("exclude").checked = true) And excludenode.Value <> "" then
exclude_nodes=" --exclude=" & excludenode.Value
else
exclude_nodes=""
end if
if (document.getElementById("include").checked = true) And includenode.Value <> "" then
include_nodes=" -w " & includenode.Value
else
include_nodes=""
end if
Randomize
middleman="epyc"
state_cmd="squeue -j $JOBID -o %t -h"
newjob=0
if (document.getElementById("exist_job").checked = false) Or host.Value = "" then
newjob=1
'msgbox(cpus.Value)
if (document.getElementById("docker").checked = false) then
cmd="..\tools\plink.exe -t -ssh " & middleman & ".coventry.ac.uk -l " & login.Value & " -pw " & pass.Value & " " & chr(34) & "rm -fr ~/.cache/sessions; J=$(sbatch " & ncpus & feature & exclude_nodes & include_nodes & " -t " & runtime.Value & ":00:00 /share/apps/slurm/vnc.slurm); JOBID=$(grep -o " & chr(34) & "[0-9]" & chr(34) & " <<< $J | tr -d " & chr(39) & "\n" & chr(39) & "); echo $JOBID >~/VNCJOB; echo Your VNC Job $JOBID is submitted to the queue... you will be connected when the job will be RUNNING; echo ; squeue -u " & login.Value & " -j $JOBID; while [[ " & chr(34) & "$STATE" & chr(34) & " != " & chr(34) & "R" & chr(34) & " ]] ; do STATE=$(" & state_cmd & "); sleep 2; done; echo ; echo Your job seems now RUNNING! Let us check again...; echo ; echo ; squeue -j $JOBID; cat ~/vnc.log; echo ; echo Note above the Target Node for your VNC Session. If you requested more than ONE node, you need to connect to the FIRST node in the above node list.; echo ; echo You can close this window and continue...; " & chr(34)
'msgbox(cmd)
else
cmd="..\tools\plink.exe -t -ssh " & middleman & ".coventry.ac.uk -l " & login.Value & " -pw " & pass.Value & " " & chr(34) & "rm -fr ~/.cache/sessions; J=$(sbatch " & nnodes & feature & exclude_nodes & include_nodes & " -t " & runtime.Value & ":00:00 /share/apps/docker/start_docker.slurm); JOBID=$(grep -o " & chr(34) & "[0-9]" & chr(34) & " <<< $J | tr -d " & chr(39) & "\n" & chr(39) & "); echo $JOBID >~/VNCJOB; echo Your VNC Job $JOBID is submitted to the queue... you will be connected when the job will be RUNNING; echo ; squeue -u " & login.Value & " -j $JOBID; while [[ " & chr(34) & "$STATE" & chr(34) & " != " & chr(34) & "R" & chr(34) & " ]] ; do STATE=$(" & state_cmd & "); sleep 2; done; echo ; echo Your job seems now RUNNING! Let us check again...; echo ; echo ; squeue -j $JOBID; cat ~/vnc.log; echo ; echo Note above the Target Node for your VNC Session. If you requested more than ONE node, you need to connect to the FIRST node in the above node list.; echo ; echo You can close this window and continue...; " & chr(34)
end if
Set objShell = CreateObject("WScript.Shell")
objShell.Run cmd,1,true
'########### job submitted ##############
else
msgbox("Trying to reconnect to JOBID " & host.Value & " as " & strUser & "!")
end if
' #### get jobid and target node ####
'''''''''''''''''''''''''''''''''''''''''''''
Randomize
middleman="epyc"
myport=5901
Set objShell = CreateObject("Wscript.Shell")
' ############ do not get host from jobid if connecting to existing job!
' *********** Getting last VNC JOBID ************
if (newjob=1) then
'getting the last job submitted:
strCommand = "..\tools\plink.exe -t -ssh " & middleman & ".coventry.ac.uk -l " & login.Value & " -pw " & pass.Value & " " & "cat ~/.vnc/vnc_$(cat ~/VNCJOB)_screen"
Else
'host.Value now contains target JOBID!
strCommand = "..\tools\plink.exe -t -ssh " & middleman & ".coventry.ac.uk -l " & login.Value & " -pw " & pass.Value & " " & "cat ~/.vnc/vnc_" & host.Value & ".log | grep 'TurboVNC:' | tr -s [:blank:] | cut -d' ' -f6"
End If
sleep 6
'msgbox(strCommand)
Set objShellExec = objShell.Exec(strCommand)
output = Trim(objShellExec.StdOut.ReadAll)
'MsgBox(output)
outp=Split(output,":")
display=5900+outp(1)
targetnode=outp(0)
document.getElementById("host").disabled = false
document.getElementById("exist_job").checked = true
'document.getElementById("host").Value = targetnode
MsgBox "Your VNC job is running on " & targetnode & " :" & display & "! Wait for VNC password prompt..."
' ************************************************
'host.Value=targetnode
cmd="..\tools\plink.exe -pw " & pass.Value & " -t -L localhost:" & myport & ":" & targetnode & ":" & display & " " & strUser & "@" & middleman & ".coventry.ac.uk"
objShell.Run cmd,1
sleep 3
mycommand="..\tools\vncviewer.exe localhost:" & myport
objShell.Run mycommand
'''''''''''''''''''''''''''''''''''''''''''''
document.getElementById(1).Value = "Start VNC"
End Sub
</script>
<body style="margin-left:3px;margin-right:3px;">
<center><h3><a href="http://epyc.coventry.ac.uk">Epyc HPC</a> VNC Session Startup</h3></center>
<table border=0>
<tr >
<td>Input Your HPC Username: </td><td> <input type="text" id=2 name="login" size="8"><input size=5 id=refr class="button" type="button" name="refr" value="My jobs" onClick="refresh_job_list"/></td>
<tr class="bordered">
<td>Input Your HPC Password: </td><td>
<input type="password" name="pass" id="pass" size="14" onkeypress="isEnter"/>
</td>
</tr>
<tr style="height:3px" ><td style="height:3px" colspan="2" border-top: 1px solid black;> </td></tr>
<tr ><td colspan="2">
<input onClick="toggle_new" type="checkbox" id="new_job" name="new_job" checked /><b>Submit New VNC job: <font size="-1"><a href="http://epyc.coventry.ac.uk/squeue.php#:~:text=idle">Check for idle nodes</a></font></b><br/>
</tr>
<tr>
<td>Time Limit for the VNC Session: </td><td> <input type="text" name="runtime" size="5" value=24 /> hours</td>
</tr>
<!---<tr>
<td>I want the whole compute node: </td><td> <input onClick="toggle()" type="checkbox" id="checkbox" name="whole" checked> <br /></td>
</tr>
<tr>
<td>I need &gt;1 compute nodes: <input onClick="toggle1()" type="checkbox" id="few" name="few" unchecked> <br /></td><td><input type="text" id="numnodes" name="numnodes" size="3" disabled value=2> nodes</td>
</tr>
--->
<input type="hidden" id="numnodes" name="numnodes" value=1 />
<tr>
<td>I want: </td><td> <input type="text" id="cpus" name="cpus" value=4 size="5" /> CPUs </td>
</tr>
<tr>
<td>Docker Job: </td><td> <input type="checkbox" id="docker" name="docker" unchecked onClick="fullnode" /> </td>
</tr>
<tr><td>Exclude the node <input onClick="toggle_exclude" type="checkbox" id="exclude" name="exclude" unchecked>, named: </br><font size=-2>(e.g. zeusXXX)</font> </td><td> <input type="text" id="excludenode" name="excludenode" size="10" disabled></td></tr>
<tr class="bordered"><td>I want a particular node <input onClick="toggle_include" type="checkbox" id="include" name="include" unchecked>, named: <font size=-2>(e.g. nodeX)</font> </td><td> <input type="text" id="includenode" name="includenode" size="10" disabled></td></tr>
<tr><td colspan="2">
<input onClick="toggle_exist" type="checkbox" id="exist_job" name="exist_job" unchecked><b>Re-connect to an existing VNC job:</b> (check job list below):</td></tr>
<tr></tr>
<tr><td>existing job's ID:</td><td> <input type="text" id="host" name="host" size="15" value="input JOBID" disabled onkeypress="isEnter"></td></tr><tr class="bordered"><td colspan="2">&nbsp;</td></tr>
</table>
<center>
<input id=1 class="button" type="button" name="btnSubmit" value="Start VNC" onClick="Submit">&nbsp;&nbsp;&nbsp;<input id=100 class="button" type="button" name="reload" value="Reset" onClick="reload()">&nbsp;&nbsp;&nbsp;<input id="terminal" class="button" type="button" name="terminal" value="Open terminal" onClick="launch_terminal">
</br>
<iframe id="squeue" name="squeue" width="100%" height=200 frameBorder="0"></iframe>
</center>
<footer>
<font size=-2>Programmed by: Alex Pedcenko <a href="mailto:aa3025@coventry.ac.uk">
aa3025@coventry.ac.uk</a> </font></footer>
</body>