9
9
10
10
# import base miner class which takes care of most of the boilerplate
11
11
from folding .base .miner import BaseMinerNeuron
12
- from folding .protocol import FoldingSynapse
12
+ from folding .protocol import JobSubmissionSynapse
13
13
from folding .utils .logging import log_event
14
14
from folding .utils .ops import (
15
15
run_cmd_commands ,
23
23
BASE_DATA_PATH = os .path .join (ROOT_DIR , "miner-data" )
24
24
25
25
26
- def attach_files (files_to_attach : List , synapse : FoldingSynapse ) -> FoldingSynapse :
26
+ def attach_files (
27
+ files_to_attach : List , synapse : JobSubmissionSynapse
28
+ ) -> JobSubmissionSynapse :
27
29
"""function that parses a list of files and attaches them to the synapse object"""
28
30
bt .logging .info (f"Sending files to validator: { files_to_attach } " )
29
31
for filename in files_to_attach :
@@ -45,14 +47,14 @@ def attach_files(files_to_attach: List, synapse: FoldingSynapse) -> FoldingSynap
45
47
46
48
47
49
def attach_files_to_synapse (
48
- synapse : FoldingSynapse ,
50
+ synapse : JobSubmissionSynapse ,
49
51
data_directory : str ,
50
52
state : str ,
51
- ) -> FoldingSynapse :
53
+ ) -> JobSubmissionSynapse :
52
54
"""load the output files as bytes and add to synapse.md_output
53
55
54
56
Args:
55
- synapse (FoldingSynapse ): Recently received synapse object
57
+ synapse (JobSubmissionSynapse ): Recently received synapse object
56
58
data_directory (str): directory where the miner is holding the necessary data for the validator.
57
59
state (str): the current state of the simulation
58
60
@@ -72,7 +74,7 @@ def attach_files_to_synapse(
72
74
73
75
74
76
Returns:
75
- FoldingSynapse : synapse with md_output attached
77
+ JobSubmissionSynapse : synapse with md_output attached
76
78
"""
77
79
78
80
synapse .md_output = {} # ensure that the initial state is empty
@@ -110,8 +112,8 @@ def attach_files_to_synapse(
110
112
111
113
112
114
def check_synapse (
113
- self , synapse : FoldingSynapse , output_dir : str , event : Dict = None
114
- ) -> FoldingSynapse :
115
+ self , synapse : JobSubmissionSynapse , output_dir : str , event : Dict = None
116
+ ) -> JobSubmissionSynapse :
115
117
"""Utility function to remove md_inputs if they exist"""
116
118
if len (synapse .md_inputs ) > 0 :
117
119
event ["md_inputs_sizes" ] = list (map (len , synapse .md_inputs .values ()))
@@ -240,7 +242,7 @@ def check_and_remove_simulations(self, event: Dict) -> Dict:
240
242
241
243
return event
242
244
243
- def forward (self , synapse : FoldingSynapse ) -> FoldingSynapse :
245
+ def forward (self , synapse : JobSubmissionSynapse ) -> JobSubmissionSynapse :
244
246
"""
245
247
The main async function that is called by the dendrite to run the simulation.
246
248
There are a set of default behaviours the miner should carry out based on the form the synapse comes in as:
@@ -252,7 +254,7 @@ def forward(self, synapse: FoldingSynapse) -> FoldingSynapse:
252
254
- If the number of active processes is less than the number of CPUs and the pdb_id is unique, start a new process
253
255
254
256
Returns:
255
- FoldingSynapse : synapse with md_output attached
257
+ JobSubmissionSynapse : synapse with md_output attached
256
258
"""
257
259
# If we are already running a process with the same identifier, return intermediate information
258
260
bt .logging .debug (f"⌛ Query from validator for protein: { synapse .pdb_id } ⌛" )
@@ -330,9 +332,7 @@ def forward(self, synapse: FoldingSynapse) -> FoldingSynapse:
330
332
f"❗ Cannot start new process: job limit reached. ({ len (self .simulations )} /{ self .max_workers } ).❗"
331
333
)
332
334
333
- bt .logging .warning (
334
- f"❗ Removing miner from job pool ❗"
335
- )
335
+ bt .logging .warning (f"❗ Removing miner from job pool ❗" )
336
336
337
337
event ["condition" ] = "cpu_limit_reached"
338
338
synapse .miner_serving = False
@@ -378,7 +378,7 @@ def forward(self, synapse: FoldingSynapse) -> FoldingSynapse:
378
378
self = self , synapse = synapse , event = event , output_dir = output_dir
379
379
)
380
380
381
- async def blacklist (self , synapse : FoldingSynapse ) -> Tuple [bool , str ]:
381
+ async def blacklist (self , synapse : JobSubmissionSynapse ) -> Tuple [bool , str ]:
382
382
if (
383
383
not self .config .blacklist .allow_non_registered
384
384
and synapse .dendrite .hotkey not in self .metagraph .hotkeys
@@ -406,7 +406,7 @@ async def blacklist(self, synapse: FoldingSynapse) -> Tuple[bool, str]:
406
406
)
407
407
return False , "Hotkey recognized!"
408
408
409
- async def priority (self , synapse : FoldingSynapse ) -> float :
409
+ async def priority (self , synapse : JobSubmissionSynapse ) -> float :
410
410
caller_uid = self .metagraph .hotkeys .index (
411
411
synapse .dendrite .hotkey
412
412
) # Get the caller index.
0 commit comments