ukaea / UDA

Universal Data Access library to provide data over the network in a unified data object.
https://ukaea.github.io/UDA/
Apache License 2.0
11 stars 4 forks source link

uda_cli crashes when there is space between arguments #50

Closed hanak closed 2 weeks ago

hanak commented 2 weeks ago

I use the argument "--request" of uda_cli. When the argument is:

IMAS::get(uri='imas:hdf5?dd_version=3.39.0&path=/root/public/imasdb/test/3/1000/1000', mode='open', dataObject='summary', access='read', range='global', time=-999, interp='undefined', path='summary/ids_properties/homogeneous_time', datatype='integer', rank=0, is_homogeneous=0, dynamic_flags=0)

I get:

terminate called after throwing an instance of 'boost::wrapexcept<boost::bad_any_cast>'
  what():  boost::bad_any_cast: failed conversion using boost::any_cast
Aborted (core dumped)

However, then the argument is:

IMAS::get(uri='imas:hdf5?dd_version=3.39.0&path=/root/public/imasdb/test/3/1000/1000',mode='open',dataObject='summary',access='read',range='global',t
ime=-999,interp='undefined',path='summary/ids_properties/homogeneous_time',datatype='integer',rank=0,is_homogeneous=0,dynamic_flags=0)

I get a response from the UDA server.

The reason I am creating this report is the fact that the Access.log prints the requests with commas. So, testing a request using uda_cli takes more than just copy&paste. Would it be possible to strip any white space outside the pairs <name>=<value> in the --request prior processing?

UDA 2.7.6

jholloc commented 2 weeks ago

Please use quotes around requests. Without quotes they won't be processed correctly.

Also note you don't need to use '--request'. The following are equivalent:

uda_cli ... --request "help::(foo=1, bar=2)" uda_cli ... "help::(foo=1, bar=2)"

For your example the use should be:

uda_cli -h <host> -p <port> "IMAS::get(uri='imas:hdf5?dd_version=3.39.0&path=/root/public/imasdb/test/3/1000/1000', mode='open', dataObject='summary', access='read', range='global', time=-999, interp='undefined', path='summary/ids_properties/homogeneous_time', datatype='integer', rank=0, is_homogeneous=0, dynamic_flags=0)"

I am closing this for now. If you still see an error when using quotes please reopen with details including the full cli command line input.

hanak commented 2 weeks ago

You are right. There was a typo outside uda_cli which I was not able to identify. As a consequence, quotes were gone somewhere along the route towards uda_cli. My bad. I am sorry for inconvenience.