skipcheck

TM1 client · Docs · Processes and chores

ProcessDebugService

from skipcheck_tm1.services import 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.
debug = tm1.process_debugging

def stop_at_line_3(context: ProcessDebugContext) -> list[str]:
    assert context.id is not None
    line3 = (
        ProcessDebugContextLineBreakpointPatch.builder()
        .id(1)  # TM1 needs an ID chosen by the caller
        .process_name("Load Sales")
        .procedure(ProcessProcedure.PROLOG)
        .line_number(3)
        .enabled(True)
        .build()
    )
    debug.add_breakpoint(context.id, line3)
    debug.resume(context.id)
    return [f"{frame.procedure}, line {frame.line_number}" for frame in debug.call_stack(context.id)]

return debug.debugging("Load Sales", {"pVersion": "Forecast"}, stop_at_line_3)

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

# Without debugging(), end the run with finish(): TM1 can't delete it
debug = tm1.process_debugging
context = debug.debug("Load Sales")
assert context.id is not None
debug.step_over(context.id)
debug.step_over(context.id)
return debug.finish(context.id)

The asyncio flavor, skipcheck_tm1.aio, has the same methods to await, on AsyncProcessDebugService.

Members

MAX_RESUMES static
debugStarts debugging a process, with its parameters by name, in order; returns the debug context, with its ID.
debuggingDebugs a process for the length of work (given the context.
listGET ProcessDebugContexts.
getThe context, or a Tm1NotFoundError.
finishRuns a debug run to its end.
resumeRuns to the next breakpoint, or to the end.
step_inRuns one line, into a process it calls.
step_outRuns to the end of the current procedure or called process.
step_overRuns one line, over any process it calls.
breakpointsGET …/Breakpoints, each as its kind.
add_breakpointAdds a breakpoint, its kind given by the patch (ProcessDebugContextLineBreakpointPatch, …Data…, …Lock…).The caller chooses the breakpoint's ID.
update_breakpointChanges a breakpoint, such as enabling or disabling it.
remove_breakpointDELETE …/Breakpoints(n).
current_breakpointThe breakpoint the run is paused at, or None if it isn't paused at one.
call_stackWhere the run is, innermost frame first.
variablesThe frame's variables and their values.
frame_processThe process the frame runs.
processThe process being debugged.
threadThe server thread running the debug run.

MAX_RESUMES

static
MAX_RESUMES

debug

debug(process: str, parameters: Mapping[str, Any] | None = None, query: ODataQuery | None = None, **options: Any) -> ProcessDebugContext

tm1.Debug: starts debugging a process, with its parameters by name, in order; returns the debug context, with its ID.

TM1 REST Action Process/Debug

debugging

debugging(process: str, parameters: Mapping[str, Any] | None, work: Callable[[ProcessDebugContext], Any]) -> Any

Debugs a process for the length of work (given the context: set breakpoints, step, read variables; a coroutine function in the asyncio flavor), then finishes the run, however the work ends. TM1 (11.8) refuses to delete a debug context, so finishing it is how the run ends. Returns what the work does.

TM1 REST Action Process/Debug EntitySet ProcessDebugContexts

list

list(query: ODataQuery | None = None, **options: Any) -> list[ProcessDebugContext]

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

TM1 REST EntitySet ProcessDebugContexts

get

get(id: str, query: ODataQuery | None = None, **options: Any) -> ProcessDebugContext

GET ProcessDebugContexts('id'): the context, or a Tm1NotFoundError.

TM1 REST EntitySet ProcessDebugContexts

finish

finish(id: str) -> ProcessDebugContext

Runs a debug run to its end: removes its breakpoints, then resumes until it's Complete (at most MAX_RESUMES times). 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. Returns the context, with the run's Result.

TM1 REST Action ProcessDebugContext/Continue Navigation ProcessDebugContext/Breakpoints

resume

resume(id: str, query: ODataQuery | None = None, **options: Any) -> ProcessDebugContext

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

TM1 REST Action ProcessDebugContext/Continue

step_in

step_in(id: str, query: ODataQuery | None = None, **options: Any) -> ProcessDebugContext

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

TM1 REST Action ProcessDebugContext/StepIn

step_out

step_out(id: str, query: ODataQuery | None = None, **options: Any) -> ProcessDebugContext

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

TM1 REST Action ProcessDebugContext/StepOut

step_over

step_over(id: str, query: ODataQuery | None = None, **options: Any) -> ProcessDebugContext

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

TM1 REST Action ProcessDebugContext/StepOver

breakpoints

breakpoints(id: str, query: ODataQuery | None = None, **options: Any) -> list[ProcessDebugContextBreakpoint]

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

TM1 REST Navigation ProcessDebugContext/Breakpoints

add_breakpoint

add_breakpoint(id: str, breakpoint: Any) -> ProcessDebugContextBreakpoint

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). Raises ValueError if the patch has no ID of 0 or more.

TM1 REST Navigation ProcessDebugContext/Breakpoints

update_breakpoint

update_breakpoint(id: str, breakpoint: int, patch: Any) -> None

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

TM1 REST Navigation ProcessDebugContext/Breakpoints

remove_breakpoint

remove_breakpoint(id: str, breakpoint: int) -> None

DELETE …/Breakpoints(n).

TM1 REST Navigation ProcessDebugContext/Breakpoints

current_breakpoint

current_breakpoint(id: str, query: ODataQuery | None = None, **options: Any) -> ProcessDebugContextBreakpoint | None

GET …/CurrentBreakpoint: the breakpoint the run is paused at, or None if it isn't paused at one.

TM1 REST Navigation ProcessDebugContext/CurrentBreakpoint

call_stack

call_stack(id: str, query: ODataQuery | None = None, **options: Any) -> list[ProcessDebugContextStackFrame]

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

TM1 REST Navigation ProcessDebugContext/CallStack

variables

variables(id: str, frame: str, query: ODataQuery | None = None, **options: Any) -> list[ProcessDebugContextVariable]

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

TM1 REST Navigation ProcessDebugContextStackFrame/Variables

frame_process

frame_process(id: str, frame: str, query: ODataQuery | None = None, **options: Any) -> Process

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

TM1 REST Navigation ProcessDebugContextStackFrame/Process

process

process(id: str, query: ODataQuery | None = None, **options: Any) -> Process

GET …/Process: the process being debugged.

TM1 REST Navigation ProcessDebugContext/Process

thread

thread(id: str, query: ODataQuery | None = None, **options: Any) -> Thread

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

TM1 REST Navigation ProcessDebugContext/Thread