#726 [pyhaystack] issues with HisReadSeriesOperation and HisWriteSeriesOperation

Aisling Pigott Mon 5 Aug

Hi,

New to pyhaystack and trying to pull/push data from a SkySpark server. I've got a connection to the server and can request via session.about(), etc but no luck with HisReadSeriesOperation and HisWriteSeriesOperation.

HisReadSeriesOperation: I think it isn't returning anything and then having an issue with a null value but I don't understand why the it's unable to find the point if I use the same id as I can use to find the point in SkySpark > Tools

<class 'pyhaystack.client.ops.entity.FindEntityOperation'>
Traceback (most recent call last):
File "pyhay.py", line 60, in <module>
  print(type(op.result))
File "C:\Users\USAP677924\api\lib\site-packages\pyhaystack\util\state.py", line 97, in result
  self._result.reraise()
File "C:\Users\USAP677924\api\lib\site-packages\pyhaystack\util\asyncexc.py", line 28, in reraise
  reraise(*self._exc_info)
File "C:\Users\USAP677924\api\lib\site-packages\six.py", line 693, in reraise
  raise value
File "C:\Users\USAP677924\api\lib\site-packages\pyhaystack\client\ops\his.py", line 104, in _on_read
  grid = operation.result
File "C:\Users\USAP677924\api\lib\site-packages\pyhaystack\util\state.py", line 97, in result
  self._result.reraise()
File "C:\Users\USAP677924\api\lib\site-packages\pyhaystack\util\asyncexc.py", line 28, in reraise
  reraise(*self._exc_info)
File "C:\Users\USAP677924\api\lib\site-packages\six.py", line 693, in reraise
  raise value
File "C:\Users\USAP677924\api\lib\site-packages\pyhaystack\client\ops\grid.py", line 298, in _check_err
  grid.metadata.get('traceback', None))
pyhaystack.exception.HaystackError: sys::CastErr: java.lang.ClassCastException

HisWriteSeriesOperation: I can't find documentation on the format of the data series to be written to the point. I assume it's the same as the return format of the HisReadSeriesOperation but no such luck getting that to work.

Stuart Longland Tue 6 Aug

Are you able to post the code you're calling? At the moment it's a bit difficult to understand what's going on because we haven't got the context of what's causing that error. All I know is that you're initiating a hisRead operation (*hopefully* by either using the his_read method on the session object, you should NOT be trying to create HisReadSeriesOperation objects yourself).

FindEntityOperation basically does a read?filter=YOUR_FILTER_STRING on the API -- it has nothing to do with the his_read method -- judging from the stack trace, you're not performing a his_read, you're doing a find_entity. I think something is confused in your code, but I won't know unless you're willing to reveal a little more first.

As for the error you got back: all we know is the problem is server side. I'd argue that SkySpark should never be throwing a ClassCastException, but no doubt it's doing so with good reason. Either our query is wrong, or something is mis-configured.

For writing history: the series format can take a few different forms, depending on your application. The simplest being a dict object, where the keys are timestamps (Python datetime.datetime objects) and the values are the values to write at each timestamp. There's also support for using numpy Series objects, again with one column representing the timestamp and another with the value.

Christian Tremblay Mon 7 Oct

I would add :

please post any issues here -> https://github.com/ChristianTremblay/pyhaystack/issues

It will help keep track of everything

Login or Signup to reply.