skipcheck

TM1 client · Docs · Processes and chores

ProcessDebugService

import io.skipcheck.tm1.client.service.process.ProcessDebugService;

Process debugging: a run of a process that stops at breakpoints and steps line by line, held on the server as a ProcessDebugContext until deleted.

debug starts one, paused before the first line; resume runs to the next breakpoint (or the end), and the step… methods move a line at a time. Each returns the context as it then is. TM1 (11.8) answers a start, a resume or a step without waiting for the run to stop again, so the status is RUNNING or PAUSED depending on which came first; get reads it again. A step past a procedure's last line either pauses with an empty call stack or completes the run.

TM1 (11.8) refuses to delete a debug context: a run ends by running to completion, which finish does, and debugging does when its work is done. A finished context stays readable until the session ends. ProcessDebugContexts lists none, though each reads by ID.

Stop at a breakpoint and see where the run is, with debugging finishing the run afterwards:

// Where the run stops at a breakpoint on line 3 of the prolog. debugging()
// runs it to the end afterwards.
ProcessDebugService debug = tm1.processDebugging();
return debug.debugging("Load Sales", Map.of("pVersion", "Forecast"), context -> {
    String id = Objects.requireNonNull(context.id());
    ProcessDebugContextLineBreakpointPatch line3 = ProcessDebugContextLineBreakpointPatch.builder()
        .id(1) // TM1 needs an ID chosen by the caller
        .processName("Load Sales")
        .procedure(ProcessProcedure.PROLOG)
        .lineNumber(3)
        .enabled(true)
        .build();
    return debug.addBreakpoint(id, line3)
        .then(debug.resume(id, ODataQuery.none()))
        .thenMany(debug.callStack(id, ODataQuery.none()))
        .map(frame -> frame.procedure() + ", line " + frame.lineNumber());
});

Step through a run started with debug, and finish it:

// Without debugging(), end the run with finish(): TM1 can't delete it
ProcessDebugService debug = tm1.processDebugging();
return debug.debug("Load Sales", Map.of(), ODataQuery.none())
    .map(context -> Objects.requireNonNull(context.id()))
    .flatMap(id -> debug.stepOver(id, ODataQuery.none())
        .then(debug.stepOver(id, ODataQuery.none()))
        .then(debug.finish(id)));

Members

ProcessDebugService constructorA service sending its requests through session.
debugStarts debugging a process.
debuggingDebugs a process for the length of work, then finishes the run.
listGET ProcessDebugContexts, streamed.
getGET ProcessDebugContexts('id').
finishRuns a debug run to its end.
resumeRuns to the next breakpoint, or to the end.
stepInRuns one line, into a process it calls.
stepOutRuns to the end of the current procedure or called process.
stepOverRuns one line, over any process it calls.
breakpointsGET …/Breakpoints, streamed, each as its kind.
addBreakpointAdds a breakpoint, its kind given by the patch (ProcessDebugContextLineBreakpointPatch, …Data…, …Lock…).
updateBreakpointChanges a breakpoint, such as enabling or disabling it.
removeBreakpointDELETE …/Breakpoints(n).
currentBreakpointThe breakpoint the run is paused at.
callStackGET …/CallStack, streamed.
variablesGET …/CallStack('frame')/Variables, streamed.
frameProcessThe process the frame runs.
processThe process being debugged.
threadThe server thread running the debug run.

ProcessDebugService

constructor
ProcessDebugService(Tm1Session session)

A service sending its requests through session.

Parameters

session
the session

debug

Mono<ProcessDebugContext> debug(String process, Map<String,?> parameters, ODataQuery query)

tm1.Debug: starts debugging a process.

Parameters

process
the process's name
parameters
its parameters, by name, in order; may be empty
query
what to expand of the context

Returns

the debug context, with its ID

TM1 REST Action Process/Debug

debugging

<R> Flux<R> debugging(String process, Map<String,?> parameters, Function<ProcessDebugContext,Publisher<R>> work)

Debugs a process for the length of work, then finishes the run: when the work completes, fails or is cancelled. TM1 (11.8) refuses to delete a debug context, so finishing it is how the run ends.

Parameters

process
the process's name
parameters
its parameters, by name, in order; may be empty
work
what to do with the context: set breakpoints, step, read variables

Returns

what the work gives, with the run finished at the end

list

Flux<ProcessDebugContext> list(ODataQuery query)

GET ProcessDebugContexts, streamed. TM1 (11.8) lists none, though each reads by ID with get.

Parameters

query
what to select and expand

Returns

the contexts

TM1 REST EntitySet ProcessDebugContexts

get

Mono<ProcessDebugContext> get(String id, ODataQuery query)

GET ProcessDebugContexts('id').

Parameters

id
the context's ID
query
what to expand

Returns

the context, or a Tm1NotFoundException if there's none

TM1 REST EntitySet ProcessDebugContexts

finish

Mono<ProcessDebugContext> finish(String id)

Runs a debug run to its end: removes its breakpoints, then resumes until it's Complete. TM1 (11.8) refuses to delete a debug context, so finishing the run is how to end one; the context stays readable, complete, until the session ends.

Parameters

id
the context's ID

Returns

the context, complete, with the run's Result

resume

Mono<ProcessDebugContext> resume(String id, ODataQuery query)

tm1.Continue: runs to the next breakpoint, or to the end.

Parameters

id
the context's ID
query
what to expand of the context

Returns

the context, paused or complete

TM1 REST Action ProcessDebugContext/Continue

stepIn

Mono<ProcessDebugContext> stepIn(String id, ODataQuery query)

tm1.StepIn: runs one line, into a process it calls.

Parameters

id
the context's ID
query
what to expand of the context

Returns

the context after the step

TM1 REST Action ProcessDebugContext/StepIn

stepOut

Mono<ProcessDebugContext> stepOut(String id, ODataQuery query)

tm1.StepOut: runs to the end of the current procedure or called process.

Parameters

id
the context's ID
query
what to expand of the context

Returns

the context after the step

TM1 REST Action ProcessDebugContext/StepOut

stepOver

Mono<ProcessDebugContext> stepOver(String id, ODataQuery query)

tm1.StepOver: runs one line, over any process it calls.

Parameters

id
the context's ID
query
what to expand of the context

Returns

the context after the step

TM1 REST Action ProcessDebugContext/StepOver

breakpoints

Flux<ProcessDebugContextBreakpoint> breakpoints(String id, ODataQuery query)

GET …/Breakpoints, streamed, each as its kind: line, data or lock.

Parameters

id
the context's ID
query
what to select

Returns

the breakpoints

TM1 REST Navigation ProcessDebugContext/Breakpoints

addBreakpoint

Mono<ProcessDebugContextBreakpoint> addBreakpoint(String id, ProcessDebugContextBreakpointPatch breakpoint)

POST …/Breakpoints: adds a breakpoint, its kind given by the patch (ProcessDebugContextLineBreakpointPatch, …Data…, …Lock…).

The caller chooses the breakpoint's ID: TM1 (11.8) stores one sent without an ID as -1, which it then refuses in a path, so it can't be changed or removed, and a second one without an ID conflicts (409).

Parameters

id
the context's ID
breakpoint
the breakpoint, with an ID of 0 or more, unique in the context

Returns

the breakpoint as created

Throws

IllegalArgumentException
if the patch has no ID of 0 or more

TM1 REST Navigation ProcessDebugContext/Breakpoints

updateBreakpoint

Mono<Void> updateBreakpoint(String id, int breakpoint, ProcessDebugContextBreakpointPatch patch)

PATCH …/Breakpoints(n): changes a breakpoint, such as enabling or disabling it.

Parameters

id
the context's ID
breakpoint
the breakpoint's ID
patch
the changes, of the breakpoint's kind

Returns

completes when it's changed

TM1 REST Navigation ProcessDebugContext/Breakpoints

removeBreakpoint

Mono<Void> removeBreakpoint(String id, int breakpoint)

DELETE …/Breakpoints(n).

Parameters

id
the context's ID
breakpoint
the breakpoint's ID

Returns

completes when it's removed

TM1 REST Navigation ProcessDebugContext/Breakpoints

currentBreakpoint

Mono<ProcessDebugContextBreakpoint> currentBreakpoint(String id, ODataQuery query)

GET …/CurrentBreakpoint: the breakpoint the run is paused at.

Parameters

id
the context's ID
query
what to select

Returns

the breakpoint, or empty if it isn't paused at one

TM1 REST Navigation ProcessDebugContext/CurrentBreakpoint

callStack

Flux<ProcessDebugContextStackFrame> callStack(String id, ODataQuery query)

GET …/CallStack, streamed: where the run is, innermost frame first.

Parameters

id
the context's ID
query
what to select and expand, such as Variables

Returns

the stack frames

TM1 REST Navigation ProcessDebugContext/CallStack

variables

Flux<ProcessDebugContextVariable> variables(String id, String frame, ODataQuery query)

GET …/CallStack('frame')/Variables, streamed: the frame's variables and their values. TM1 (11.8) lists TurboIntegrator's own variables (NVALUE, DATASOURCE…), not the process's local ones.

Parameters

id
the context's ID
frame
the frame's ID
query
what to select and filter

Returns

the variables

TM1 REST Navigation ProcessDebugContextStackFrame/Variables

frameProcess

Mono<Process> frameProcess(String id, String frame, ODataQuery query)

GET …/CallStack('frame')/Process: the process the frame runs.

Parameters

id
the context's ID
frame
the frame's ID
query
what to select

Returns

the process

TM1 REST Navigation ProcessDebugContextStackFrame/Process

process

Mono<Process> process(String id, ODataQuery query)

GET …/Process: the process being debugged.

Parameters

id
the context's ID
query
what to select

Returns

the process

TM1 REST Navigation ProcessDebugContext/Process

thread

Mono<Thread> thread(String id, ODataQuery query)

GET …/Thread: the server thread running the debug run.

Parameters

id
the context's ID
query
what to select

Returns

the thread

TM1 REST Navigation ProcessDebugContext/Thread

Also in the Javadoc.