Skip to content
Merged
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
13 changes: 12 additions & 1 deletion bittensor/core/subtensor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
from functools import lru_cache
from typing import TYPE_CHECKING, Any, Iterable, Optional, Union

Expand All @@ -8,7 +9,12 @@
from bittensor.core.async_subtensor import AsyncSubtensor
from bittensor.core.metagraph import Metagraph
from bittensor.core.settings import version_as_int
from bittensor.utils import execute_coroutine, torch, get_event_loop
from bittensor.utils import (
execute_coroutine,
torch,
get_event_loop,
event_loop_is_running,
)

if TYPE_CHECKING:
from bittensor_wallet import Wallet
Expand Down Expand Up @@ -52,6 +58,11 @@ def __init__(
_mock: bool = False,
log_verbose: bool = False,
):
if event_loop_is_running():
warnings.warn(
"You are calling this from an already running event loop. Some features may not work correctly. You "
"should instead use `AsyncSubtensor`."
)
self.event_loop = get_event_loop()
self.network = network
self._config = config
Expand Down
Loading