fix: update API endpoints to use /api/v1 prefix, fix blockchain node URL, resolve variable scoping issues, and accept multiple success status codes
- Change marketplace endpoints from /v1/* to /api/v1/* for consistency - Update blockchain status node 1 URL from localhost:8082 to localhost:8003 - Fix blockchain health endpoint to use /health instead of /v1/health - Generate unique workflow_id using uuid.uuid4() instead of undefined agent_id variable - Accept both 200 and 202 status codes for agent
This commit is contained in:
@@ -51,7 +51,7 @@ def register(ctx, name: str, memory: Optional[int], cuda_cores: Optional[int],
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.post(
|
||||
f"{config.coordinator_url}/v1/marketplace/gpu/register",
|
||||
f"{config.coordinator_url}/api/v1/marketplace/gpu/register",
|
||||
headers={
|
||||
"Content-Type": "application/json",
|
||||
"X-Api-Key": config.api_key or "",
|
||||
@@ -96,7 +96,7 @@ def list(ctx, available: bool, model: Optional[str], memory_min: Optional[int],
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.get(
|
||||
f"{config.coordinator_url}/v1/marketplace/gpu/list",
|
||||
f"{config.coordinator_url}/api/v1/marketplace/gpu/list",
|
||||
params=params,
|
||||
headers={"X-Api-Key": config.api_key or ""}
|
||||
)
|
||||
@@ -120,7 +120,7 @@ def details(ctx, gpu_id: str):
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.get(
|
||||
f"{config.coordinator_url}/v1/marketplace/gpu/{gpu_id}",
|
||||
f"{config.coordinator_url}/api/v1/marketplace/gpu/{gpu_id}",
|
||||
headers={"X-Api-Key": config.api_key or ""}
|
||||
)
|
||||
|
||||
@@ -152,7 +152,7 @@ def book(ctx, gpu_id: str, hours: float, job_id: Optional[str]):
|
||||
|
||||
with httpx.Client() as client:
|
||||
response = client.post(
|
||||
f"{config.coordinator_url}/v1/marketplace/gpu/{gpu_id}/book",
|
||||
f"{config.coordinator_url}/api/v1/marketplace/gpu/{gpu_id}/book",
|
||||
headers={
|
||||
"Content-Type": "application/json",
|
||||
"X-Api-Key": config.api_key or ""
|
||||
@@ -180,7 +180,7 @@ def release(ctx, gpu_id: str):
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.post(
|
||||
f"{config.coordinator_url}/v1/marketplace/gpu/{gpu_id}/release",
|
||||
f"{config.coordinator_url}/api/v1/marketplace/gpu/{gpu_id}/release",
|
||||
headers={"X-Api-Key": config.api_key or ""}
|
||||
)
|
||||
|
||||
@@ -208,7 +208,7 @@ def orders(ctx, status: Optional[str], limit: int):
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.get(
|
||||
f"{config.coordinator_url}/v1/marketplace/orders",
|
||||
f"{config.coordinator_url}/api/v1/marketplace/orders",
|
||||
params=params,
|
||||
headers={"X-Api-Key": config.api_key or ""}
|
||||
)
|
||||
@@ -232,7 +232,7 @@ def pricing(ctx, model: str):
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.get(
|
||||
f"{config.coordinator_url}/v1/marketplace/pricing/{model}",
|
||||
f"{config.coordinator_url}/api/v1/marketplace/pricing/{model}",
|
||||
headers={"X-Api-Key": config.api_key or ""}
|
||||
)
|
||||
|
||||
@@ -256,7 +256,7 @@ def reviews(ctx, gpu_id: str, limit: int):
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.get(
|
||||
f"{config.coordinator_url}/v1/marketplace/gpu/{gpu_id}/reviews",
|
||||
f"{config.coordinator_url}/api/v1/marketplace/gpu/{gpu_id}/reviews",
|
||||
params={"limit": limit},
|
||||
headers={"X-Api-Key": config.api_key or ""}
|
||||
)
|
||||
@@ -291,7 +291,7 @@ def review(ctx, gpu_id: str, rating: int, comment: Optional[str]):
|
||||
|
||||
with httpx.Client() as client:
|
||||
response = client.post(
|
||||
f"{config.coordinator_url}/v1/marketplace/gpu/{gpu_id}/reviews",
|
||||
f"{config.coordinator_url}/api/v1/marketplace/gpu/{gpu_id}/reviews",
|
||||
headers={
|
||||
"Content-Type": "application/json",
|
||||
"X-Api-Key": config.api_key or ""
|
||||
@@ -344,7 +344,7 @@ def submit(ctx, provider: str, capacity: int, price: float, notes: Optional[str]
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.post(
|
||||
f"{config.coordinator_url}/v1/marketplace/bids",
|
||||
f"{config.coordinator_url}/api/v1/marketplace/bids",
|
||||
headers={
|
||||
"Content-Type": "application/json",
|
||||
"X-Api-Key": config.api_key or ""
|
||||
@@ -383,7 +383,7 @@ def list(ctx, status: Optional[str], provider: Optional[str], limit: int):
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.get(
|
||||
f"{config.coordinator_url}/v1/marketplace/bids",
|
||||
f"{config.coordinator_url}/api/v1/marketplace/bids",
|
||||
params=params,
|
||||
headers={"X-Api-Key": config.api_key or ""}
|
||||
)
|
||||
@@ -450,7 +450,7 @@ def create(ctx, gpu_id: str, price_per_hour: float, min_hours: float,
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.post(
|
||||
f"{config.coordinator_url}/v1/marketplace/offers",
|
||||
f"{config.coordinator_url}/api/v1/marketplace/offers",
|
||||
headers={
|
||||
"Content-Type": "application/json",
|
||||
"X-Api-Key": config.api_key or ""
|
||||
@@ -499,7 +499,7 @@ def list(ctx, status: Optional[str], gpu_model: Optional[str], price_max: Option
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.get(
|
||||
f"{config.coordinator_url}/v1/marketplace/offers",
|
||||
f"{config.coordinator_url}/api/v1/marketplace/offers",
|
||||
params=params,
|
||||
headers={"X-Api-Key": config.api_key or ""}
|
||||
)
|
||||
@@ -622,7 +622,7 @@ def list_resource(ctx, resource_id: str, resource_type: str, compute_power: floa
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.post(
|
||||
f"{config.coordinator_url}/v1/marketplace/list",
|
||||
f"{config.coordinator_url}/api/v1/marketplace/list",
|
||||
json=resource_data,
|
||||
headers={"X-Api-Key": config.api_key or ""}
|
||||
)
|
||||
@@ -661,7 +661,7 @@ def rent(ctx, resource_id: str, consumer_id: str, duration: int, max_price: Opti
|
||||
try:
|
||||
with httpx.Client() as client:
|
||||
response = client.post(
|
||||
f"{config.coordinator_url}/v1/marketplace/rent",
|
||||
f"{config.coordinator_url}/api/v1/marketplace/rent",
|
||||
json=rental_data,
|
||||
headers={"X-Api-Key": config.api_key or ""}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user