Hi I have an issue that appeared on 2.8.7 where ai...
# prefect-community
l
Hi I have an issue that appeared on 2.8.7 where aiohttp is now complaining that
Timeout context manager should be used inside a task
works fine in 2.8.6 and below. I'm however not quite sure how to reproduce it outside of my code base.
Here's the stack trace for anyone who might have an idea! 🙂
Copy code
10:35:59.377 | INFO    | prefect.engine - Created flow run 'tidy-cormorant' for flow 'import-activation-metrics'
10:36:00.694 | INFO    | Flow run 'tidy-cormorant' - Will import activation metric data in Airtable.
10:36:00.976 | INFO    | Flow run 'tidy-cormorant' - Created task run 'activation_get_lastest_date-0' for task 'activation_get_lastest_date'
10:36:00.980 | INFO    | Flow run 'tidy-cormorant' - Executing 'activation_get_lastest_date-0' immediately...
10:36:01.594 | INFO    | Task run 'activation_get_lastest_date-0' - Will get latest activation metrics import date from Airtable.
10:36:01.599 | ERROR   | Task run 'activation_get_lastest_date-0' - Encountered exception during execution:
Traceback (most recent call last):
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/prefect/engine.py", line 1545, in orchestrate_task_run
    result = await call.aresult()
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 181, in aresult
    return await asyncio.wrap_future(self.future)
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 218, in _run_async
    result = await coro
  File "/home/luis/Code/upskyld/upskyld-data/upskyld/analytics/airtable/activation.py", line 18, in get_latest_date
    records = await activation_table.list_records(
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aioairtable/aioairtable.py", line 305, in list_records
    record_list: RecordList = await self._request("GET", url)
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aioairtable/aioairtable.py", line 265, in _request
    return await self._base.request(method, url, json=json)
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aioairtable/aioairtable.py", line 233, in request
    return await self._airtable.request(self._id, method, url, json=json)
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aioairtable/aioairtable.py", line 192, in request
    return await self._request(method, url, json=json)
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aioairtable/aioairtable.py", line 177, in _request
    async with self._client.request(
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 1141, in __aenter__
    self._resp = await self._coro
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 467, in _request
    with timer:
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aiohttp/helpers.py", line 701, in __enter__
    raise RuntimeError(
RuntimeError: Timeout context manager should be used inside a task
10:36:01.795 | ERROR   | Task run 'activation_get_lastest_date-0' - Finished in state Failed('Task run encountered an exception: RuntimeError: Timeout context manager should be used inside a task\n')
10:36:01.798 | ERROR   | Flow run 'tidy-cormorant' - Encountered exception during execution:
Traceback (most recent call last):
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/prefect/engine.py", line 673, in orchestrate_flow_run
    result = await flow_call.aresult()
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 181, in aresult
    return await asyncio.wrap_future(self.future)
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 218, in _run_async
    result = await coro
  File "/home/luis/Code/upskyld/upskyld-data/upskyld/analytics/activation.py", line 16, in import_activation_metrics
    latest_date = await get_latest_date()
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/prefect/_internal/concurrency/api.py", line 109, in wait_for_call_in_loop_thread
    return call.result()
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 173, in result
    return self.future.result(timeout=timeout)
  File "/home/luis/.pyenv/versions/3.10.8/lib/python3.10/concurrent/futures/_base.py", line 451, in result
    return self.__get_result()
  File "/home/luis/.pyenv/versions/3.10.8/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 218, in _run_async
    result = await coro
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/prefect/engine.py", line 1131, in get_task_call_return_value
    return await future._result()
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/prefect/futures.py", line 240, in _result
    return await final_state.result(raise_on_failure=raise_on_failure, fetch=True)
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/prefect/states.py", line 91, in _get_state_result
    raise await get_state_exception(state)
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/prefect/engine.py", line 1545, in orchestrate_task_run
    result = await call.aresult()
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 181, in aresult
    return await asyncio.wrap_future(self.future)
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/prefect/_internal/concurrency/calls.py", line 218, in _run_async
    result = await coro
  File "/home/luis/Code/upskyld/upskyld-data/upskyld/analytics/airtable/activation.py", line 18, in get_latest_date
    records = await activation_table.list_records(
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aioairtable/aioairtable.py", line 305, in list_records
    record_list: RecordList = await self._request("GET", url)
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aioairtable/aioairtable.py", line 265, in _request
    return await self._base.request(method, url, json=json)
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aioairtable/aioairtable.py", line 233, in request
    return await self._airtable.request(self._id, method, url, json=json)
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aioairtable/aioairtable.py", line 192, in request
    return await self._request(method, url, json=json)
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aioairtable/aioairtable.py", line 177, in _request
    async with self._client.request(
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 1141, in __aenter__
    self._resp = await self._coro
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aiohttp/client.py", line 467, in _request
    with timer:
  File "/home/luis/Code/upskyld/upskyld-data/.venv/lib/python3.10/site-packages/aiohttp/helpers.py", line 701, in __enter__
    raise RuntimeError(
RuntimeError: Timeout context manager should be used inside a task