{
  "openapi": "3.0.3",
  "info": {
    "title": "SparkLang trainer",
    "version": "0.8.0",
    "description": "POST /jobs + GET /jobs/{id}. SPARK_TRAIN_URL is the prefix (often \u2026/v1)."
  },
  "servers": [
    {
      "url": "{SPARK_TRAIN_URL}",
      "variables": {
        "SPARK_TRAIN_URL": {
          "default": "http://127.0.0.1:8090/v1"
        }
      }
    }
  ],
  "paths": {
    "/jobs": {
      "post": {
        "operationId": "submitJob",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "dataset",
                  "base",
                  "out",
                  "backend"
                ],
                "properties": {
                  "dataset": {
                    "type": "string"
                  },
                  "base": {
                    "type": "string"
                  },
                  "out": {
                    "type": "string"
                  },
                  "backend": {
                    "type": "string"
                  },
                  "method": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "dataset": "examples/fixtures/train/dataset.jsonl",
                "base": "fixture-base",
                "out": "out/train/job-dry-001",
                "backend": "http",
                "method": "spark_distill_cpu"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "example": "accepted"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "accepted",
                        "running",
                        "succeeded",
                        "failed",
                        "cancelled"
                      ]
                    },
                    "method": {
                      "type": "string"
                    },
                    "artifacts": {
                      "type": "object"
                    },
                    "schema_version": {
                      "type": "integer",
                      "const": 1
                    },
                    "artifact_path": {
                      "type": "string"
                    },
                    "base": {
                      "type": "string"
                    },
                    "dataset_sha256": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "rows": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "metrics": {
                      "type": "object"
                    },
                    "class_histogram": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "integer"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/jobs/{id}": {
      "get": {
        "operationId": "getJob",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "example": "accepted"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "accepted",
                        "running",
                        "succeeded",
                        "failed",
                        "cancelled"
                      ]
                    },
                    "method": {
                      "type": "string"
                    },
                    "artifacts": {
                      "type": "object"
                    },
                    "schema_version": {
                      "type": "integer",
                      "const": 1
                    },
                    "artifact_path": {
                      "type": "string"
                    },
                    "base": {
                      "type": "string"
                    },
                    "dataset_sha256": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "rows": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "metrics": {
                      "type": "object"
                    },
                    "class_histogram": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "integer"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "unknown_job"
          }
        }
      }
    }
  }
}
