AlmondTill/G3N API

On this page

cancelSearchJob

mutation · in the family Reading your records

What it does

Stop one of your own background searches — it ends as cancelled and keeps the matches found so far.

Cancel YOUR queued or running background search: the record flips to cancelled and the session's search slot frees at once; the machine notices at its next step boundary and keeps the partial matches it had — no execution is killed, nothing is lost. Only the job's OWNER (the same user AND the same session) may cancel — anyone else refuses AUTHZ/FORBIDDEN; a job outside your tenant, or none at all, is NOT_FOUND; a finished job refuses (terminal records are immutable). Requires the unrestricted capability on a USER session.

What happens

Only the person who started the search can cancel it; a finished search cannot be cancelled. Signing out cancels your running search for you.

Who may call it

Capability area: Reading your records — Looking up and listing the records of your organization.

Arguments

NameTypeRequiredNotes
idID ID!yesThe id of the record.

Returns

SearchJob SearchJob! — the budget rule: at most 50000 records examined (the estimate refuses a plan that cannot fit, with the numbers) · 300 s from the start (past it the job is expired WITH its partials) · 400 machine steps. ONE running job per signed-in session (the SEARCHLOCK marker — a second start refuses CONFLICT/SEARCH_JOB_ACTIVE naming the holder). Lifecycle queued → running → done | cancelled | expired | failed: cancel is the owner's (cancelSearchJob) or the session's end; done stays listed, the other terminals are doomed-class. The generic wire is READ-ONLY (the two reads) — the bespokes own the writes: startSearchJob (THE PLAN GATE, then the per-family list-op offer AS THE CALLER — a family you may not list stops the plan before any read) · cancelSearchJob · searchJobMatches (gated by the READER's own list right over the plan's terminal family).

Example request

mutation ExampleCancelSearchJob($id: ID!) {
  cancelSearchJob(id: $id) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    userId
    sessionId
    planJson
    words
    stepsDone
    examined
    matchCount
    startedAt
    finishedAt
    problem
    sfExecutionArn
    resultTtl
  }
}

Variables:

{
  "id": "01900000-0000-7000-8000-37386ae00000"
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

{
  "data": {
    "cancelSearchJob": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "SJ-EXMP-0000-000F",
      "type": "SearchJob",
      "caption": "Blue jeans",
      "status": "queued",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "userId": "01900000-0000-7000-8000-11f967df0000",
      "sessionId": "01900000-0000-7000-8000-be25a35a0000",
      "planJson": "<plan json>",
      "words": "<words>",
      "stepsDone": 1,
      "examined": 1,
      "matchCount": 1,
      "startedAt": "2027-01-31T00:00:00.000Z",
      "finishedAt": "2027-01-31T00:00:00.000Z",
      "problem": "<problem>",
      "sfExecutionArn": "<sf execution arn>",
      "resultTtl": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer