Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions pydevices/HtsDevices/influxhistorian.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class INFLUXHISTORIAN(MDSplus.Device):
parts.append({'path': name + ":WHERE", 'type': 'text',
'options': ('no_write_shot',)})
parts.append({'path': name + ":SELECT", 'type': 'text',
'options': ('no_write_shot',)})
'options': ('no_write_shot',)}) # No longer used
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is bad and the reason why i would not release halve baked devices


def debugging(self):
import os
Expand Down Expand Up @@ -94,7 +94,7 @@ def store(self, start=0, end=0):

if start > 0:
# Convert to nanosecond UNIX timestamp
startTimeQuery = 'time > %d' % (start * 1000000,)
startTimeQuery = 'time >= %d' % (start * 1000000,)

if end > 0:
# Convert to nanosecond UNIX timestamp
Expand Down Expand Up @@ -122,19 +122,16 @@ def store(self, start=0, end=0):
if len(whereList) > 0:
where = 'WHERE %s' % (' AND '.join(whereList),)

query = 'SELECT %s AS value FROM "%s" %s' % (
node.SELECT.data(),
query = 'SELECT fVal,iVal,bVal FROM "%s" %s' % (
self.series.data(),
where
)

if self.debugging():
print(query)
self.dprint(query, 1)

result = client.query(query, params={'epoch': 'ms'})

if self.debugging():
print("Query returned")
self.dprint("Query returned", 1)

data = list(result.get_points())

Expand All @@ -143,7 +140,12 @@ def store(self, start=0, end=0):

i = 0
for row in data:
valueData[i] = float(row['value'])
if row['fVal'] != None:
valueData[i] = float(row['fVal'])
elif row['iVal'] != None:
valueData[i] = float(row['iVal'])
elif row['bVal'] != None:
valueData[i] = float(row['bVal'])
timeData[i] = row['time']
i += 1

Expand All @@ -152,8 +154,7 @@ def store(self, start=0, end=0):

node.makeTimestampedSegment(times, values)

if self.debugging():
print("MDSplus I/O complete")
self.dprint("MDSplus I/O complete", 1)

except MDSplus.TreeNODATA:
pass
Expand Down