Enhance static directory handling and job deployment configuration

This commit is contained in:
2025-02-26 17:22:35 +07:00
parent 5c619e1f19
commit acae88076c
8 changed files with 984 additions and 151 deletions

48
check_job_status.py Normal file
View File

@ -0,0 +1,48 @@
#!/usr/bin/env python
"""
Script to check the status of the Nomad MCP job and its allocations.
"""
from app.services.nomad_client import NomadService
def main():
print("Checking Nomad MCP job status...")
# Initialize the Nomad service
service = NomadService()
# Get job information
job = service.get_job('nomad-mcp')
print(f"Job Status: {job.get('Status', 'Unknown')}")
print(f"Job Type: {job.get('Type', 'Unknown')}")
print(f"Job Datacenters: {job.get('Datacenters', [])}")
# Get allocations
allocations = service.get_allocations('nomad-mcp')
print(f"\nFound {len(allocations)} allocations")
if allocations:
latest_alloc = allocations[0]
print(f"Latest allocation ID: {latest_alloc.get('ID', 'Unknown')}")
print(f"Allocation Status: {latest_alloc.get('ClientStatus', 'Unknown')}")
# Check for task states
task_states = latest_alloc.get('TaskStates', {})
if task_states:
print("\nTask States:")
for task_name, state in task_states.items():
print(f" - {task_name}: {state.get('State', 'Unknown')}")
# Check for events
events = state.get('Events', [])
if events:
print(f" Events:")
for event in events[-3:]: # Show last 3 events
print(f" - {event.get('Time', 'Unknown')}: {event.get('Type', 'Unknown')} - {event.get('DisplayMessage', 'No message')}")
# Check health endpoint
print("\nService should be available at: https://nomad_mcp.dev.meisheng.group")
print("You can check the health endpoint at: https://nomad_mcp.dev.meisheng.group/api/health")
if __name__ == "__main__":
main()