Skip to content
Permalink
be453b573c
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
185 lines (137 sloc) 6.88 KB
<head>
<title>VNC Server Startup</title>
<HTA:APPLICATION
ID="vncpluto"
APPLICATIONNAME="VNC Server Startup"
SCROLL="no"
SINGLEINSTANCE="no"
>
</head>
<script language="VBScript">
Dim dtmStartTime
Sub window_onload
window.resizeTo 400,600
strUser = CreateObject("WScript.Network").UserName
document.getElementById(2).Value = strUser
squeue.location.href = "http://pluto.coventry.ac.uk/queue.php?userid=" & strUser
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 toggle3
document.getElementById("nodename").disabled=Not document.getElementById("particular").checked
End function
function reload
location.reload True
End function
Sub Submit
Dim WshShell, objCmdExec
Dim strCmdTool, strCmdArgs
Dim strCmdOutput
strUser = CreateObject("WScript.Network").UserName
document.getElementById("squeue").src = "http://pluto.coventry.ac.uk/queue.php?userid=" & document.getElementById(2).Value
document.getElementById(1).disabled = true
document.getElementById(1).Value = "Please Wait!"
FullName = replace(vncpluto.commandLine,chr(34),"")
arrFN=split(FullName,"\")
FileName = arrFN(ubound(arrFN))
SourceDir=replace(FullName,FileName,"")
'msgbox(FullName)
if document.getElementById("checkbox").checked = true then
nnodes="-N 1 --exclusive"
else
nnodes="-N 1 --ntasks-per-node " & cpus.Value
end if
if constraint.Value <> "" then
feature=" -p " & constraint.Value
else
feature=""
end if
if document.getElementById("few").checked = true then
if document.getElementById("checkbox").checked = true then
nnodes="-N " & numnodes.Value & " --exclusive"
else
nnodes="-N " & numnodes.Value & " --ntasks-per-node " & cpus.Value
end if
end if
if (document.getElementById("particular").checked) And (nodename.Value <> "") then
nodesnames=" -w " & nodename.Value
else
nodesnames=""
end if
Randomize
middleman="pluto"
nLow = 51
nHigh = 99
Randomize
myport=Int((nHigh - nLow + 1) * Rnd + nLow)
middleport=myport+5900
state_cmd="squeue -j $JOBID -o %t -h"
'cmd=SourceDir & "..\tools\plink.exe -t -ssh " & middleman & ".coventry.ac.uk -l " & login.Value & " -pw " & pass.Value & " " & chr(34) & "rm -fr ~/.cache/sessions; echo xfce4-session > ~/.vnc/xstartup; chmod +x ~/.vnc/xstartup; rm -f ~/vnc.log; J=$(sbatch " & nnodes & feature & nodesnames & " -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 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 Press Enter to close this window and continue...; read a" & chr(34)
cmd="..\tools\plink.exe -t -ssh " & middleman & ".coventry.ac.uk -l " & login.Value & " -pw " & pass.Value & " " & chr(34) & "rm -fr ~/.cache/sessions; echo xfce4-session > ~/.vnc/xstartup; chmod +x ~/.vnc/xstartup; rm -f ~/vnc.log; J=$(sbatch " & nnodes & feature & nodesnames & " -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 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 Press Enter to close this window and continue...; read a" & chr(34)
'Set objFSO=CreateObject("Scripting.FileSystemObject")
'outFile="output.log"
'Set objFile = objFSO.CreateTextFile(outFile,True)
'objFile.Write cmd
'objFile.Close
Set objShell = CreateObject("WScript.Shell")
objShell.Run cmd,1,true
'msgbox("%windir%\system32\mshta.exe " & chr(34) & SourceDir & "02_START_tunnel_to_pluto_nodes.hta" & chr(34))
objShell.Exec("%windir%\system32\mshta.exe " & chr(34) & SourceDir & "02_START_tunnel_to_pluto_nodes.hta" & chr(34))
'objShell.Exec("%windir%\system32\mshta.exe 02_START_tunnel_to_pluto_nodes.hta")
'Window.Close
'Example:
End Sub
</script>
<body style="margin-left:1px;margin-right:1px;">
<center><h3>Pluto Node VNC Session Startup</h3></center>
<br />
<table border=0>
<tr>
<td>Input Your HPC Username: </td><td> <input type="text" id=2 name="login" size="10"></td>
<tr>
<td>Input Your HPC Password: </td><td> <input type="password" name="pass" size="10"></td>
</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>
<tr>
<td>I want only: </td><td> <input type="text" id="cpus" name="cpus" value=1 size="5" disabled> CPU/node </td>
</tr>
<tr>
<td>Constraint needed? </td><td>
<select name="constraint">
<option value="">no, any node is fine</option>
<option value="gpu">GPU</option>
<option value="long">long (max 5 days)</option>
</select>
</td>
</tr>
<tr>
<td>I want a particular node <input onClick="toggle3()" type="checkbox" id="particular" name="particular" unchecked>, named: </td><td> <input type="text" id="nodename" name="nodename" size="10" disabled></td>
</tr>
</table>
<br />
<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()">
</br><br />
<iframe id="squeue" name="squeue" width=400 height=200></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>