Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix DriverListAllocationPaymentManager._get_allocation #257

Merged
merged 6 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading