qds-sdk-py icon indicating copy to clipboard operation
qds-sdk-py copied to clipboard

QDS Py package always has hc.status of 'waiting'

Open eddyojb88 opened this issue 3 years ago • 1 comments

Following the example here: hc.status() invariably gives a status of 'waiting', even if the server has finished the result.

Please can you advise as to how we resolve this?

eddyojb88 avatar Nov 16 '20 21:11 eddyojb88

hc.status() returns a static value stored in the memory and doesn't make an API call. You'll need to refresh the object using HiveCommand.find(hc.id) or use hc.run() that will go into a loop until the command is finished.

Something like this:

while not Command.is_done(hc.status):
  time.sleep(Qubole.poll_interval)
  hc = HiveCommand.find(hc.id)

Checkout this block of code: https://github.com/qubole/qds-sdk-py/blob/unreleased/qds_sdk/commands.py#L153

chattarajoy avatar Nov 17 '20 05:11 chattarajoy