Skip to content

Commit

Permalink
Merge pull request #30 from jpmorganchase/feature/fix-async-retry
Browse files Browse the repository at this point in the history
eliminate dependency on async-retrying
  • Loading branch information
dbernaciak authored Mar 12, 2024
2 parents fdec7f7 + 807b5cd commit fd3a829
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
18 changes: 13 additions & 5 deletions fusion/fusion_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from urllib.parse import quote, urljoin

import pandas as pd
from async_retrying import retry
from fsspec.callbacks import _DEFAULT_CALLBACK
from fsspec.implementations.http import HTTPFile, HTTPFileSystem, sync, sync_wrapper
from fsspec.utils import nullcontext
Expand Down Expand Up @@ -450,12 +449,21 @@ async def _finish_operation(session, operation_id, kw):
)

def put_data(session):
@retry(attempts=3)
async def _meth(session, url, kw):
meth = getattr(session, method)
async with meth(url=url, data=chunk, **kw) as resp:
await self._async_raise_not_found_for_status(resp, url)
return await resp.json()
retry_num = 3
ex_code = None
ex_cnt = 0
while ex_cnt < retry_num:
async with meth(url=url, data=chunk, **kw) as resp:
try:
await self._async_raise_not_found_for_status(resp, url)
return await resp.json()
except Exception as ex:
ex_cnt += 1
ex_code = ex

raise ex_code

context = nullcontext(lpath)

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ tqdm = ">=4.64.0"
pyarrow = ">=11.0"
fsspec = ">=2021.6.1"
aiohttp = ">=3.7.1"
async-retrying = "^0.2"

polars = { version = ">=0.12", optional = true }
markupsafe = { version = ">=2.0.1", optional = true }
Expand Down
1 change: 0 additions & 1 deletion pyproject_docs_build.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ tqdm = ">=4.64.0"
pyarrow = ">=11.0"
fsspec = ">=2021.6.1"
aiohttp = ">=3.7.1"
async-retrying = "^0.2"

polars = { version = ">=0.12", optional = true }
markupsafe = { version = ">=2.0.1", optional = true }
Expand Down

0 comments on commit fd3a829

Please sign in to comment.