Skip to content

Commit 8749d88

Browse files
Merge pull request #298 from macrocosm-os/fix/miner-inactive
remove inactive uid filtering
2 parents 79652a1 + 74626ee commit 8749d88

File tree

5 files changed

+16
-30
lines changed

5 files changed

+16
-30
lines changed

folding/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from .protocol import JobSubmissionSynapse
22
from .validators.protein import Protein
33

4-
__version__ = "1.3.3"
4+
__version__ = "1.3.4"
55
version_split = __version__.split(".")
66
__spec_version__ = (
77
(10000 * int(version_split[0]))

folding/base/neuron.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1515
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1616
# DEALINGS IN THE SOFTWARE.
17-
17+
import os
1818
import copy
1919
import bittensor as bt
2020
from abc import ABC, abstractmethod
21-
import os
2221

2322
import openmm
2423
from tenacity import RetryError

folding/validators/forward.py

+2-16
Original file line numberDiff line numberDiff line change
@@ -93,30 +93,16 @@ async def run_step(
9393

9494
response_info = get_response_info(responses=responses)
9595

96-
# There are hotkeys that have decided to stop serving. We need to remove them from the store.
97-
responses_serving = []
98-
active_uids = []
99-
for ii, state in enumerate(response_info["response_miners_serving"]):
100-
if state:
101-
responses_serving.append(responses[ii])
102-
active_uids.append(uids[ii])
103-
10496
event = {
10597
"block": self.block,
10698
"step_length": time.time() - start_time,
107-
"uids": active_uids,
99+
"uids": uids,
108100
"energies": [],
109101
**response_info,
110102
}
111103

112-
if len(responses_serving) == 0:
113-
logger.warning(
114-
f"❗ No miners serving pdb_id {synapse.pdb_id}... Making job inactive. ❗"
115-
)
116-
return event
117-
118104
energies, energy_event = get_energies(
119-
protein=protein, responses=responses_serving, uids=active_uids
105+
protein=protein, responses=responses, uids=uids
120106
)
121107

122108
# Log the step event.

neurons/validator.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -157,26 +157,27 @@ async def ping_all_miners(
157157
async def sample_random_uids(
158158
self,
159159
num_uids_to_sample: int,
160-
exclude_uids: List[int],
160+
exclude_uids: List[int] = None,
161161
) -> List[int]:
162162
"""Helper function to sample a batch of uids on the network, determine their serving status,
163163
and sample more until a desired number of uids is found.
164164
165165
Args:
166166
num_uids_to_sample (int): The number of uids to sample.
167-
exclude_uids (List[int]): A list of uids that should be excluded from sampling.
167+
exclude_uids (List[int], optional): List of uids to exclude from the sampling. Defaults to None.
168168
169169
Returns:
170-
List[int]: A list of responding and free uids.
170+
List[int]: A list of random uids.
171171
"""
172-
exclude_uids = []
173-
active_uids = await self.ping_all_miners(exclude_uids=exclude_uids)
174172

175-
if len(active_uids) > num_uids_to_sample:
176-
return random.sample(active_uids, num_uids_to_sample)
173+
if exclude_uids is not None:
174+
all_miner_uids = list(
175+
set(self.all_miner_uids).difference(set(exclude_uids))
176+
)
177+
else:
178+
all_miner_uids = self.all_miner_uids
177179

178-
elif len(active_uids) <= num_uids_to_sample:
179-
return active_uids
180+
return random.sample(all_miner_uids, num_uids_to_sample)
180181

181182
async def get_valid_uids(self) -> List[int]:
182183
"""get valid uids to work on a job by sampling random uids and excluding active jobs.
@@ -191,7 +192,7 @@ async def get_valid_uids(self) -> List[int]:
191192

192193
valid_uids = await self.sample_random_uids(
193194
num_uids_to_sample=self.config.neuron.sample_size,
194-
exclude_uids=exclude_uids,
195+
exclude_uids = exclude_uids
195196
)
196197

197198
return valid_uids

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "folding"
3-
version = "1.3.3"
3+
version = "1.3.4"
44
description = "Macrocosmos Subnet 25: Folding"
55
authors = ["Brian McCrindle <[email protected]>", "Sergio Champoux <[email protected]>", "Szymon Fonau <[email protected]>"]
66

0 commit comments

Comments
 (0)