Skip to content

Commit

Permalink
Merge pull request #61 from valory-xyz/fix/funding-job-error-handling
Browse files Browse the repository at this point in the history
Add error handling on the funding job
  • Loading branch information
angrybayblade authored Apr 18, 2024
2 parents 9579bbc + 6c97278 commit 960d8aa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
22 changes: 14 additions & 8 deletions operate/services/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import asyncio
import logging
import traceback
import typing as t
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
Expand Down Expand Up @@ -417,14 +418,19 @@ async def funding_job(
service = self.create_or_load(hash=hash)
with ThreadPoolExecutor() as executor:
while True:
await loop.run_in_executor(
executor,
self.fund_service,
hash,
PUBLIC_RPCS[service.ledger_config.chain],
10000000000000000,
50000000000000000,
)
try:
await loop.run_in_executor(
executor,
self.fund_service,
hash,
PUBLIC_RPCS[service.ledger_config.chain],
10000000000000000,
50000000000000000,
)
except Exception: # pylint: disable=broad-except
logging.info(
f"Error occured while funding the service\n{traceback.format_exc()}"
)
await asyncio.sleep(60)

def deploy_service_locally(self, hash: str, force: bool = True) -> Deployment:
Expand Down
6 changes: 6 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ commands =
tomte freeze-dependencies --output-path {envtmpdir}/requirements.txt
liccheck -s tox.ini -r {envtmpdir}/requirements.txt -l PARANOID

[darglint]
docstring_style=sphinx
strictness=short
ignore_regex=async_act
ignore=DAR401

[flake8]
paths=autonomy,packages,scripts,tests
exclude=.md,
Expand Down

0 comments on commit 960d8aa

Please sign in to comment.