Class JobsService

java.lang.Object
com.alibaba.dashscope.resources.jobs.JobsService

public final class JobsService extends Object
Generic async-task service (design §3): submit with X-DashScope-Async: enable, poll GET /tasks/{taskId}, cancel via POST /tasks/{taskId}/cancel, list via GET /tasks. wait polls with a 1s → 8s backoff and a 24h default budget.
  • Field Details

    • DEFAULT_WAIT_TIMEOUT

      public static final Duration DEFAULT_WAIT_TIMEOUT
      Upper bound on the total wait budget (design §3).
  • Constructor Details

  • Method Details

    • create

      public Job create(String servicePath, com.fasterxml.jackson.databind.JsonNode body, RequestOptions options)
      Submit an async job: POST servicePath with the async header.
    • create

      public Job create(String servicePath, com.fasterxml.jackson.databind.JsonNode body, Map<String,String> extraHeaders, RequestOptions options)
      Submit an async job carrying extra request headers (e.g. the OSS resolve opt-in).
    • fetch

      public Job fetch(String taskId, RequestOptions options)
    • wait

      public Job wait(String taskId, RequestOptions options)
      Blocks until a terminal state; equivalent to repeatedly jobs().fetch with a 1s→8s backoff (default budget 24h).
    • wait

      public Job wait(String taskId, Duration waitTimeout, RequestOptions options)
    • cancel

      public Job cancel(String taskId, RequestOptions options)
    • list

      public Page<Job> list(Map<String,String> query, RequestOptions options)
      List jobs; query keys follow the wire names (page_no/page_size/model_name/status/...).