A small example package for EriduLab
Project description
EriduLab_tool
EriduLab_tool is a Python package designed to generate mock cloud data for testing and analysis purposes. It features the MCD (Mock Cloud Data Generator) class, which provides a fluent API for easy configuration and data generation.
Features
- MCD (Mock Cloud Data Generator): A powerful tool for creating synthetic cloud resource usage and cost data.
- Fluent API: Configure data generation parameters using a chainable, readable interface.
- Customizable Parameters: Adjust days, instance count, risk tolerance, and more.
- Advanced Control: Fine-tune data characteristics with methods like
with_storage_ratio(),with_anomaly_rate(),with_idle_ratio(), andwith_overprovisioned_ratio().
Installation
pip install EriduLab_tool
Usage
Basic Usage
from EriduLab_tool import MCD
mcd_instance = MCD()
data_df = mcd_instance.days(30).inst(100).risk(0.7).gen()
print(data_df.head())
Advanced Configuration
from datetime import datetime
advanced_data_df = MCD() .days(60) .inst(250) .start_date(datetime(2023, 1, 1)) .risk(0.9) .with_storage_ratio(0.3) .with_anomaly_rate(0.05) .with_idle_ratio(0.05) .with_overprovisioned_ratio(0.1) .Rs(42) .gen()
print(advanced_data_df.info())
MCD Fluent API Methods Overview
.days(days: int)
- Purpose: Sets the duration in days for which mock cloud data will be generated.
- Input Type:
int - Valid Range:
days > 0 - Influence: Determines the length of the time series data.
.risk(risk_level: float)
- Purpose: Adjusts the overall risk tolerance, influencing pricing categories (e.g., more Spot instances for higher risk) and operational risk scores.
- Input Type:
float - Valid Range:
0.0 <= risk_level <= 1.0 - Influence: Affects
PricingCategorydistribution,Config_Risk_Factor, andOperational_Risk_Score.
.inst(instance_count: int)
- Purpose: Specifies the total number of unique resource instances to simulate.
- Input Type:
int - Valid Range:
instance_count > 0 - Influence: Determines the cardinality of
ResourceID.
.Rs(random_state: int)
- Purpose: Sets a seed for the random number generator to ensure reproducible data generation.
- Input Type:
intorNone - Valid Range: Any integer or
None. - Influence: Ensures consistency of all randomized aspects across runs.
.start_date(start_date: datetime)
- Purpose: Defines the initial timestamp for the generated time series data.
- Input Type:
datetime.datetimeobject - Valid Range: Any valid
datetimeobject. - Influence: Sets the starting point for
TimeInterval.
.with_storage_ratio(ratio: float)
- Purpose: Controls the proportion of storage resources versus compute (VM) resources in the generated dataset.
- Input Type:
float - Valid Range:
0.0 <= ratio <= 1.0 - Influence: Affects the distribution of
ResourceTypeGroup.
.with_anomaly_rate(probability: float)
- Purpose: Sets the probability that a VM instance will exhibit "spiky" (anomalous) CPU utilization behavior.
- Input Type:
float - Valid Range:
0.0 <= probability <= 1.0 - Influence: Determines the number of
Is_SpikyVMs and their CPU patterns.
.with_idle_ratio(ratio: float)
- Purpose: Sets the target proportion of VM instances that will be marked as idle.
- Input Type:
float - Valid Range:
0.0 <= ratio <= 1.0 - Influence: Directly controls the number of VM instances where
Is_IdleisTrue.
.with_overprovisioned_ratio(ratio: float)
- Purpose: Sets the target proportion of VM instances that will be marked as overprovisioned.
- Input Type:
float - Valid Range:
0.0 <= ratio <= 1.0 - Influence: Directly controls the number of VM instances where
Is_OverprovisionedisTrue(among non-idle instances).
.gen()
- Purpose: Generates and returns a pandas DataFrame containing the mock cloud data based on the configured parameters.
- Returns:
pandas.DataFrame - Output Columns: Detailed explanation of all output columns (e.g.,
TimeInterval,ResourceID,ProjectID,Region,ResourceType,ResourceTypeGroup,PricingCategory,ListCost_Per_Hour,EffectiveCost,BilledCost_Daily_Total,CPU_Cores,Max_Memory_GB,ConsumedQuantity,CPU_Utilization_Pct,Memory_Usage_GB,Operational_Risk_Score,Config_Risk_Factor,Is_Idle,Is_Overprovisioned,Is_Spiky,ServiceName,ConsumedUnit,Tags).
Practical Use Cases
FinOps Reporting and Cost Analysis
- How to use
MCDdata to simulate cost allocation, identify cost anomalies, and analyze spending patterns. - Examples of filtering and aggregating data for different reporting needs (e.g., cost per project, cost per region, cost by resource type).
- Highlighting columns like
EffectiveCost,BilledCost_Daily_Total,ProjectID,Region.
Anomaly Detection in Resource Utilization and Cost
- Generating datasets with simulated anomalies (
with_anomaly_rate) to test anomaly detection algorithms. - Identifying unusual spikes in
CPU_Utilization_PctorEffectiveCost. - Using
Operational_Risk_ScoreandConfig_Risk_Factorfor predictive anomaly detection.
Capacity Planning and Optimization
- Simulating different
instance_countandresource_typescenarios. - Analyzing
CPU_Utilization_PctandMemory_Usage_GBto identifyIs_IdleandIs_Overprovisionedresources.
Policy Enforcement and Compliance Testing
- Using
Tagsto simulate environments (e.g., 'prod', 'dev') and test policy adherence. - Evaluating the impact of
PricingCategorydistributions based onrisk_levelfor compliance with FinOps best practices.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
eridulab_tool-0.0.6.tar.gz
(7.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file eridulab_tool-0.0.6.tar.gz.
File metadata
- Download URL: eridulab_tool-0.0.6.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
301eff576e845b0dc93d3a93d4eceeb095c31ee8bfdc5d243fac157cca84f591
|
|
| MD5 |
75418e2d7c3763bc5ae2e1a02d340bdb
|
|
| BLAKE2b-256 |
88d17d52966ce44a055250d31cf683116099b5e89721c327df49e88369bd2ede
|
File details
Details for the file eridulab_tool-0.0.6-py3-none-any.whl.
File metadata
- Download URL: eridulab_tool-0.0.6-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a67bf78f0cecc76948751f7b58e2312bbaed480a015d763e24d5ad344c821801
|
|
| MD5 |
3e96dbd54373227a01e029653b734074
|
|
| BLAKE2b-256 |
457dde658da6963b1d4fc6dc78475e8049fdcd07ef7bb9ad628216543765b86f
|