automated workflow reset

I have noticed that my workspace folder with hundreds of workflows take up quite a lot of disk space. This can be reduced if the workflow is opened, all nodes selected an “reset” is clicked and then saved. As I have so many workflows I want to automate this task.
as asked here Link I would like to know if deleting the data.* files is a save way or is there a better way? Why is there no native node for resetting as there is for executing?

Why not just export your entire workspace to a knar file with “reset workflows before export” enabled, delete everything from your workspace & re-import again?

@Add94: thanks for the tip, I will check if this has acceptable performance. In a first try it took very long till the export window shows up.
I find it strange to do that for a folder structure with many workflows were some are not reset (which one is not known), as it is exporting quite a lot without the need to do so

This can be done programmatically and while I have seen several slightly different solutions to this problem, I have found that the below script does the trick on Windows.

Save the code below to a batch command file (.bat) and place it in the root of you KNIME workspace folder.

@ECHO OFF

ECHO This script will automatically reset all workflows
PAUSE
DEL /S /F "data.zip"
DEL /S /F "data.xml"
DEL /S /F ".savedWithData"
DEL /S /F "db_session.xml"
DEL /S /F "*.table"

ECHO.
ECHO The next step is to empty the recycle bin
PAUSE
PowerShell Clear-RecycleBin -force -ErrorAction:Ignore

ECHO.
PAUSE

Once saved in the correct folder, you can execute the file and it will reset every node in every workflow in your workspace and then empty your recycle bin.

Although I have used this many times, you should still make sure to have a backup of your workflows before using this the first time and then ensure that everything still works as intended.

4 Likes

that sounds nice. Thanks @kajensen

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