Address PP-774: Ability to create directory and file as a user in PTL needs enhancement


Interface: mkdtemp ( in file pbs_dshutils.py)

Visibility: public

change control: stable


Motivation for change: Currently, mkdtemp is not working as how it should work when user is trying to create a directory as another user. It creates the directory and do a chown to the specified user. However, it may fail as only root can run chown. We also need to make this interface consistent with create_temp_file().


Summary: Create a temp dir by calling "tempfile.mkdtemp"

Proposed Interface: def create_temp_dir(self, hostname=None, suffix=' ', prefix='PtlPbs', dir=None,
asuser=None,asgroup=None, mode=None, level=logging.INFOCLI2)

  • hostname: the hostname on which to query tempdir from (Default: localhost)
  • suffix: the directory name will end with this suffix (Default: None)
  • prefix: the directory name will begin with this prefix (Default: PtlPbs)
  • dir: the directory will be created in this directory (Default: None)
  • asuser : create the file as specified user (Default: current user)
  • asgroup: optional group name of group owner (Default: None)
  • mode: Optional mode bits to assign to the temporary directory(Default: None)
  • level: logging level ( Defaults :INFOCLI2)


Existing interface: def mkdtemp(self, hostname=None, suffix=' ', prefix='PtlPbs', dir=None,
uid=None, gid=None, mode=None, level=logging.INFOCLI2)

  • hostname: the hostname on which to query tempdir from (Default: localhost)
  • suffix: the directory name will end with this suffix (Default: None)
  • prefix: the directory name will begin with this prefix (Default: PtlPbs)
  • dir: the directory will be created in this directory (Default: None)
  • uid: Optional username or uid of temp directory owner (Default: None)
  • gid: Optional group name or gid of temp directory group owner (Default: None)
  • mode: Optional mode bits to assign to the temporary directory (Default: None)
  • level: logging level (Defaults: INFOCLI2)





OSS Site Map

Project Documentation Main Page

Developer Guide Pages