Expanding on my previous topic on Monetizing data apps here I will be exploring a way to do something similar, but for processes that (can) take a long time to complete, for example ETL workflows or data apps that request user input.
In my previous topic I 'charged' a fixed number of credits no matter what the duration of the process. But because KNIMEs own pricing model for team plan charges more credits the longer a process runs, I need something more.
Below you can see an example workflow. It is based on my Climate Change examples. The workflow lets the user select a country and weather station and shows the maximum temperatures for that station.
The bottom part of the workflow below (in the Credits handling box) is the monetizing part. What it does is:
Check if the executing user has a row in the user_credits table and has enough credits available, if not the workflow will be terminated
Every certain time (in the example, 2 minutes) it will subtract a number of credits (in the example, 5) from the users's balance and update the user_credits table. Also it will write a new row to the knime_job_log table with the executing users name, the name of the workflow, the remaining number of credits and a timestamp.
It is a bit complicated but it seems to do the job. I still want to do some further testing and debugging and maybe i'll try to wrap the entire monetizing part into a component....
The user_credits table for now would have to be 'manually' maintained : add a row for each new user and update the number of credits in case the user obtains more.
The knime_job_log table can be used to show each user when and where they spent their credits.
Below you can see screenshots of the user_credits and knime_job_log table after executing the workflow for some time.
Below is what will happen if the executing user does not have enough credits to execute the workflow: