DataSourceXID_SUCCESS already exists on Scripting Data Source validation
When creating a scripting data source, I am getting the following error when trying to validate my script. The solution currently is to restart mango.
Steps to reproduce:
- Create new scripting data source with empty script and no external points. Set to polling and save.
- Create a new data point called test with variable name test
- Add an external data point with variable name point and enable updates context.
- Write a simple script to copy over the last point value as an example such as:
var x = point.lastValue(0,false); test.set(x.value, x.time)
- Turn off polling
- Attempt to validate script and get the following:
com.serotonin.m2m2.rt.dataSource.PollingDataSource_DS_c535dc5a-9bfc-4598-a0cc-b646f839b0c6_SUCCESS already exists
I think it also happens after a script error when validating.
@cbyrne This is a bug we've identified and are working to solve. In my testing, this happens when a scripting data source has data points AND the data source itself or at least one of the data points is Disabled. When you create a new data source, the default setting is Disabled, which matches the steps you posted on reproducing this issue.
The workaround I've used is to make sure the data source and all data points in it are Enabled and then restarting Mango. One thing to note is that you will likely see an error when you attempt to Enable the data source and click Save. Refresh the data source page after this error and you should be able to confirm the Enabled setting was set properly. After a restart of Mango, you should be able to Validate your script without an issue.
I hope this helps!
@aaron-asbra Thanks for your help, I managed to get through things ok without it being too much of a hassle.
On another note, meta points with scripting points as their external points don't seem to get triggered by context updates.
I have my data coming in via a polling data file source. On import, this triggers some scripting points to transform the data. I then added a meta point to sum up some of the scripting points. A simple
return (x.value + y.value + z.value)
with 'x' set to update context. This generates history just fine but no new values are ever created. I attached a log and some debug prints to see if it was actually getting triggered and it seems not.
This isn't a huge issue as I've just used more scripting points instead of meta points, but I just wanted to report it.
terrypacker last edited by
@cbyrne I was just looking through the Script Data Source code and see that if you have the "Sets historical" checkbox checked it won't fire any events to trigger the meta points.
@terrypacker Thanks for the clarification Terry, is this intended behavior or a bug?
terrypacker last edited by
@cbyrne I think it is a side affect of why we implemented the 'Sets historical' feature. That is there to allow importing or generating large amounts of historical data which bypass the point-value event system. This prevents an overload of web socket messages and event detectors raising events.