Os

Collection of DIRAC useful operating system related modules by default on Error they return None

DIRAC.Core.Utilities.Os.getDirectorySize(path)

Get the total size of the given directory in MB

DIRAC.Core.Utilities.Os.getDiskSpace(path='.', exclude=None)

Get the free disk space in the partition containing the path. The disk space is reported in MBytes. Returned 0 in case of any error, e.g. path does not exist

DIRAC.Core.Utilities.Os.safe_listdir(directory, timeout=60)

This is a “safe” list directory, for lazily-loaded File Systems like CVMFS. There’s by default a 60 seconds timeout.

Warning

There is no distinction between an empty directory, and a non existent one. It will return [] in both cases.

Parameters:
  • directory (str) – directory to list

  • timeout (int) – optional timeout, in seconds. Defaults to 60.

DIRAC.Core.Utilities.Os.sourceEnv(timeout, cmdTuple, inputEnv=None)

Function to source configuration files in a platform dependent way and get back the environment

DIRAC.Core.Utilities.Os.uniquePath(path=None)

Utility to squeeze the string containing a PATH-like value to leave only unique elements preserving the original order