Hello,
Starting a general discussion about TouchDesigner and PM2 (https://pm2.keymetrics.io/). For process managing in installations, it seems like a very viable, robust tool. I’ve been working through some initial tests, and wanted to report some findings (all Windows, no Mac testing).
My first stumbling block was figuring out how to get Touchdesigner to be “visible” on launch. Running this:
pm2 start "C:\Program Files\Derivative\TouchDesigner\bin\TouchDesigner.exe" -- "C:\00-running-td-with-pm2\test.toe"
will launch TD, but it will be “invisible”. Try it and see what I mean (it’s in Task Manager, under background processes). After much wrangling, I found this parameter, which can be used in the ecosystem.config.js approach, or using the javascript API approach:
windowsHide: false
This works, launching TD normally. Okay that’s awesome.
Wouldn’t it be great if we could use regular old print()
to generate logs! Well, this is where I’m currently stuck. So- if you manage a simple python app with PM2:
import time
while 1:
print("Start: %s" % time.ctime())
time.sleep(1)
You’ll get the print stdout in pm2 monit
- and then you can easily route that to a file using output: "PYtest.log"
(and use all the other tools provided by PM2, like auto-rotating logs, etc. It’s great, reduces complexity of the application, logs are streamed / stored wherever you want.
But with TD, stdout is tricky. You can use approaches that route stdout to a DAT, which is then saved, and you can access them via PM2 (using pm2 logs TDtest
), but I can’t figure out an elegant way to get them using pm2 monit
. See https://derivative.ca/UserGuide/Execute_DAT or search the forum for “stdout” or “logs” for other approaches.
Anyways, just wanted to start a conversation. If anyone wants to see some sample code or other notes, just keep this thread moving