An error occurred while loading the file. Please try again.
-
Isabella Almeida da Silva authored
- Usado o mesmo código de criação das sandboxes do driver POSIX
9d174128
local pbs = {}
local safer = require("safer")
local util = require("sga.util")
local exec = require("sga.exec")
local cmds = {
nodeinfo = "pbsnodes -a ",
qsub = "qsub ",
qstat = "qstat -fx ",
}
--- Type of the SGA, returned to the server during registration.
pbs.type = "cluster"
---
-- Execute a new command.
-- @param job The job object: job.data is a writable table for driver data.
-- @param cmd_string The command string
-- @return True if succeded or nil and an error message
function pbs.execute_command(self, job, cmd_string)
local script_filename = self.config.runtime_data_dir.."/qsub_"..job.jid..".script"
local out_filename = self.config.runtime_data_dir.."/qsub_"..job.jid..".out"
local err_filename = self.config.runtime_data_dir.."/qsub_"..job.jid..".err"
for _, sandbox_path in ipairs(job.sandboxes) do
local ok, err = lfs.mkdir(sandbox_path)
if not ok then
local attr = lfs.attributes(sandbox_path)
if not (attr and attr.mode == "directory") then
return nil, "Failed creating job's sandbox "..sandbox_path
end
end
end
self.exec:write_file(script_filename, "#!/bin/sh\n"..cmd_string.."\n")
local pbsjid, stderr = self.exec:run(("%s -o %s -e %s %s"):format(cmds.qsub, out_filename, err_filename, script_filename))
if pbsjid ~= "" then
pbsjid = pbsjid:gsub("\n", "")
self.logger:debug("Submitted PBS job: "..pbsjid)
job.data.script_filename = script_filename
job.data.out_filename = out_filename
job.data.err_filename = err_filename
job.data.pbsjid = pbsjid
return true
else
local err = "Failed submitting job: "..stderr
return nil, err
end
end
--
-- Deletes resources (files) created for a command.
-- @param job The job object
function pbs.cleanup_job(self, job)
self.exec:remove(job.data.script_filename)
self.exec:remove(job.data.out_filename)
self.exec:remove(job.data.err_filename)
for _, sandbox_path in ipairs(job.sandboxes) do
local ok, err = lfs.rmdir(sandbox_path)
if not ok then
self.logger:error("Failed removing job's sandbox "..sandbox_path)
end
end
end
local function mini_xml(input, current_tag)