apps.crc_quota ======================== .. autoapi-nested-parse:: Command line utility for checking a user's disk usage. This application prints a user's disk usage on multiple CRC file systems. For most file systems this usage is determined using ``df`` command line utility. Disk usage for the ``ihome`` file system is fetched from a JSON file generated by an upstream cron job. The file system paths (and types) are hard coded in this application. To modify what file systems are examined by the application, see the ``CrcQuota.app_logic`` method. Module Contents --------------- .. py:class:: AbstractFilesystemUsage(name: str, size_used: int, size_limit: int) Base class for building object-oriented representations of file system quotas. .. py:attribute:: name .. py:attribute:: size_used .. py:attribute:: size_limit .. py:method:: to_string(verbose: bool = False) -> str Return a string representation of the quota usage :param verbose: Return a more detailed representation :returns: Human readable quota usage information .. py:method:: _verbose_string() -> str .. py:method:: _short_string() -> str .. py:method:: convert_size(size: int) -> str :staticmethod: Convert the given number of bytes to a human-readable string :param size: An integer number of bytes :returns: A string representation of the given size with units .. py:class:: GenericUsage(name: str, size_used: int, size_limit: int) Bases: :py:obj:`AbstractFilesystemUsage` Disk storage quota for a generic file system .. py:method:: from_path(name: str, path: str) -> Optional[GenericUsage] :classmethod: Return a quota object for a given file path :param name: Name of the file system (e.g., zfs, ix, home) :param path: The file path for create a quota for :returns: An instance of the parent class or None if the allocation does not exist .. py:class:: BeegfsUsage(name: str, size_used: int, size_limit: int, chunk_used: str, chunk_limit: str) Bases: :py:obj:`AbstractFilesystemUsage` Disk storage quota for a BeeGFS file system .. py:attribute:: chunk_used .. py:attribute:: chunk_limit .. py:method:: _verbose_string() -> str .. py:method:: from_group(name: str, group: str) -> Optional[BeegfsUsage] :classmethod: Return a quota object for a given group name :param name: Name of the file system (e.g., zfs, ix, home) :param group: The group to create a quota for :returns: An instance of the parent class or None if the allocation does not exist .. py:class:: IhomeUsage(name: str, size_used: int, size_limit: int, files: int, physical: int) Bases: :py:obj:`AbstractFilesystemUsage` Disk storage quota for the ihome file system .. py:attribute:: files .. py:attribute:: physical .. py:method:: _verbose_string() -> str .. py:method:: from_uid(name: str, uid: int) -> Optional[IhomeUsage] :classmethod: Return a quota object for a given user id :param name: Name of the file system (e.g., zfs, ix, home) :param uid: The ID of the user :returns: An instance of the parent class or None if the allocation does not exist .. py:class:: CrcQuota Bases: :py:obj:`apps.utils.cli.BaseParser` Display a user's disk quota. .. py:method:: get_user_info(username: Optional[str] = None) -> Tuple[str, int, str, int] :staticmethod: Return system IDs for the current user :param username: The name of the user to get IDs for (defaults to current user) :returns: Tuple with the user's name, user ID, group name, and group ID .. py:method:: get_group_quotas(group: str) -> Tuple[GenericUsage] :staticmethod: Return quota information for the given group :param group: The name of the group :returns: A tuple of ``Quota`` objects .. py:method:: app_logic(args: argparse.Namespace) -> None Logic to evaluate when executing the application :param args: Parsed command line arguments