Ejemplo n.º 1
0
def download(*args, **kwargs):
    result = download_to_file.AsyncResult(args[0]['uuid'])
    state = result.state
    if state == states.PENDING:
        raise QueryExpired()
    elif state in states.EXCEPTION_STATES:
        result.maybe_reraise()

    info = result.wait()  # TODO: Start returning data even if we're not done

    return export_csvxls.file_reader(open(info['file_path'], 'rb'))
Ejemplo n.º 2
0
def download(*args, **kwargs):
  notebook = args[0]
  result = download_to_file.AsyncResult(args[0]['uuid'])
  state = result.state

  if state == states.PENDING:
    raise QueryExpired()
  elif state in states.EXCEPTION_STATES:
    result.maybe_reraise()

  info = result.wait() # TODO: Start returning data even if we're not done

  return export_csvxls.file_reader(storage.open(_result_key(notebook), 'rb'))  # TODO: Convert csv to excel if needed