def poll_asset_processing(ctx, asset_id, resource):
  @retries((180 * 60) / 10, delay=30, backoff=1)
  def poll(ctx, resource, asset_id):
    response = resource.get(id=asset_id).execute()
    if response['processingStatus'] in ['complete', 'failed']:
      return response
    elif response['processingStatus'] == 'ready':
      # Fix for GME's issue where it mistakenly reports 'ready for processing' upon completion.
      process(ctx, resource, asset_id)
      raise Exception("Asset processing status is '%s'. Initiated reprocessing." % (response["processingStatus"]))
    else:
      raise Exception("Asset processing status is '%s'" % (response["processingStatus"]))

  @retries(10)
  def process(ctx, resource, asset_id):
    return resource.process(id=asset_id).execute()

  start_time = time.time()
  response = poll(ctx, resource, asset_id)
  if response["processingStatus"] == "complete":
    ctx.log("Processing complete (%s mins)" % (round((time.time() - start_time) / 60, 2)))
    return response
  elif response["processingStatus"] == "failed":
    ctx.vlog("Processing failed (%s mins)" % (round((time.time() - start_time) / 60, 2)))
  raise Exception("Asset failed to process.")
Adding a filesystem file writer to a reactor will make sure it is
dataset/ETHPy150Open keithmoss/Hodor/hodor/gme.py/poll_asset_processing--crossover with--dataset/ETHPy150Open twisted/twisted/twisted/internet/test/test_stdio.py/StdioFilesTests.test_addWriter