ProcessService
from skipcheck_tm1.services import ProcessServiceUsed in the walkthrough Run a process and read its result.
Processes (TurboIntegrator): /Processes, compiling and running them, and their
error logs.
Parameters go as a map of name to value, in order; a numeric parameter needs a number, not text. Running a process returns when it ends, however long that takes: give the request a timeout that fits, and know that cancelling the call doesn't stop the process on the server.
Create a process, compiling it first, since TM1 saves code that doesn't compile:
# TM1 saves code that doesn't compile, so compile the definition first
process = (
ProcessPatch.builder()
.name("Load Sales")
.parameters(
[
ProcessParameterPatch.builder().name("pVersion").value("Actual").type(ProcessVariableType.STRING).build(),
ProcessParameterPatch.builder().name("pYear").value(2026).type(ProcessVariableType.NUMERIC).build(),
]
)
.prolog_procedure("LogOutput('INFO', 'Loading ' | pVersion | ' for ' | NumberToString(pYear));\n")
.build()
)
errors = tm1.processes.compile(process)
if errors:
raise ValueError(f"The process doesn't compile: {errors}")
return tm1.processes.create(process)
Run it with parameters, and fail if it wrote an error log:
# Parameters by name, in order; a numeric one takes a number, not text
parameters = {"pVersion": "Forecast", "pYear": 2026}
result = tm1.processes.execute_with_return("Load Sales", parameters, ODataQuery.none().expand(ProcessExecuteResult.ERROR_LOG_FILE))
# A run that ended with errors names the log it wrote
if result.error_log_file is not None:
raise RuntimeError(f"{result.process_execute_status_code}: see {result.error_log_file.filename}")
return result
Run code without saving it as a process:
# A one-off run of code that isn't saved as a process
cleanup = ProcessPatch.builder().name("Clear Sales Staging").prolog_procedure("CubeClearData('Sales Staging');\n").build()
return tm1.processes.execute_with_return(cleanup)
The asyncio flavor, skipcheck_tm1.aio, has the same methods to await, on AsyncProcessService.
Members
list | GET Processes. |
get | The process, or a Tm1NotFoundError if there's none. |
create | Creates a process; it needs a name. |
update | Changes the properties the patch sets, such as a procedure. |
delete | DELETE Processes('name'). |
compile | The syntax errors, by procedure and line; none if it compiles. |
execute_with_return | Runs a process and says how it ended. |
execute | Runs a process without saying how it ended. |
error_logs | The logs its failed runs wrote, keyed by their timestamps... |
error_log_content | An error log's text. |
list
list(query: ODataQuery | None = None, **options: Any) -> list[Process]GET Processes.
TM1 REST EntitySet Processes
get
get(name: str, query: ODataQuery | None = None, **options: Any) -> ProcessGET Processes('name'): the process, or a Tm1NotFoundError if there's none. TM1 (11.8) leaves most of DataSource, and UIData and VariablesUIData, out of a $select=*: select them by name, or select nothing, to get them.
TM1 REST EntitySet Processes
create
create(process: Any) -> ProcessPOST Processes: creates a process; it needs a name. TM1 (11.8) saves code that doesn't compile: check it with compile(definition) first.
TM1 REST EntitySet Processes
update
update(name: str, patch: Any, etag: str | None = None) -> NonePATCH Processes('name'): changes the properties the patch sets, such as a procedure. TM1 (11.8) saves code that doesn't compile. With etag (Process.etag), sent as If-Match: a Tm1PreconditionFailedError if the process had changed.
TM1 REST EntitySet Processes
delete
delete(name: str) -> NoneDELETE Processes('name').
TM1 REST EntitySet Processes
compile
compile(name: Any = None, definition: Any = None) -> list[ProcessSyntaxError]The syntax errors, by procedure and line; none if it compiles. Needs schema 11.0.0.
* compile(name): tm1.Compile, compiles a saved process; * compile(definition): CompileProcess, compiles a process definition (a ProcessPatch or Process, with its procedures and parameters) that needn't be saved, such as one about to be created.
TM1 REST Action Process/Compile ActionImport CompileProcess
execute_with_return
execute_with_return(name: Any = None, definition: Any = None, parameters: Mapping[str, Any] | None = None, query: ODataQuery | None = None, **options: Any) -> ProcessExecuteResultRuns a process and says how it ended: ProcessExecuteStatusCode, and the error log's file if it wrote one (expand ErrorLogFile with query). Needs schema 11.3.0.
* execute_with_return(name, parameters): tm1.ExecuteWithReturn, a saved process; * execute_with_return(definition, parameters): ExecuteProcessWithReturn, a definition that needn't be saved.
parameters are by name, in order, and may be left out. A ProcessError, or a runtime error, ends it Aborted, with an ErrorLogFile named tm1processerror_<time>_<process>.log. A run cancelled through its thread (ThreadService.cancel) fails instead, with a Tm1ServerError (TM1UserException: Cancel, code 174).
TM1 REST Action Process/ExecuteWithReturn ActionImport ExecuteProcessWithReturn Navigation ProcessExecuteResult/ErrorLogFile
execute
execute(name: Any = None, definition: Any = None, parameters: Mapping[str, Any] | None = None) -> NoneRuns a process without saying how it ended: tm1.Execute for a saved one (execute(name, parameters)), ExecuteProcess for a definition (execute(definition, parameters), needs schema 11.0.0).
.. deprecated:: 11.3.0 Use execute_with_return.
TM1 REST Action Process/Execute ActionImport ExecuteProcess
error_logs
error_logs(name: str, query: ODataQuery | None = None, **options: Any) -> list[ProcessErrorLog]GET Processes('name')/ErrorLogs: the logs its failed runs wrote, keyed by their timestamps.
.. deprecated:: 11.3.0 With ProcessErrorLog: a run's log is the ErrorLogFile that execute_with_return returns.
TM1 REST Navigation Process/ErrorLogs
error_log_content
error_log_content(name: str, log: ProcessErrorLog) -> strGET Processes('name')/ErrorLogs('timestamp')/Content: an error log's text. TM1 keys error logs by their timestamp as a quoted string, as it lists it.
.. deprecated:: 11.3.0 With ProcessErrorLog: a run's log is the ErrorLogFile that execute_with_return returns.
TM1 REST Navigation Process/ErrorLogs