Hi,
To follow your proposal, my colleague and I have tried to implement this process on a PARAVIEW example :
if no vnc motif session is launched by the user, the PARAVIEW template has to stop on a raise message before starting the slurm job.
in fact, it goes on and it’s failed into the job, of course.
why. because the “vnc_display” stays with the previous good value.
here is a trap on the different files done at the same times :
Every 10,0s: cat /tmp/disp_jms.log /tmp/form.log /t… Sun Jul 21 09:18:29 2019
display : date Sun Jul 21 09:18:20 CEST 2019
display : user jms
display : myFile /home/jms/.vnc/motif.log
display : ligne
display : display none
form : date Sun Jul 21 09:18:20 CEST 2019
form : none
submit : date Sun Jul 21 09:17:07 CEST 2019
submit : DISPLAY=nodeSu-001:1
QUESTION : what’s going wrong ?
here are the files implemented :
cat /etc/ood/config/apps/dashboard/initializers/display.rb
def qdisplay
@DISPLAY = “none”
@myFile = ENV[‘HOME’] + “/.vnc/motif.log”
@myLogFile = “/tmp/disp_”+ENV[‘USER’]+".log"
system ("rm -f "+@myLogFile)
system ("touch "+@myLogFile)
@date = %x[date]
@ligne = %x[squeue -u USER -n MOTIF|tail -1f | grep MOTIF]
if ?.exitstatus == 0 then
aFile = File.open(@myFile, “r”)
if aFile then
@DISPLAY = aFile.sysread(80)
@DISPLAY = aFile.read()
end
aFile.close
end
aFile = File.open(@myLogFile, "w")
aFile.puts("display : date "+@date)
aFile.puts("display : user "+ENV['USER'])
aFile.puts("display : myFile "+@myFile)
aFile.puts("display : ligne "+@ligne)
aFile.puts("display : display "+@DISPLAY)
aFile.puts()
aFile.close
return @DISPLAY
end
cat /var/www/ood/apps/sys/VIEW/form.yml.erb
<%-
projects = OodAppkit.clusters[:verhpc].custom_config[:projects]
vnc_disp = qdisplay
@date = %x[date]
aFile = File.new("/tmp/form.log", “w”)
aFile.puts("form : date "+@date)
aFile.puts("form : "+vnc_disp)
aFile.puts()
aFile.close
-%>
cluster: “verhpc”
form:
- version
- work_dir
- project
- num_cores
- memory_by_core
- vnc_disp
- bc_vnc_resolution
attributes:
version:
widget: select
label: “Paraview version”
help: “This defines the version of PARAVIEW you want to load.”
options:
- [ “5.3.0”, “software/paraview/5.3.0” ]
work_dir:
widget: “text_field”
label: “Working Directory”
help: “Type the name of the directory you want to working in”
project:
widget: select
label: “Project”
help: “You can leave this blank if not in multiple projects.”
options:
<%- projects.each do |p| -%>
- [ “<%= p %>”, “<%= p %>” ]
<%- end -%>
num_cores:
widget: “number_field”
label: “Number of cores”
help: |
Number of cores on node type (4 GB per core unless requesting whole
node). Leave blank if requesting full node.
min: 0 # This is treated as requesting the max allowable
max: 1 # This will be updated by form.js
step: 1
id: num_cores
memory_by_core:
widget: “number_field”
label: “Memory by core”
help: |
Number of memory by core. Leave blank if requesting anything.
min: 0 # This is treated as requesting the max allowable
max: 2 # This will be updated by form.js
step: 1
id: memory_by_core
vnc_disp:
widget: “hidden_field”
widget: “text_field”
value: <%= vnc_disp %>
id: vnc_disp
bc_vnc_resolution:
required: true
cat /var/www/ood/apps/sys/VIEW/submit.yml.erb
<%-
nb_cores = num_cores.blank? ? 1 : num_cores
memory = memory_by_core.blank? ? 1 : memory_by_core
vnc_display = vnc_disp
@date = %x[date]
aFile = File.new("/tmp/submit.log", “w”)
aFile.puts("submit : date "+@date)
aFile.puts("submit : “+vnc_display)
aFile.puts()
aFile.close
if vnc_display == “none” then
raise " Error : the display is not defined, please launch a motif desktop first”
end
-%>
batch_connect:
template: “basic”
script:
native: [ “-JPARAVIEW” , “-N” , “<%= nb_cores %>” , --mem-per-cpu=<%= memory %> , “-pinter” ]