Merge pull request #2 from UpstreamData/imperium2

merge from origin master. update result_handler
This commit is contained in:
UpstreamData
2021-11-03 12:52:35 -06:00
committed by GitHub
2 changed files with 12 additions and 11 deletions

View File

@@ -99,4 +99,4 @@ class BOSminer(BaseMiner):
if chain['Chips'] == 0: if chain['Chips'] == 0:
bad += 1 bad += 1
if not bad > 0: if not bad > 0:
return str(self.ip) return str(self.ip)

View File

@@ -41,15 +41,6 @@ class CGMiner(BaseMiner):
continue continue
# handle result # handle result
self._result_handler(result) self._result_handler(result)
if result is not None:
if result.stdout != "":
print(result.stdout)
if result.stderr != "":
print("ERROR: " + result.stderr)
elif result.stderr != "":
print("ERROR: " + result.stderr)
else:
print(cmd)
@staticmethod @staticmethod
def _result_handler(result: asyncssh.process.SSHCompletedProcess) -> None: def _result_handler(result: asyncssh.process.SSHCompletedProcess) -> None:
@@ -60,6 +51,16 @@ class CGMiner(BaseMiner):
print("ssh stderr: \n" + result.stderrr) print("ssh stderr: \n" + result.stderrr)
if len(result.stdout) <= 0 and len(result.stderr) <= 0: if len(result.stdout) <= 0 and len(result.stderr) <= 0:
print("ssh stdout stderr empty") print("ssh stdout stderr empty")
else:
print(cmd)
# if result.stdout != "":
# print(result.stdout)
# if result.stderr != "":
# print("ERROR: " + result.stderr)
# elif result.stderr != "":
# print("ERROR: " + result.stderr)
# else:
# print(cmd)
async def restart_cgminer(self) -> None: async def restart_cgminer(self) -> None:
commands = ['cgminer-api restart', commands = ['cgminer-api restart',
@@ -94,4 +95,4 @@ class CGMiner(BaseMiner):
result = await conn.run(command, check=True) result = await conn.run(command, check=True)
self._result_handler(result) self._result_handler(result)
self.config = result.stdout self.config = result.stdout
print(str(self.config)) print(str(self.config))