|
@@ -139,7 +139,6 @@ async function findInterfaces() {
|
|
|
const workerProcess = new PythonWorker(workerScript)
|
|
|
const { data, error } = await workerProcess.spawn()
|
|
|
if (error) throw new Error(error)
|
|
|
- console.log('Spawned', data, error)
|
|
|
// d. Save the worker in the state.
|
|
|
state.interfaces.push({
|
|
|
id: md5(`${interfaceName}${workerScript}${mtime}`),
|
|
@@ -183,7 +182,6 @@ async function interface(parent, args, context, info) {
|
|
|
}
|
|
|
|
|
|
async function options(workerProcess) {
|
|
|
- console.log(workerProcess.send)
|
|
|
const { data, error } = await workerProcess.send({
|
|
|
type: 'options',
|
|
|
})
|
|
@@ -200,7 +198,6 @@ function workerProcess(parent, args, ctx, info) {
|
|
|
spawnfile,
|
|
|
pid,
|
|
|
} = parent.pythonShell
|
|
|
- console.log(killed)
|
|
|
return {
|
|
|
pid,
|
|
|
killed,
|
|
@@ -215,7 +212,6 @@ function workerProcess(parent, args, ctx, info) {
|
|
|
* PORTS SECTION
|
|
|
*/
|
|
|
async function findPorts() {
|
|
|
- console.log('find ports.')
|
|
|
// 1. Make sure, workers are updated.
|
|
|
await findInterfaces()
|
|
|
|
|
@@ -230,7 +226,6 @@ async function findPorts() {
|
|
|
type: 'ports',
|
|
|
})
|
|
|
if (error) throw new Error(error)
|
|
|
- console.log(data)
|
|
|
// b) Add all ports that are not in the list.
|
|
|
data.forEach(port => {
|
|
|
const id = port.name || port.device
|
|
@@ -246,8 +241,6 @@ async function findPorts() {
|
|
|
})
|
|
|
})
|
|
|
await Promise.all(portsPromises)
|
|
|
-
|
|
|
- console.log('found ports.')
|
|
|
}
|
|
|
|
|
|
async function ports(parent, args, ctx, info) {
|
|
@@ -288,7 +281,6 @@ async function connect(parent, args, ctx, info) {
|
|
|
throw new Error('already connected.')
|
|
|
}
|
|
|
const pythonWorker = new PythonWorker(iface.workerScript)
|
|
|
- console.log(pythonWorker)
|
|
|
const spawnData = await pythonWorker.spawn()
|
|
|
if (spawnData.error) throw new Error(spawnData.error)
|
|
|
const connection = {
|
|
@@ -303,7 +295,6 @@ async function connect(parent, args, ctx, info) {
|
|
|
if (connectionData.error) throw new Error(connectionData.error)
|
|
|
iface.connections.push(connection)
|
|
|
state.connections.push(connection)
|
|
|
- console.log({ ...connection, workerProcess: workerProcess(pythonWorker) })
|
|
|
return {
|
|
|
...connection,
|
|
|
workerProcess: workerProcess(pythonWorker),
|
|
@@ -344,7 +335,6 @@ async function sendCommand(parent, args, ctx, info) {
|
|
|
const connection = state.connections.find(
|
|
|
connection => connection.id === connectionId
|
|
|
)
|
|
|
- console.log({ ...command })
|
|
|
const { data, error } = await connection.workerProcess.send({ ...command })
|
|
|
if (error) throw new Error(JSON.stringify(error))
|
|
|
return data.response
|