Class Task


  • public class Task
    extends APIRequestHandler
    /api/task[/{ID}] : information about currently running tasks.

    Provides information about tasks/threads that are currently running or recently finished.

    Methods supported:

    GET
    • Optional parameters
      • log "true" to include the task's log in the response.
      • keepalive Requesting a task's status has the side-effect of keeping it from being released soon. Passing this keepalive=false suppresses this side-effect.
    • Response Body - the standard JSON envelope. If no ID is specified, the model is an array of IDs of currently running threads. If an ID is appended to the URL, the model is an object with the following attributes:
      threadId
      The task's ID
      threadName
      The name of the task
      log
      The task's log, if requested
      resultUrl
      The URL of the task's result, if any
      resultText
      The label for the task's result, if any
      resultTarget
      The target HTML frame/window for the results to open in
      running
      Whether the task is currently running
      duration
      How long the task has run for
      percentComplete
      How far through the task is
      status
      The task's current status description
      refreshSeconds
      recommended delay before refreshing the task information
      lastException
      The last exception to occur, if any
      stackTrace
      If an exception has occurred, this is a stack trace identifying where the exception was thrown
      If the task produces searach results, the following optional attributes may also included:
      layers
      An array of IDs of layers that were matched during the search
      targetLayer
      The ID of the target layer
      size
      How many results are available
      resultsName
      The name of the result set, if any
      seriesId
      The unique database ID of the result set, if any
      totalUtteranceDuration
      The duration of all the utterances included in the results, if available
      csv
      The name of the reloaded CSV results file, if any
      csvColumns
      If the results were reloaded from a CSV file, this is an array of strings representing the CSV columns in the file.
    • Response Status 200 on success, or 404 if the task ID is invalid.
    DELETE
    An ID must be supplied for DELETE operations. If the "cancel" parameter is supplied, the running task is cancelled. Otherwise, the finished task is released. Only the user that created the task, or "admin" users can cancel/delete the task.
    • Optional parameters
      • cancel "true" to cancel the task but not release it.
    • Response Status 200 on success, 404 if the task ID is invalid, 403 if the user is not allowed to cancel/release the taks, or 400 if no ID was supplied.
    • Response Body - the standard JSON envelope, with a model representing the current state of the task, as with GET requests.

    Author:
    Robert Fromont
    • Constructor Detail

      • Task

        public Task()
        Constructor
    • Method Detail

      • get

        public javax.json.JsonObject get​(String pathInfo,
                                         RequestParameters parameters,
                                         Consumer<Integer> httpStatus)
        Returns information about current tasks, or the given task if an ID is specified.
        Parameters:
        pathInfo - The URL path from which the upload ID can be inferred.
        parameters - Request parameter map.
        httpStatus - Receives the response status code, in case of error.
        Returns:
        JSON-encoded object representing the response.
      • delete

        public javax.json.JsonObject delete​(String pathInfo,
                                            RequestParameters parameters,
                                            Consumer<Integer> httpStatus)
        Either cancel a currently running thread, or release a finished thread.
        Parameters:
        pathInfo - The URL path from which the upload ID can be inferred.
        parameters - Request parameter map.
        httpStatus - Receives the response status code, in case of error.
        Returns:
        JSON-encoded object representing the response.