cloud-ops-optimizer / test_env.py
hirann's picture
Upload folder using huggingface_hub
dc42cb3 verified
raw
history blame contribute delete
860 Bytes
#!/usr/bin/env python3
"""Test CloudOps Environment."""
import sys
sys.path.insert(0, 'D:/scaler')
from cloud_ops_env.env.core import CloudOpsEnvironment, TASKS
from cloud_ops_env.models import Action
print("Testing CloudOps Environment...")
# Test easy task
env = CloudOpsEnvironment()
obs = env.reset(task_id='easy')
print(f"Task: {obs.task_name} ({obs.difficulty})")
print(f"Resources: {len(obs.inventory)}")
for r in obs.inventory:
print(f" - {r.id}: {r.type} @ ${r.monthly_cost}/mo")
# Test action
action = Action(message="change srv-1 to t3.small")
obs2, reward, done, info = env.step(action)
print(f"\nAfter action:")
print(f" Reward: {reward.value if hasattr(reward, 'value') else reward}")
print(f" Done: {done}")
for r in obs2.inventory:
print(f" - {r.id}: {r.type} @ ${r.monthly_cost}/mo")
print("\nEnvironment working correctly!")