99
1010# import base miner class which takes care of most of the boilerplate
1111from folding .base .miner import BaseMinerNeuron
12- from folding .protocol import FoldingSynapse
12+ from folding .protocol import JobSubmissionSynapse
1313from folding .utils .logging import log_event
1414from folding .utils .ops import (
1515 run_cmd_commands ,
2323BASE_DATA_PATH = os .path .join (ROOT_DIR , "miner-data" )
2424
2525
26- def attach_files (files_to_attach : List , synapse : FoldingSynapse ) -> FoldingSynapse :
26+ def attach_files (
27+ files_to_attach : List , synapse : JobSubmissionSynapse
28+ ) -> JobSubmissionSynapse :
2729 """function that parses a list of files and attaches them to the synapse object"""
2830 bt .logging .info (f"Sending files to validator: { files_to_attach } " )
2931 for filename in files_to_attach :
@@ -45,14 +47,14 @@ def attach_files(files_to_attach: List, synapse: FoldingSynapse) -> FoldingSynap
4547
4648
4749def attach_files_to_synapse (
48- synapse : FoldingSynapse ,
50+ synapse : JobSubmissionSynapse ,
4951 data_directory : str ,
5052 state : str ,
51- ) -> FoldingSynapse :
53+ ) -> JobSubmissionSynapse :
5254 """load the output files as bytes and add to synapse.md_output
5355
5456 Args:
55- synapse (FoldingSynapse ): Recently received synapse object
57+ synapse (JobSubmissionSynapse ): Recently received synapse object
5658 data_directory (str): directory where the miner is holding the necessary data for the validator.
5759 state (str): the current state of the simulation
5860
@@ -72,7 +74,7 @@ def attach_files_to_synapse(
7274
7375
7476 Returns:
75- FoldingSynapse : synapse with md_output attached
77+ JobSubmissionSynapse : synapse with md_output attached
7678 """
7779
7880 synapse .md_output = {} # ensure that the initial state is empty
@@ -110,8 +112,8 @@ def attach_files_to_synapse(
110112
111113
112114def 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 :
115117 """Utility function to remove md_inputs if they exist"""
116118 if len (synapse .md_inputs ) > 0 :
117119 event ["md_inputs_sizes" ] = list (map (len , synapse .md_inputs .values ()))
@@ -240,7 +242,7 @@ def check_and_remove_simulations(self, event: Dict) -> Dict:
240242
241243 return event
242244
243- def forward (self , synapse : FoldingSynapse ) -> FoldingSynapse :
245+ def forward (self , synapse : JobSubmissionSynapse ) -> JobSubmissionSynapse :
244246 """
245247 The main async function that is called by the dendrite to run the simulation.
246248 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:
252254 - If the number of active processes is less than the number of CPUs and the pdb_id is unique, start a new process
253255
254256 Returns:
255- FoldingSynapse : synapse with md_output attached
257+ JobSubmissionSynapse : synapse with md_output attached
256258 """
257259 # If we are already running a process with the same identifier, return intermediate information
258260 bt .logging .debug (f"⌛ Query from validator for protein: { synapse .pdb_id } ⌛" )
@@ -330,9 +332,7 @@ def forward(self, synapse: FoldingSynapse) -> FoldingSynapse:
330332 f"❗ Cannot start new process: job limit reached. ({ len (self .simulations )} /{ self .max_workers } ).❗"
331333 )
332334
333- bt .logging .warning (
334- f"❗ Removing miner from job pool ❗"
335- )
335+ bt .logging .warning (f"❗ Removing miner from job pool ❗" )
336336
337337 event ["condition" ] = "cpu_limit_reached"
338338 synapse .miner_serving = False
@@ -378,7 +378,7 @@ def forward(self, synapse: FoldingSynapse) -> FoldingSynapse:
378378 self = self , synapse = synapse , event = event , output_dir = output_dir
379379 )
380380
381- async def blacklist (self , synapse : FoldingSynapse ) -> Tuple [bool , str ]:
381+ async def blacklist (self , synapse : JobSubmissionSynapse ) -> Tuple [bool , str ]:
382382 if (
383383 not self .config .blacklist .allow_non_registered
384384 and synapse .dendrite .hotkey not in self .metagraph .hotkeys
@@ -406,7 +406,7 @@ async def blacklist(self, synapse: FoldingSynapse) -> Tuple[bool, str]:
406406 )
407407 return False , "Hotkey recognized!"
408408
409- async def priority (self , synapse : FoldingSynapse ) -> float :
409+ async def priority (self , synapse : JobSubmissionSynapse ) -> float :
410410 caller_uid = self .metagraph .hotkeys .index (
411411 synapse .dendrite .hotkey
412412 ) # Get the caller index.
0 commit comments