Skip to content

Commit

Permalink
fix DriverListAllocationPaymentManager._get_allocation (#257)
Browse files Browse the repository at this point in the history
* fix `DriverListAllocationPaymentManager._get_allocation`
* bump golem core to 0.7.5
* bump `goth` to the newest version
  • Loading branch information
shadeofblue authored Aug 19, 2024
1 parent 2b5e1c2 commit 58e1c29
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ jobs:
- name: Start Goth
env:
GOTH_VERSION: 0.16.0
GOTH_VERSION: 0.19.0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ github.actor }}
run: ./.github/workflows/start-goth.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/start-goth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel

echo INSTALLING DEPENDENCIES
python -m pip install --extra-index-url https://test.pypi.org/simple/ goth==$GOTH_VERSION
python -m pip install git+https://github.com/golemfactory/goth@$GOTH_VERSION
python -m pip install pytest pytest-asyncio pexpect "requests<2.32.0" # Remove requests after fixed https://github.com/docker/docker-py/issues/3256

echo CREATING ASSETS
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ray = {version = "~2.9.3", extras = ["default"]}
#golem-core = {path = "../golem-core-python", develop = true}
# golem-core = {git = "https://github.com/golemfactory/golem-core-python.git", branch = "main"}
# golem-core = {version = "^0.7.0", source = "test-pypi"}
golem-core = "^0.7.3"
golem-core = "^0.7.5"
aiohttp = "^3"
requests = "^2"
click = "^8"
Expand Down
8 changes: 4 additions & 4 deletions ray_on_golem/server/services/golem/golem.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ class NoMatchingPlatform(AllocationException):
# as until then there is no api call available to get driver lists and golem-core is api-only
class DriverListAllocationPaymentManager(DefaultPaymentManager):
@trace_span(show_arguments=True, show_results=True)
async def _create_allocation(self, budget: Decimal, network: str, driver: str) -> Allocation:
async def _create_allocation(self) -> Allocation:
output = json.loads(
await run_subprocess_output(YAGNA_PATH, "payment", "driver", "list", "--json")
)

try:
network_output = output[driver]["networks"][network]
network_output = output[self._driver]["networks"][self._network]
platform = network_output["tokens"][network_output["default_token"]]
except KeyError:
raise NoMatchingPlatform(network, driver)
raise NoMatchingPlatform(self._network, self._driver)

timestamp = datetime.now(timezone.utc)
timeout = timestamp + timedelta(days=365 * 10)

data = models.Allocation(
payment_platform=platform,
total_amount=str(budget),
total_amount=str(Decimal(self._budget)),
timestamp=timestamp,
timeout=timeout,
# This will probably be removed one day (consent-related thing)
Expand Down

0 comments on commit 58e1c29

Please sign in to comment.