Tag all local workflows with all used nodes

Hi,
is there a way to tag all local worflows (saved in folders and subfolders) with all nodes used? When I search my (cluttered) workspace I like to get all (potentially) relevant workflows filtered.
Thanks

Hi @Daniel_Weikert , this is an interesting one.

I’m not sure there’s a direct way to get this, at least none that I know of. However, you could implement something that does this.

First, I would scan the workspace folder for all workflow.knime files - each workflow has a workflow.knime file (List Files/Folders of workspace including subfolders, filtering on workflow.knime).

That should at the same time give you the list of your workflows.

I would then parse the workflow.knime file. It’s an xml file, and you can look into the <config key="nodes"> where all the individual nodes configurations are stored.

Inside this, for example, you can see something like this:

<config key="node_1">
            <entry key="id" type="xint" value="1"/>
            <entry key="node_settings_file" type="xstring" value="Compress Files_Folder (#1)/settings.xml"/>

You can check the the value of the node_settings_file , which in this case is Compress Files_Folder (#1)/settings.xml, which tells you that the node being used is Compress Files_Folder

4 Likes

Hi @Daniel_Weikert , building on what @bruno29a has said, there may be something useful that you can pull out of the following

Which was a workflow that reads a workflow.

4 Likes

Nice one @takbb , I didn’t know you had done something like this.

@Daniel_Weikert @takbb I actually put something together last night, though it does not check for the sequence, so it’s much simpler. However, there were some particularities which I needed to explain, and since it was already past 1am, I was too tired (or lazy? :rofl:) to explain, so I did not post it.

One of the challenge (challenge is probably a bit strong. It’s more like “not straight forward”) that I found was dealing with nodes within metanodes (and probably components) too. There are also cases of empty metanodes (for example, I created such a thing when I created a dummy node).

First of all, for some reason, I could not filter for the file “workflow.knime” directly off the List Files/Folders node - I mean I added the filter, but it would not filter :unamused:

So I manually filter after listing the files and folders, and then parse the XML.

Now, since I’m not filtering while doing the list of the files and folders, I figured then that I could also rely on the folders within each workflow, since a node is stored as a folder, and in fact, each of these node folders actually contains a settings.xml file. Therefore, I can simply filter on the settings.xml files. I wanted to try this in order to validate what I did using the workflow.knime file.

I found a few discrepancies, which eventually I was able to reconciliate after comparing the 2 results.

The discrepancies that I found were caused by:

  1. When relying on the folders, there seem to be cases where the folder of a deleted node would still be there, therefore it would be picked up as a node being used, while in fact it’s not. So, that would not be accurate if you relied on the folders. The workflow.knime of the workflow would be accurate on the other hand, because it correctly does not include this node.
  2. With empty metanodes, the same issue as specified in #1 above applies, as in a folder will be created, which will be picked up if you relied on the folders. However, the workflow.knime will also pick it up, however, because there’s no nodes inside the empty metanode, there won’t be anything for “node_settings_file” and will return an empty value. Here, though, you can at least filter out these empty values as opposed to when relying on folders, there’s no indication that these are empty metanodes.

Here’s what my workflow looks like:

Based on the observations I made, I would rely on the workflow.knime files instead, but I’m keeping the other option in the workflow as a means to compare and validate.

What I like about it is that you control what workflow(s) you want to process via the List Files/Folders.

You can choose your workspace root folder with subfolders option to do all of your workflows, or you can go to specific workflow folder to do that workflow, etc.

Here’s the workflow: Get workflow node list.knwf (31.5 KB)

Note: As a personal project, it’s definitely not my final version. I intend to at least do some manipulation such as removing “settings.xml”, and also add one more column to get the Node name itself. But @Daniel_Weikert you can still use this as a base for now, and you can of course do any additional manipulations that you need

EDIT: Added to the hub so you can see the updated version when it’s updated:

7 Likes

Thanks guys,
@bruno29a , @takbb I knew you guys come up with some smart input on that. I will have a closer look.
br

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