hydra-python-agent icon indicating copy to clipboard operation
hydra-python-agent copied to clipboard

Improve printing format

Open shravandoda opened this issue 5 years ago • 4 comments

The current printing format in client uses show_data method in querying_mechanism module. It prints the data fetched from redis in an inline manner. Instead of the current printing format we can use the inbuilt printing method in the redis-py module which prints the data in a tabular form.

+-------------+----------+--------------+-----------+
|  b'p.name'  | b'p.age' | b'v.purpose' | b'c.name' |
+-------------+----------+--------------+-----------+`
| b'John Doe' |    33    | b'pleasure'  |  b'Japan' |
+-------------+----------+--------------+-----------+

shravandoda avatar Mar 06 '19 20:03 shravandoda

>>>show endpoints
classEndpoints + CollectionEndpoints
Class Endpoints
+-----------------+-------------+------------------------------+---------------------------+
| b'p.properties' |  b'p.type'  |           b'p.id'            |      b'p.operations'      |
+-----------------+-------------+------------------------------+---------------------------+
| b"['Location']" | b'Location' | b'vocab:EntryPoint/Location' | b"['POST', 'PUT', 'GET']" |
+-----------------+-------------+------------------------------+---------------------------+

b'Query internal execution time: 0.231691 milliseconds'
Collection Endpoints
+----------------------------+---------------------------------------------+-------------------+
|         b'p.type'          |                   b'p.id'                   |  b'p.operations'  |
+----------------------------+---------------------------------------------+-------------------+
|     b'DroneCollection'     |     b'vocab:EntryPoint/DroneCollection'     | b"['GET', 'PUT']" |
|  b'DatastreamCollection'   |   b'vocab:EntryPoint/DatastreamCollection'  | b"['GET', 'PUT']" |
|    b'CommandCollection'    |    b'vocab:EntryPoint/CommandCollection'    | b"['GET', 'PUT']" |
|    b'AnomalyCollection'    |    b'vocab:EntryPoint/AnomalyCollection'    | b"['GET', 'PUT']" |
|  b'HttpApiLogCollection'   |   b'vocab:EntryPoint/HttpApiLogCollection'  | b"['GET', 'PUT']" |
|    b'MessageCollection'    |    b'vocab:EntryPoint/MessageCollection'    | b"['GET', 'PUT']" |
|   b'DroneLogCollection'    |    b'vocab:EntryPoint/DroneLogCollection'   | b"['GET', 'PUT']" |
| b'ControllerLogCollection' | b'vocab:EntryPoint/ControllerLogCollection' | b"['GET', 'PUT']" |
+----------------------------+---------------------------------------------+-------------------+

b'Query internal execution time: 0.221227 milliseconds'

Sample ^ The above data has been generated with the help of redisgraph only. We won't need show_data method for it. I guess this issue could be taken under coupling hydra-python-agent to redis

shravandoda avatar Mar 22 '19 11:03 shravandoda

looks fine.

I will open a issue about making the agent leveraging Redis all-over the codebase.

Mec-iS avatar Mar 22 '19 11:03 Mec-iS

See references to older issues in https://github.com/HTTP-APIs/hydra-python-agent/issues/99 As specified in those issues, the only data represented in memory in the structure of the API taken from the ApiDoc, the rest is all in the datastore.

Mec-iS avatar Mar 22 '19 11:03 Mec-iS

show endpoints classEndpoints + CollectionEndpoints Class Endpoints +-----------------+-------------+------------------------------+---------------------------+ | b'p.properties' | b'p.type' | b'p.id' | b'p.operations' | +-----------------+-------------+------------------------------+---------------------------+ | b"['Location']" | b'Location' | b'vocab:EntryPoint/Location' | b"['POST', 'PUT', 'GET']" | +-----------------+-------------+------------------------------+---------------------------+

b'Query internal execution time: 0.231691 milliseconds' Collection Endpoints +----------------------------+---------------------------------------------+-------------------+ | b'p.type' | b'p.id' | b'p.operations' | +----------------------------+---------------------------------------------+-------------------+ | b'DroneCollection' | b'vocab:EntryPoint/DroneCollection' | b"['GET', 'PUT']" | | b'DatastreamCollection' | b'vocab:EntryPoint/DatastreamCollection' | b"['GET', 'PUT']" | | b'CommandCollection' | b'vocab:EntryPoint/CommandCollection' | b"['GET', 'PUT']" | | b'AnomalyCollection' | b'vocab:EntryPoint/AnomalyCollection' | b"['GET', 'PUT']" | | b'HttpApiLogCollection' | b'vocab:EntryPoint/HttpApiLogCollection' | b"['GET', 'PUT']" | | b'MessageCollection' | b'vocab:EntryPoint/MessageCollection' | b"['GET', 'PUT']" | | b'DroneLogCollection' | b'vocab:EntryPoint/DroneLogCollection' | b"['GET', 'PUT']" | | b'ControllerLogCollection' | b'vocab:EntryPoint/ControllerLogCollection' | b"['GET', 'PUT']" | +----------------------------+---------------------------------------------+-------------------+

b'Query internal execution time: 0.221227 milliseconds' Sample ^ The above data has been generated with the help of redisgraph only. We won't need show_data method for it. I guess this issue could be taken under coupling hydra-python-agent to redis

We have to use this data in demo/UI. This format may be difficult to handle it there otherwise it look fine. But I think redisgraph has updated the query output, so we also need to update or improve the printing method.

sandeepsajan0 avatar Mar 06 '20 11:03 sandeepsajan0