Planning Analytics

 View Only
  • 1.  Accessing a TI process's error log after ExecuteProcessWithReturn

    Posted Thu March 18, 2021 10:08 AM
    I'm using the REST API to kick off a TI process on the server and am receiving the ProcessExecuteResult object after calling ExecuteProcessWithReturn, which should have a navigation property of ErrorLogFile. What's the best way to get to that ErrorLogFile? I know I can access the list of error log files using the following:

    http://localhost:12354/api/v1/Processes(<<PROCESS NAME>>)?$expand=ErrorLogs

    And I know I can get the contents of one log file using:

    http://localhost:12354/api/v1/ErrorLogFiles(<<LOG FILE NAME>>)/Content

    However, I need to go directly from running the process to the error log file (assuming the process produces an error). What call can I make to the server to achieve this?

    ------------------------------
    Nina Gordy
    ------------------------------

    #PlanningAnalyticswithWatson


  • 2.  RE: Accessing a TI process's error log after ExecuteProcessWithReturn

    Posted Fri March 19, 2021 08:49 AM
    Hi Nina,

    I'm pretty sure this is a two step process.  I believe you need to find the log file (based on the TI process name or thread ID) if you see the TI process fail, and then display the contents using multiple API calls.   I suggest running a TI process from Planning Analytics Workspace (the TI editor widget) where you know the TI process will fail and output a log file.  Enable the ODATA API debug logging in your TM1 Server while you do this.

    https://www.ibm.com/support/pages/planning-analytics-server-logging-odataplanning-analytics-workspace

    This will show you the API calls Workspace makes to TM1 in order to find the TI process log file and display the contents.



    ------------------------------
    Stuart King
    IBM Planning Analytics Offering Manager
    ------------------------------



  • 3.  RE: Accessing a TI process's error log after ExecuteProcessWithReturn

    Posted Mon March 22, 2021 04:38 AM

    Hi Nina,

    Sounds like you know all the pieces of the puzzle already, you just have to put them together. For starters, you write "ExecuteProcessWithReturn, which should have a navigation property of ErrorLogFile", which makes me think you likely forgot to add the $expand query option specifying you wanted that 'ErrorLogFile' property to be expanded into the result (note: navigation properties are not returned by default but have to be explicitly included in the response by specifying them in the $expand query option - see section 11.2.4.2 in the OData Protocol specification).

    With that information in the response to the ExecuteProcessWithReturn you can indeed then request the content of that ErrorLogFile using the ErrorLogFile's 'Content' property as you show above already.

    PS, presuming you are running a registered process, do you know you can call the ExecuteWithReturn action on that process directly as well? For example, using the 'Mover' process from the Planning Sample database, you can combine all this together and call (presuming {{serviceRootUrl}} is set to your TM1 Server's service root URL - in your examples 'http://localhost:12345/api/v1):

    POST {{serviceRootUrl}}/Processes('Mover')/tm1.ExecuteWithReturn?$expand=ErrorLogFile
    Content-Type: application/json
    Accept: application/json;odata.metadata=none

    {}

    after which you retrieve the result of that previous 'executeProcess' request as in:

    GET {{serviceRootUrl}}/ErrorLogFiles('{{executeProcess.response.body.ErrorLogFile.Filename}}')/Content

    Note that in this GET request I explicitly don't specify an Accept header, which translates to accepting all mime-types, as the result of content in this case is `text/plain`.

    Cheers,



    ------------------------------
    Hubert Heijkers
    ------------------------------



  • 4.  RE: Accessing a TI process's error log after ExecuteProcessWithReturn

    Posted Tue March 23, 2021 05:03 PM
    Hi Hubert,

    This worked! Thank you for your help.

    Best,
    Nina

    ------------------------------
    Nina Inverso
    ------------------------------