Files
nomad_mcp/check_allocations.py

33 lines
1.0 KiB
Python

#!/usr/bin/env python
"""
Script to check allocations for the nomad-mcp job.
"""
from app.services.nomad_client import NomadService
def main():
service = NomadService()
# Get allocations for the job
allocations = service.get_allocations('nomad-mcp')
print(f'Found {len(allocations)} allocations')
if allocations:
latest_alloc = allocations[0]
print(f'Latest allocation ID: {latest_alloc["ID"]}')
print(f'Status: {latest_alloc.get("ClientStatus", "Unknown")}')
# Get logs for the allocation
try:
logs = service.get_allocation_logs(latest_alloc["ID"])
print("\nAllocation Logs:")
print(logs.get("stdout", "No stdout logs available"))
print("\nError Logs:")
print(logs.get("stderr", "No stderr logs available"))
except Exception as e:
print(f"Error getting logs: {str(e)}")
else:
print("No allocations found for nomad-mcp job")
if __name__ == "__main__":
main()