Maker Edition: Compute Plugin?

I'm using WebDev to pipe my PyTorch detection data into tag locations but have been stuck for a few hours now.

I do not have the Compute module and I just found a post from another user who was encountering the same issue on a trial license.

I'm about to just scrap the idea of handling detection counts via scripts and setup a SQL db.

Ignition Log:

com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 8, in doPost File "/usr/local/bin/ignition/user-lib/pylib/json/__init__.py", line 338, in loads return _default_decoder.decode(s) File "/usr/local/bin/ignition/user-lib/pylib/json/decoder.py", line 365, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) TypeError: expected string or buffer, but got

at org.python.core.Py.TypeError(Py.java:234)

at org.python.modules.sre.PatternObject.extractPyString(PatternObject.java:415)

at org.python.modules.sre.PatternObject.match(PatternObject.java:77)

at org.python.modules.sre.PatternObject$match_exposer.__call__(Unknown Source)

at org.python.core.PyObject.__call__(PyObject.java:477)

at org.python.core.PyObject.__call__(PyObject.java:481)

at json.decoder$py.decode$9(/usr/local/bin/ignition/user-lib/pylib/json/decoder.py:369)

at json.decoder$py.call_function(/usr/local/bin/ignition/user-lib/pylib/json/decoder.py)

at org.python.core.PyTableCode.call(PyTableCode.java:173)

at org.python.core.PyBaseCode.call(PyBaseCode.java:306)

at org.python.core.PyBaseCode.call(PyBaseCode.java:141)

at org.python.core.PyFunction.__call__(PyFunction.java:426)

at org.python.core.PyMethod.__call__(PyMethod.java:141)

at json$py.loads$4(/usr/local/bin/ignition/user-lib/pylib/json/__init__.py:351)

at json$py.call_function(/usr/local/bin/ignition/user-lib/pylib/json/__init__.py)

at org.python.core.PyTableCode.call(PyTableCode.java:173)

at org.python.core.PyBaseCode.call(PyBaseCode.java:306)

at org.python.core.PyBaseCode.call(PyBaseCode.java:126)

at org.python.core.PyFunction.__call__(PyFunction.java:416)

at org.python.pycode._pyx45.doPost$1(:31)

at org.python.pycode._pyx45.call_function()

at org.python.core.PyTableCode.call(PyTableCode.java:173)

at org.python.core.PyBaseCode.call(PyBaseCode.java:306)

at org.python.core.PyFunction.function___call__(PyFunction.java:474)

at org.python.core.PyFunction.__call__(PyFunction.java:469)

at org.python.core.PyFunction.__call__(PyFunction.java:464)

at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:847)

at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:829)

at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$TrackingProjectScriptManager.runFunction(ProjectScriptLifecycle.java:868)

at com.inductiveautomation.webdev.gateway.handlers.PythonResourceHandler.doRequest(PythonResourceHandler.java:307)

at com.inductiveautomation.webdev.gateway.handlers.PythonResourceHandler.doPost(PythonResourceHandler.java:561)

at com.inductiveautomation.webdev.gateway.servlets.WebDevDispatch.doPost(WebDevDispatch.java:153)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:523)

at com.inductiveautomation.webdev.gateway.servlets.WebDevDispatch.service(WebDevDispatch.java:118)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)

at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:86)

at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1410)

at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)

at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)

at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:598)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1580)

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384)

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1553)

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)

at com.inductiveautomation.catapult.handlers.RemoteHostNameLookupHandler.handle(RemoteHostNameLookupHandler.java:121)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)

at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:301)

at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:51)

at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:141)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)

at org.eclipse.jetty.server.Server.handle(Server.java:563)

at org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)

at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)

at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501)

at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)

at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)

at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)

at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)

at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)

at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)

at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)

at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)

at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)

at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)

at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)

at java.base/java.lang.Thread.run(Unknown Source)

Caused by: org.python.core.PyException: TypeError: expected string or buffer, but got

... 77 common frames omitted

This doesn’t have anything to do with Compute plugin, that’s an Edge licensing restriction.

Share your code.

Thanks for the reply, Kevin.

doPost code //Enabled//No Require HTTPS//No Require Authentication

def doPost(request, session):
	import json
    	from com.inductiveautomation.ignition.common.script.builtin import SystemUtilities

    # Read the request data as a string
    	data = request['data']
    	payload = json.loads(data)

    	class_name = payload['class']
    	confidence = payload['confidence']

    # Retrieve the current counts
    	nc_count = system.tag.readBlocking(["[default]cellstack_NC_count"])[0].value
    	g_count = system.tag.readBlocking(["[default]cellstack_G_count"])[0].value
    	complete_count = system.tag.readBlocking(["[default]cellstack_Complete_count"])[0].value

    # Update the counts
    	if class_name == "cellstack_NC" and confidence > 0.85:
        	nc_count += 1
    	elif class_name == "cellstack_G" and confidence > 0.85:
        	g_count += 1
        if nc_count > 0:
            complete_count += 1

    # Write back the updated counts
    	system.tag.writeBlocking(["[default]cellstack_NC_count"], [nc_count])
    	system.tag.writeBlocking(["[default]cellstack_G_count"], [g_count])
    	system.tag.writeBlocking(["[default]cellstack_Complete_count"], [complete_count])

    	return {'json': {'status': 'success'}}

I moved on to just running sqlite on my Jetson Orin dev. board.

I'm currently working through the correct tag configuration to read from my sqlite named variables.

Print data before passing it to loads and see what you’re getting.

I've moved on to just utilizing a Query tag and sourcing a sqlite db I created on my Jetson board.

I'll post back after I get my pytorch script talking to ignition and try to find root cause of the WebDev script incongruency.

Thanks again for the help. Pretty cool that an Ignition dev is checking the board on the weekend. Thanks! 07

Sidebar: Can you direct me to widget development? I want to create a container that has my count and text description all within one parent element. I can probably do this within a widget, yes?