-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
380 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# | ||
# RPC interactions with Chia on controller via WebUI | ||
# | ||
|
||
import asyncio | ||
import datetime | ||
|
||
from chia.rpc.full_node_rpc_client import FullNodeRpcClient | ||
from chia.rpc.farmer_rpc_client import FarmerRpcClient | ||
from chia.util.default_root import DEFAULT_ROOT_PATH | ||
from chia.util.ints import uint16 | ||
from chia.util.config import load_config as load_chia_config | ||
|
||
from web import app | ||
|
||
async def load_plots_per_harvester(): | ||
harvesters = {} | ||
try: | ||
config = load_chia_config(DEFAULT_ROOT_PATH, 'config.yaml') | ||
farmer_rpc_port = config["farmer"]["rpc_port"] | ||
farmer = await FarmerRpcClient.create( | ||
'localhost', uint16(farmer_rpc_port), DEFAULT_ROOT_PATH, config | ||
) | ||
result = await farmer.get_harvesters() | ||
farmer.close() | ||
await farmer.await_closed() | ||
for harvester in result["harvesters"]: | ||
host = harvester["connection"]["host"] | ||
plots = harvester["plots"] | ||
harvester_plots = [] | ||
for plot in plots: | ||
harvester_plots.append({ | ||
"type": "solo" if (plot["pool_contract_puzzle_hash"] is None) else "portable", | ||
"plot_id": plot['plot_id'], | ||
"file_size": plot['file_size'], # bytes | ||
"filename": plot['filename'], # full path and name | ||
"plot_public_key": plot['plot_public_key'], | ||
"pool_contract_puzzle_hash": plot['pool_contract_puzzle_hash'], | ||
"pool_public_key": plot['pool_public_key'], | ||
}) | ||
harvesters[host] = harvester_plots | ||
except Exception as ex: | ||
app.logger.info("Error getting plots via RPC: {0}".format(str(ex))) | ||
return harvesters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.