Skip to content

Commit

Permalink
fix overview pickling (#1508)
Browse files Browse the repository at this point in the history
Co-authored-by: Cameron Fairchild <[email protected]>
  • Loading branch information
ifrit98 and camfairchild authored Sep 1, 2023
1 parent 37bc6d5 commit 2cecaf9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bittensor/commands/overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,18 @@ def run(cli: 'bittensor.cli'):
}
all_hotkey_addresses = list(hotkey_addr_to_wallet.keys())

# Create a copy of the config without the parser and formatter_class.
## This is needed to pass to the ProcessPoolExecutor, which cannot pickle the parser.
copy_config = cli.config.copy()
copy_config['__parser'] = None
copy_config['formatter_class'] = None

# Pull neuron info for all keys.
## Max len(netuids) or 5 threads.
with ProcessPoolExecutor(max_workers=max(len(netuids), 5)) as executor:
results = executor.map(
OverviewCommand._get_neurons_for_netuid,
[(cli.config, netuid, all_hotkey_addresses) for netuid in netuids],
[(copy_config, netuid, all_hotkey_addresses) for netuid in netuids],
)
executor.shutdown(wait=True) # wait for all complete

Expand Down

0 comments on commit 2cecaf9

Please sign in to comment.