Fix datetime.timezone.utc references in agent SDK
All checks were successful
Cross-Node Transaction Testing / transaction-test (push) Successful in 11s
Deploy to Testnet / deploy-testnet (push) Successful in 1m14s
Integration Tests / test-service-integration (push) Successful in 2m38s
Multi-Node Stress Testing / stress-test (push) Successful in 2s
Node Failover Simulation / failover-test (push) Successful in 1s
Package Tests / Python package - aitbc-agent-sdk (push) Successful in 28s
Package Tests / Python package - aitbc-core (push) Successful in 13s
Package Tests / Python package - aitbc-crypto (push) Successful in 9s
Package Tests / Python package - aitbc-sdk (push) Successful in 10s
Package Tests / JavaScript package - aitbc-sdk-js (push) Successful in 7s
Package Tests / JavaScript package - aitbc-token (push) Successful in 18s
Python Tests / test-python (push) Successful in 16s
Security Scanning / security-scan (push) Successful in 30s
Deploy to Testnet / notify-deployment (push) Successful in 1s
All checks were successful
Cross-Node Transaction Testing / transaction-test (push) Successful in 11s
Deploy to Testnet / deploy-testnet (push) Successful in 1m14s
Integration Tests / test-service-integration (push) Successful in 2m38s
Multi-Node Stress Testing / stress-test (push) Successful in 2s
Node Failover Simulation / failover-test (push) Successful in 1s
Package Tests / Python package - aitbc-agent-sdk (push) Successful in 28s
Package Tests / Python package - aitbc-core (push) Successful in 13s
Package Tests / Python package - aitbc-crypto (push) Successful in 9s
Package Tests / Python package - aitbc-sdk (push) Successful in 10s
Package Tests / JavaScript package - aitbc-sdk-js (push) Successful in 7s
Package Tests / JavaScript package - aitbc-token (push) Successful in 18s
Python Tests / test-python (push) Successful in 16s
Security Scanning / security-scan (push) Successful in 30s
Deploy to Testnet / notify-deployment (push) Successful in 1s
Replace datetime.timezone.utc with timezone.utc in agent.py, compute_provider.py, and swarm_coordinator.py (10 locations total) after updating imports from `datetime, UTC` to `datetime, timezone`
This commit is contained in:
@@ -5,7 +5,7 @@ Core Agent class for AITBC network participation
|
||||
import asyncio
|
||||
import json
|
||||
import uuid
|
||||
from datetime import datetime, UTC
|
||||
from datetime import datetime, timezone
|
||||
from typing import Dict, List, Optional, Any
|
||||
from dataclasses import dataclass
|
||||
from cryptography.hazmat.primitives import hashes
|
||||
@@ -154,7 +154,7 @@ class Agent:
|
||||
"max_concurrent_jobs": self.capabilities.max_concurrent_jobs,
|
||||
"specialization": self.capabilities.specialization,
|
||||
},
|
||||
"timestamp": datetime.now(datetime.timezone.utc).isoformat(),
|
||||
"timestamp": datetime.now(timezone.utc).isoformat(),
|
||||
}
|
||||
|
||||
# Sign registration data
|
||||
@@ -274,7 +274,7 @@ class Agent:
|
||||
"to": recipient_id,
|
||||
"type": message_type,
|
||||
"payload": payload,
|
||||
"timestamp": datetime.now(datetime.timezone.utc).isoformat(),
|
||||
"timestamp": datetime.now(timezone.utc).isoformat(),
|
||||
}
|
||||
|
||||
# Sign message
|
||||
|
||||
@@ -6,7 +6,7 @@ import asyncio
|
||||
import httpx
|
||||
import uuid
|
||||
from typing import Dict, List, Optional, Any
|
||||
from datetime import datetime, UTC, timedelta
|
||||
from datetime import datetime, timezone, timedelta
|
||||
from dataclasses import dataclass, asdict
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
@@ -233,7 +233,7 @@ class ComputeProvider(Agent):
|
||||
job = JobExecution(
|
||||
job_id=job_request["job_id"],
|
||||
consumer_id=job_request["consumer_id"],
|
||||
start_time=datetime.now(datetime.timezone.utc),
|
||||
start_time=datetime.now(timezone.utc),
|
||||
expected_duration=timedelta(hours=job_request["estimated_hours"]),
|
||||
)
|
||||
|
||||
@@ -286,7 +286,7 @@ class ComputeProvider(Agent):
|
||||
notification = {
|
||||
"job_id": job.job_id,
|
||||
"status": job.status,
|
||||
"completion_time": datetime.now(datetime.timezone.utc).isoformat(),
|
||||
"completion_time": datetime.now(timezone.utc).isoformat(),
|
||||
"duration_hours": (
|
||||
job.actual_duration.total_seconds() / 3600
|
||||
if job.actual_duration
|
||||
|
||||
@@ -79,9 +79,9 @@ class SwarmCoordinator(Agent):
|
||||
self.joined_swarms[swarm_id] = {
|
||||
"type": swarm_type,
|
||||
"role": config.get("role", "participant"),
|
||||
"joined_at": datetime.now(datetime.timezone.utc).isoformat(),
|
||||
"joined_at": datetime.now(timezone.utc).isoformat(),
|
||||
"contribution_count": 0,
|
||||
"last_activity": datetime.now(datetime.timezone.utc).isoformat(),
|
||||
"last_activity": datetime.now(timezone.utc).isoformat(),
|
||||
}
|
||||
|
||||
# Initialize swarm reputation
|
||||
@@ -115,7 +115,7 @@ class SwarmCoordinator(Agent):
|
||||
await self._participate_in_decisions(swarm_id)
|
||||
|
||||
# Update activity timestamp
|
||||
swarm_config["last_activity"] = datetime.now(datetime.timezone.utc).isoformat()
|
||||
swarm_config["last_activity"] = datetime.now(timezone.utc).isoformat()
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Swarm participation error for {swarm_id}: {e}")
|
||||
@@ -177,7 +177,7 @@ class SwarmCoordinator(Agent):
|
||||
message_type="data_contribution",
|
||||
priority="medium",
|
||||
payload=data,
|
||||
timestamp=datetime.now(datetime.timezone.utc).isoformat(),
|
||||
timestamp=datetime.now(timezone.utc).isoformat(),
|
||||
swarm_signature="", # Will be added in broadcast_to_swarm
|
||||
)
|
||||
|
||||
@@ -285,7 +285,7 @@ class SwarmCoordinator(Agent):
|
||||
try:
|
||||
# Create coordination proposal
|
||||
proposal = {
|
||||
"task_id": f"task_{datetime.now(datetime.timezone.utc).strftime('%Y%m%d_%H%M%S')}",
|
||||
"task_id": f"task_{datetime.now(timezone.utc).strftime('%Y%m%d_%H%M%S')}",
|
||||
"task_type": task,
|
||||
"coordinator_id": self.identity.id,
|
||||
"required_collaborators": collaborators,
|
||||
@@ -320,7 +320,7 @@ class SwarmCoordinator(Agent):
|
||||
message_type="intelligence_request",
|
||||
priority="high",
|
||||
payload={"request_type": "market_intelligence"},
|
||||
timestamp=datetime.now(datetime.timezone.utc).isoformat(),
|
||||
timestamp=datetime.now(timezone.utc).isoformat(),
|
||||
swarm_signature="",
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user