Skip to content

Commit

Permalink
add file list
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Mar 10, 2026
1 parent 2abef0f commit 385d669
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
from datetime import datetime

# --- VERSIONING ---
__version__ = "1.6.0"
__version__ = "1.6.1"

def find_latest_file(pattern):
"""Locates the most recent check_scheduling JSON file."""
files = glob.glob(pattern)
return max(files, key=os.path.getctime) if files else None

def main():
parser = argparse.ArgumentParser(description="PowerSchedule Assessor - v1.6.0")
parser = argparse.ArgumentParser(description="PowerSchedule Assessor - v1.6.1")
parser.add_argument("--input", help="JSON audit file")
parser.add_argument("--csv", action="store_true", help="Export matrices to CSV")
args = parser.parse_args()
Expand All @@ -36,6 +36,7 @@ def main():
ec2_groups = Counter({"plain": 0, "asg": 0, "eks": 0})
total_resources = 0
all_envs = set()
created_files = [] # Track created files for summary

for account in data:
acc_id = account.get('account_id')
Expand All @@ -47,13 +48,16 @@ def main():
res_type = val.get("type", "unknown")

if res_type == "eks_node":
cat, ec2_groups["eks"] = "eks_ec2", ec2_groups["eks"] + 1
cat = "eks_ec2"
ec2_groups["eks"] += 1
elif res_type == "asg_member":
cat, ec2_groups["asg"] = "asg_ec2", ec2_groups["asg"] + 1
cat = "asg_ec2"
ec2_groups["asg"] += 1
elif res_type == "rds":
cat = "rds"
else:
cat, ec2_groups["plain"] = "plain_ec2", ec2_groups["plain"] + 1
cat = "plain_ec2"
ec2_groups["plain"] += 1

if val.get("eks_cluster") and val.get("eks_cluster") != "N/A":
eks_clusters.add(f"{acc_id}:{val.get('eks_cluster')}")
Expand Down Expand Up @@ -104,7 +108,7 @@ def main():
row_pct = (row_total / type_totals[cat]) * 100
env_counts = [r3_data[cat][tag][env] for env in sorted_envs]
writer.writerow([tag, row_total, f"{row_pct:.1f}%"] + env_counts)
print(f"Exported: {fname}")
created_files.append(fname)

# --- ORG SUMMARY ---
print("\n" + "=" * report_width)
Expand All @@ -114,6 +118,11 @@ def main():
print(f" Total ASGs Identified: {len(asg_names)}")
print(f" Total EKS Clusters: {eks_cluster_count}")
print(f" Average Nodes/Cluster: {eks_avg:.1f}")

if created_files:
print(f"\n FILES CREATED:")
for f in created_files:
print(f" - {f}")
print("=" * report_width)

if __name__ == "__main__": main()

0 comments on commit 385d669

Please sign in to comment.