playbooks/roles/ood-applications/files/bc_vizer/submit.yml.erb (47 lines of code) (raw):

--- <%- require 'yaml' node_arrays = YAML.load_file("/etc/ood/config/apps/bc_desktop/config/node_arrays.yml") node_ratio = bucket.to_i node_count = 1 dataset_filename = File.basename(dataset) dataset_dir = File.dirname(dataset) if OodAppkit.clusters[cluster].job_config[:adapter] == 'slurm' scheduler_args = ["-p", target] scheduler_args += ["--container-mounts=%s:/opt/datasets:ro" % dataset_dir] scheduler_args += ["--export=ALL"] # If the user has specified a node ratio greather than 1, set the job ppn slot_type = node_arrays.find { |slot_type| slot_type["name"] == target } gpu_count = slot_type["gpuCount"].to_i gl = "osmesa" if node_ratio > 1 cores = (slot_type["vcpuCount"].to_i / node_ratio) gpu_count = (gpu_count.to_f / node_ratio.to_f).ceil scheduler_args += ["--ntasks-per-node=%d" % cores] else scheduler_args += ["--exclusive"] end if gpu_count > 0 scheduler_args += ["--gpus=%d" % gpu_count] gl = "egl" end scheduler_args += ["--container-image=%s" % container_image.gsub("${gl}", gl)] else scheduler_args = ["-q", "vizq"] node_arrays.each do |slot_type| if slot_type["name"] == target cores = (slot_type["vcpuCount"].to_i / node_ratio) scheduler_args += ["-l", "select=%d:slot_type=%s:ncpus=%d:mpiprocs=%d" % [node_count, target, cores, cores]] break end end scheduler_args += ["-v", "enroot=1"] end -%> batch_connect: template: "basic" script: native: <%- scheduler_args.each do |arg| %> - "<%= arg %>" <%- end %>