Skip to content

Commit

Permalink
Fix: Implement better typing
Browse files Browse the repository at this point in the history
  • Loading branch information
nesitor committed Jun 20, 2024
1 parent a7816d4 commit 8146cdc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/aleph_vrf/coordinator/executor_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,10 @@ class UsePredeterminedExecutors(ExecutorSelectionPolicy):
Use a hardcoded list of executors.
"""

def __init__(self, executors: List[Union[Executor, AlephExecutor]]):
def __init__(self, executors: List[VRFExecutor]):
self.executors = executors

async def select_executors(
self, nb_executors: int
) -> List[Union[Executor, AlephExecutor]]:
async def select_executors(self, nb_executors: int) -> List[VRFExecutor]:
"""
Returns nb_executors from the hardcoded list of executors.
If nb_executors is lower than the total number of executors, this method
Expand Down
7 changes: 5 additions & 2 deletions src/aleph_vrf/coordinator/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from typing import Optional, Union
from typing import List, Optional, Union

from pydantic import BaseModel

Expand All @@ -23,6 +23,7 @@
APIResponse,
ComputeResourceNode,
PublishedVRFResponse,
VRFExecutor,
)

logger.debug("imports done")
Expand Down Expand Up @@ -87,7 +88,9 @@ async def receive_test_vrf(
"https://CRN_URL" # CRN main URL, like https://hetzner.staging.aleph.sh
)
executor_node = ComputeResourceNode(address=executor_url, hash="", score=0)
executors = [AlephExecutor(node=executor_node, vm_function=settings.FUNCTION)]
executors: List[VRFExecutor] = [
AlephExecutor(node=executor_node, vm_function=settings.FUNCTION)
]
executor_policy = UsePredeterminedExecutors(executors)
response = await generate_vrf(
account=account,
Expand Down

0 comments on commit 8146cdc

Please sign in to comment.