Class JobService

java.lang.Object
io.skipcheck.tm1.client.service.security.JobService

public final class JobService extends Object
Active jobs on TM1 12 (/Jobs): what each database replica is running right now, which jobs are blocking it, its session and replica, and cancelling a job. Needs schema 12.2.0 (waitingOn(String, ODataQuery) needs 12.3.0); on TM1 11, every method fails with Tm1UnsupportedOperationException before sending a request (use ThreadService on TM1 11).

See what the server is busy with:

// Active jobs running on TM1 12
return tm1.jobs()
	.list(ODataQuery.none().select(Job.ID, Job.DESCRIPTION, Job.STATE, Job.ELAPSED_TIME))
	.map(job -> job.id() + ": " + job.description() + " (" + job.state() + ")");

Cancel a running job:

// Cancel an active job by its ID
return tm1.jobs().cancel(jobId);
  • Constructor Details

    • JobService

      public JobService(Tm1Session session)
      A service sending its requests through session.
      Parameters:
      session - the session
  • Method Details

    • list

      @Tm1Endpoint("EntitySet Jobs") public reactor.core.publisher.Flux<Job> list(ODataQuery query)
      GET Jobs, streamed. Needs schema 12.2.0.
      Parameters:
      query - what to select, filter and order
      Returns:
      the active jobs
    • get

      @Tm1Endpoint("EntitySet Jobs") public reactor.core.publisher.Mono<Job> get(String id, ODataQuery query)
      GET Jobs('id'). Needs schema 12.2.0.
      Parameters:
      id - the job's ID
      query - what to select and expand
      Returns:
      the job, or a Tm1NotFoundException if it's gone
    • waitingOn

      @Tm1Endpoint("Navigation Job/WaitingOn") public reactor.core.publisher.Flux<Job> waitingOn(String id, ODataQuery query)
      GET Jobs('id')/WaitingOn, streamed: the jobs blocking this job. Needs schema 12.3.0.
      Parameters:
      id - the job's ID
      query - what to select and filter
      Returns:
      the blocking jobs
    • session

      @Tm1Endpoint("Navigation Job/Session") public reactor.core.publisher.Mono<Session> session(String id, ODataQuery query)
      GET Jobs('id')/Session: the session this job is servicing. Needs schema 12.2.0.
      Parameters:
      id - the job's ID
      query - what to select
      Returns:
      the job's session
    • replica

      @Tm1Endpoint("Navigation Job/Replica") public reactor.core.publisher.Mono<DatabaseReplica> replica(String id, ODataQuery query)
      GET Jobs('id')/Replica: the database replica this job is running on. Needs schema 12.2.0.
      Parameters:
      id - the job's ID
      query - what to select
      Returns:
      the job's database replica
    • cancel

      @Tm1Endpoint("Action Job/Cancel") public reactor.core.publisher.Mono<Void> cancel(String id)
      tm1.Cancel: asks the job to stop what it's doing. Needs schema 12.2.0.
      Parameters:
      id - the job's ID
      Returns:
      completes when the request is accepted