Commit 2925af95 authored by Alain Takoudjou's avatar Alain Takoudjou

grid.promise fixup: create promise folder for the first time with wrong permissions

parent 4f3ef484
...@@ -313,6 +313,7 @@ class PromiseLauncher(object): ...@@ -313,6 +313,7 @@ class PromiseLauncher(object):
) )
if not os.path.exists(self.promise_output_dir): if not os.path.exists(self.promise_output_dir):
mkdir_p(self.promise_output_dir) mkdir_p(self.promise_output_dir)
self._updateFolderOwner()
def _getErrorPromiseResult(self, promise_process, promise_name, promise_path, def _getErrorPromiseResult(self, promise_process, promise_name, promise_path,
message, execution_time=0): message, execution_time=0):
...@@ -370,6 +371,13 @@ class PromiseLauncher(object): ...@@ -370,6 +371,13 @@ class PromiseLauncher(object):
except Queue.Empty: except Queue.Empty:
return return
def _updateFolderOwner(self, folder_path=None):
stat_info = os.stat(self.partition_folder)
if folder_path is None:
folder_path = os.path.join(self.partition_folder,
PROMISE_STATE_FOLDER_NAME)
chownDirectory(folder_path, stat_info.st_uid, stat_info.st_gid)
def _launchPromise(self, promise_name, promise_path, argument_dict, def _launchPromise(self, promise_name, promise_path, argument_dict,
wrap_process=False): wrap_process=False):
""" """
...@@ -460,6 +468,7 @@ class PromiseLauncher(object): ...@@ -460,6 +468,7 @@ class PromiseLauncher(object):
if promise_process.is_alive(): if promise_process.is_alive():
self.logger.info("Killing process %s..." % promise_name) self.logger.info("Killing process %s..." % promise_name)
killProcessTree(promise_process.pid, self.logger) killProcessTree(promise_process.pid, self.logger)
message = 'Promise timed out after %s seconds' % self.promise_timeout message = 'Promise timed out after %s seconds' % self.promise_timeout
queue_item = self._getErrorPromiseResult( queue_item = self._getErrorPromiseResult(
promise_process, promise_process,
...@@ -555,8 +564,7 @@ class PromiseLauncher(object): ...@@ -555,8 +564,7 @@ class PromiseLauncher(object):
if result_state and not failed_promise_name: if result_state and not failed_promise_name:
failed_promise_name = promise_name failed_promise_name = promise_name
stat_info = os.stat(self.partition_folder) self._updateFolderOwner(self.promise_output_dir)
chownDirectory(self.promise_output_dir, stat_info.st_uid, stat_info.st_gid)
if failed_promise_name: if failed_promise_name:
raise PromiseError("Promise %r failed." % failed_promise_name) raise PromiseError("Promise %r failed." % failed_promise_name)
Markdown is supported
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