Commit ed38088f authored by gabrielmanhaes's avatar gabrielmanhaes
Browse files

Adaptar SGA Slurm para mudanças do branch [SOMA-2598][SOMA-1327]

parent 25f1a306
......@@ -4,7 +4,6 @@ local safer = require("safer")
local util = require("sga.util")
local exec = require("sga.exec")
local schema = require("schema")
local posix = require("posix")
local cmds = {
sbatch = "sbatch ",
......@@ -35,14 +34,13 @@ function slurm.execute_command(self, job, cmd_string)
local err_filename = self.config.runtime_data_dir.."/sbatch_"..job.jid..".err"
for _, sandbox_path in ipairs(job.sandboxes) do
local ok, err = lfs.mkdir(sandbox_path)
local ok, err = self.exec:create_dir(sandbox_path)
if not ok then
local attr = lfs.attributes(sandbox_path)
if not (attr and attr.mode == "directory") then
if not self.exec:is_dir(sandbox_path) then
return nil, "Failed creating job's sandbox "..sandbox_path
end
end
posix.chmod(sandbox_path, "rwxrwxrwx")
self.exec:chmod(sandbox_path, "rwxrwxrwx")
end
local optional_params = ""
......@@ -78,14 +76,13 @@ function slurm.execute_command(self, job, cmd_string)
end
function slurm.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)
self.exec:remove_file(job.data.script_filename)
self.exec:remove_file(job.data.out_filename)
self.exec:remove_file(job.data.err_filename)
for _, sandbox_path in ipairs(job.sandboxes) do
local attr = lfs.attributes(sandbox_path)
if (attr and attr.mode == "directory") then
local ok, err = util.removedir(sandbox_path)
if self.exec:is_dir(sandbox_path) then
local ok, err = self.exec:remove_dir(sandbox_path)
if not ok then
self.logger:error("Failed removing job's sandbox "..sandbox_path)
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment