Catch WARN

Hi Knimers,

I would like to know if it is feasible to catch WARN message which are printed in the console in the KNIME Analytics platform.

I tried to use the try/catch and the Active Branch Inverter nodes but I was not able to catch the WARN message only the ERROR ones.

Do you have any suggestions ?

Regards,
Joel

Hello @joel,

try/catch won’t catch warning messages from Console. Is there a warning which stops workflow execution and you would like to catch it or you simply want to have all warnings from certain workflow on one place for documentation/analysis?

Br,
Ivan

Hi @ipazin

I am using a chemaxon to convert molfile (string object ) into molfile (mol object).

The node cannot convert some structures, because the mol content is not correct and displays as a warning message in the console the reason (for example Unknown S-group type “END”).

So I wanted to get this message and attached it to the dataset in order to know why the conversion is not possible.

Regards,
Joel

Hi @joel,

I see but I’m not familiar with this extension. Does node executes successfully or fails upon configuration with warning message?

Br,
Ivan

It executes without error but it generates a warning message if the conversion fails.

So I got warning messages that contains the reason attached to the row IDs, like a java snippet when you try to make an operation on an empty cell (null value).

Joel

Hi @joel,

in that case don’t know a way to catch warning messages from Console. Wondering what would be preferred/best way to have these messages? KNIME table? What you can try is to parse KNIME log where this message is written. Basically you can use File Reader to read log file and Rule-based Row Filter to have only warning messages from certain node in your table.
Example: $Col0$ LIKE "*WARN*" AND $Col0$ LIKE "*String To Number*" => TRUE

Still if you need to do additional processing based on conversion outcome you need to implement this logic in your KNIME workflow.

Hope this helps!

Br,
Ivan

1 Like

Hi @ipazin,

Thanks for your feedback.

I am a litle bit concern by your solution because this workflow is executed either on the Analytics platform or on the server (scheduled job).
So I don’t know if you solution will work on the server or only on the Analytics platform?

Regards,
Joel

What you could try is active workflow based logs, increase the Log Level and read the log back in.

image

It might be necessary to either catch a start time of your workflow and only consider the entries newer than that or delete the file at each start.

1 Like

Hi @mlauber71

I will try your suggestion, thanks.

@ipazin, Do you think that it could be possible to catch those warnings directly using a Knime node in the next releases?

Regards,
Joel

1 Like

Hi @joel,

I see. I’m not sure either how this should work. Probably you need logic to determine if you run workflow on Server or Desktop and then read proper log.

Think this should be addressed somehow. Is (new) node a way to do it? Again not sure.

Anyways let me think/check with someone about it a bit more and will get back to topic.

Br,
Ivan

I once built a workflow to do a meta search in KNIME’s XML files. Maybe you can derive some inspiration from there.

Hi @mlauber71

I checked the “enable per workflow logs” and then parsed the workflow log to get the warn message and it worked.
I mean, I was able to attach the warn message of the log file to the incorrect structure using the row ID.

Now I have to test this solution on the server.

Thanks @mlauber for your advices.

Regards,
Joel

1 Like

great it worked! If you have finished the parsing of the local log with the WARNING maybe you could undertake it to make a working sample to upload to the hub so others could benefit from your insights and the solution. Thank you.

1 Like

Hi

For your information this solution works also on the server.

Joel

1 Like

The pasing of the log works for the node “Advanced MolConverter” of the chemaxon extension, but it will not work for other nodes since the log message is node related.

So I am not sure that it is a relvant to share what I did since it works only for a node of this extension.

Regards,

Joel

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