for some reason need to change to sync mode to suceefully write

This commit is contained in:
carina@hades 2024-10-18 13:22:41 -04:00
parent 57eca380b3
commit a187e31d1c

View File

@ -22,9 +22,12 @@ except:
org = "FSUFoxLab" org = "FSUFoxLab"
ip = "https://fsunuc.physics.fsu.edu/influx/" ip = "https://fsunuc.physics.fsu.edu/influx/"
write_client = influxdb_client.InfluxDBClient(url=ip, token=token, org=org) # databaseIP="128.186.111.107"
databaseIP=ip
write_client = influxdb_client.InfluxDBClient(url=databaseIP, token=token, org=org)
bucket = "ISEG" bucket = "ISEG"
write_api = write_client.write_api(write_options=ASYNCHRONOUS) # write_api = write_client.write_api(write_options=ASYNCHRONOUS)
write_api = write_client.write_api(write_options=SYNCHRONOUS)
#assign a port, to prevent the script run mulitple time #assign a port, to prevent the script run mulitple time
s = socket.socket() s = socket.socket()
@ -42,7 +45,6 @@ else :
#Sergio MPOD 128.186.111.101 #Sergio MPOD 128.186.111.101
#ANASEN MPOD 128.186.111.208 #ANASEN MPOD 128.186.111.208
databaseIP="128.186.111.108"
pushToDB = False pushToDB = False
#===================== GUI #===================== GUI
@ -108,7 +110,7 @@ class MyWindow(QMainWindow):
gLayout.addWidget(lbIP, 0, 0) gLayout.addWidget(lbIP, 0, 0)
self.txtIP = QLineEdit(self) self.txtIP = QLineEdit(self)
self.txtIP.setText("128.186.111.107") self.txtIP.setText(databaseIP)
self.txtIP.textChanged.connect(partial(self.TextChange, self.txtIP)) self.txtIP.textChanged.connect(partial(self.TextChange, self.txtIP))
self.txtIP.returnPressed.connect(partial(self.UnSetTextColor, self.txtIP)) self.txtIP.returnPressed.connect(partial(self.UnSetTextColor, self.txtIP))
gLayout.addWidget(self.txtIP, 0, 1) gLayout.addWidget(self.txtIP, 0, 1)
@ -363,6 +365,7 @@ class MyWindow(QMainWindow):
points.append(Point("LeakageCurrent").tag("Ch",int(chList[i] + 100 * k)).field("value",float(outIList[sum(nChPerMod[:k]) + i]))) points.append(Point("LeakageCurrent").tag("Ch",int(chList[i] + 100 * k)).field("value",float(outIList[sum(nChPerMod[:k]) + i])))
if self.chkDB.checkState() == Qt.CheckState.Checked: if self.chkDB.checkState() == Qt.CheckState.Checked:
write_api.write(bucket=bucket, org=org, record=points) write_api.write(bucket=bucket, org=org, record=points)
if __name__ == "__main__": if __name__ == "__main__":