PankajMahato
PankajMahato2mo ago

Nested flows/scripts logs in main flow

When there is a flow which contains another flow or scripts then the nested one's logs don't show up in the main flow logs. Any way to show them?
13 Replies
PankajMahato
PankajMahatoOP2mo ago
@fjørdlek Any help would be appreciated
fjørdlek
fjørdlek2mo ago
see screenshots above
No description
No description
PankajMahato
PankajMahatoOP2mo ago
@fjørdlek There are currently 2 problems which I have. 1. For nested Flows it is possible to see the logs by navigating through the UI but there is no single logs page where I can see the all the log in sequential manner. There is "explore all step's logs" link but it is very difficult to understand the sequence or which steps it belongs. Attached Image 2. If a script is called from within another script then the nested script logs are not visible by any means. Even I set debug to true. Synatx: await wmill.runScript('u/admin/nested_script',null,{x:"HELLO"},true); Also, there is no api which returns all the logs in a single call.
No description
No description
No description
fjørdlek
fjørdlek2mo ago
@PankajMahato we do have a backlog item to improve the flow log experience. For 2. that's expected, similar as with flow, each job is it's own isolated process with it's own logs so it does not make senes to give the impression that they are just executed as one. Running a windmill script triggers a new job with it's own logs (you can go to the runs page and find that log or use the api to print the log/status in your calling script).
PankajMahato
PankajMahatoOP2mo ago
Thanks a lot @fjørdlek for the detailed answer. For the last option, if I decide to make it synchronous nested script call and then print the logs. Then I have to write a HTTP get call from my typescript code after this line await wmill.runScript('u/admin/nested_script',null,{x:"HELLO"},true); But to make an API call I would need to create a separate token right? Even though it is executed from within a script/flow, for the backend it will appear as a fresh call?
fjørdlek
fjørdlek2mo ago
no you can use $WM_TOKEN contextual env var each script has access to which is an ephemeral token that can be used you can also use wmill.JobService.getJobLogs and it will take care of the token
PankajMahato
PankajMahatoOP2mo ago
Thanks ❤️ @fjørdlek I was searching Windmill docs but couldn't find any example/reference for wmill.JobService.getJobLogs Can you please share some examples or the docs link?
fjørdlek
fjørdlek2mo ago
logs = await wmill.JobService.getJobLogs({ workspace: workspaceId, id: jobId });
PankajMahato
PankajMahatoOP2mo ago
Thanks, is there any separate docs page to get these kind of info? I am aware of only https://app.windmill.dev/openapi.html . Here only REST APIs are present
fjørdlek
fjørdlek2mo ago
yeah, so basically each API endpoint autogenerates a function in the typescript client: so in the get job logs openapi reference, you'll see a "tag" in that case called job => JobService and then operationId => function name getJobLogs
PankajMahato
PankajMahatoOP2mo ago
Understood. Thanks ❤️
fjørdlek
fjørdlek2mo ago
and we also autogenerate types, so usually you're ide (or the windmill frontend webIde) will be able to "autocomplete" it for you
fjørdlek
fjørdlek2mo ago
No description
No description

Did you find this page helpful?