def __init__(self, error='', command_stdout=None, command_stderr=None, command_exit_status=None, **kwargs): """ Class constructor. :param error: Error message. :type error: str :param command_stdout: Command standard output. :type command_stdout: str :param command_stderr: Command standard error. :type command_stderr: str :param command_exit_status: Command exit status. :type command_exit_status: int :param kwargs: Keyword arguments, may contain 'args=error_message', 'exception=exception_object', or 'error_details=details'. """ QconfException.__init__(self, error, uge_status.UGE_COMMAND_FAILED, **kwargs) self.command_stdout = command_stdout self.command_stderr = command_stderr self.command_exit_status = command_exit_status
def __init__(self, error='', **kwargs): """ Class constructor. :param error: Error message. :type error: str :param kwargs: Keyword arguments, may contain 'args=error_message', 'exception=exception_object', or 'error_details=details'. """ QconfException.__init__(self, error, uge_status.UGE_INVALID_ARGUMENT, **kwargs)
def get_uge_version(self): if not self.uge_version: p = self.execute_qconf('-help') lines = p.get_stdout().split('\n') if not len(lines): raise QconfException('Cannot determine UGE version from output: %s' % p.get_stdout()) self.uge_version = lines[0].split()[-1] return self.uge_version
def __get_object_class_from_uge_version(cls, uge_version, class_name, base_module_name=None): if not uge_version: raise InvalidRequest('Cannot generate %s object: UGE version must be specified.' % class_name) if uge_version not in UGE_RELEASE_OBJECT_MAP: raise QconfException('Unsupported UGE version: %s.' % uge_version) release_map = UGE_RELEASE_OBJECT_MAP.get(uge_version) object_version = release_map.get(class_name) return cls.__get_object_class_from_object_version(object_version, class_name, base_module_name)
def execute_qconf_with_dir(self, cmd, dir, error_regex_list=[]): if not os.path.isdir(dir): raise QconfException('%s is not a directory' % dir) full_cmd = '%s %s' % (cmd, dir) self.execute_qconf(full_cmd, error_regex_list=error_regex_list)