How greyhoundforty/account-usage-python works
Based on our review of the project’s file tree and the README, this project is a set of Python-based scripts aimed at managing billing, licensing, and resource auditing for Citi’s HPC-as-a-Service on IBM Cloud. The project is organized into three main script modules: Billing, Utilities, and LicenseManagement. Each module is containerized (as evidenced by the Dockerfiles) and uses logging configurations and requirements files to manage dependencies and operations.
Main Components
• Billing Module: This component (found in the “Billing” folder) contains scripts (e.g., citiUsage.py) and a configuration (apps.yaml) used to calculate contractual billing. It also has its own Dockerfile, requirements, and logging configuration.
• Utilities Module: Contained in the “Utilities” folder, this module is responsible for various resource and audit operations. Its Python scripts (like attachTag.py, currentMonthUsage.py, getCases.py, listTags.py, missingBIllableItems.py) help manage and audit resource tags and usage.
• LicenseManagement Module: Housed under “licenseManagement”, this module includes scripts (such as licenseReport.py) that track BYOL licenses. Like the other modules, it includes Docker support and dependency management.
Relationships and Interactions
• Although the modules run as separate containerized services, they share a common purpose: managing aspects of HPC-as-a-Service consumption at Citi. The Billing module processes usage to compute costs; Utilities performs resource audits and data retrieval; LicenseManagement keeps track of license usage.
• Connections (even if abstract) showing that data flows from the HPC resource monitoring systems (or an external data source) into these modules for processing.
Architectural Patterns and Design Principles
• Containerization: Each top-level module is containerized, as indicated by their Dockerfiles. This means they can be independently deployed and scaled.
• Modularity: The clear separation into Billing, Utilities, and LicenseManagement reflects a modular design. Each module encapsulates a distinct business capability.
• Dependency Management: Use of requirements.txt and logging configuration files emphasizes standardized dependency and logging practices across components.
• Configuration-Driven Behavior: The Billing module’s use of an apps.yaml file suggests that at least some behavior can be adjusted via configuration files.
Relevant Technologies and Tools
• Python: The core scripting language used across modules.
• Docker: Each module includes a Dockerfile, indicating containerized deployment.
• JSON Configurations: For centralized logging (logging.json files) in each module.
• YAML: Seen in Billing (apps.yaml) which might be used for further configuration or orchestration properties.
Elements
• Configuration & Deployment Artifacts: Optionally annotate components with references to Docker, requirements.txt, logging.json, and apps.yaml where they influence behavior.