Knime execution from Python logs

I’m using the library from PyPi to integrate my workflows in my scripts.
Where can I find the logs that are usually generated during the execution? As far as I could see it was not appended in the usual KNIME_WORSPACE.metadata\knime.log

The problem is that the library uses the option -data in the call of knime.exe, therefore the logs end up in this folder which by default is a temporary folder.

The use of this option was also removes the preferences (R snippets where not able to find the R Home), specifying -preferences in the call doesn’t seem to solve the issue

In the knimepy project’s github repo, PR#19 (https://github.com/knime/knimepy/pull/19) introduces a change to not specify -data when specifying save_after_execution=True. This was motivated by my feeling frustrated that the logs were not accessible to me after a failed execution. Since I use save_after_execution=True to help me debug things any time a workflow fails, I thought this change would make sense as well as be helpful when/where I needed it most.

I have not invoked a workflow from knimepy that contained R snippet nodes – that is an interesting problem. When you wrote, “specifying -preferences in the call doesn’t seem to solve the issue”, does that mean you tried modifying knimepy to add -preferences ... to its execution string for KNIME?

Yes I tried to modify knimepy to add the preference option but if I have both -data and -preference the workflow doesn’t even start (error code 2). I’ve replicated the same issues by starting the workflow from command line.
I’ve solved the R home issue by commenting the row with the -data option (my current workflows don’t use it anyway) but it’s not a nice solution.

I’ve implemented a solution that automatically locate the logs in the temporary folder and save them in a customizable folder but there I get stuck due to the missing preferences

Would you be willing to try using the knime.py from PR#19 (direct link to that updated file: https://raw.githubusercontent.com/knime/knimepy/issue_18_handle_nan_values_in_input_dataframe/knime.py) to see if you like the control it offers for preservation of the logs?

It does not properly address the issue with the R Snippet nodes. While it will suppress the use of -data, and this probably means the R Snippet nodes will work happily for you, I do not regard this as the right solution – at least I would not want to feel obligated to always save the workflow state after execution. But I do like the idea of saving workflow state when I want to debug and review the logs afterwards.

If you like the updated knime.py in PR#19, then I want to get that into a new release. Then we still also need to sort out the undesirable behavior with the R Snippet nodes.

I will try it next week and let you know.

FYI in my version of the library I also modified the LocalWorkflow class to include an “executed” attribute (boolean) and to save the the last return code from the subprocess command, if interested I will open a feature request in git or share my version of the code

Yes please – I would love to see those modifications. Exposing the last return code does sound useful. The “executed” attribute makes me think about what to do in the RemoteWorkflow class.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.