def _stratum_timeout(self, result: Failure, timeout: int, *, tx: 'BaseTransaction', request: Request) -> None: """ Method called when stratum timeouts when trying to solve tx pow We remove mining data and deferred from stratum and send error as response """ stratum_tx = None funds_hash = tx.get_funds_hash() # We get both tx because stratum might have updated the tx (timestamp or parents) stratum_tx = self._cleanup_stratum(funds_hash) result.value = 'Timeout: error resolving transaction proof of work' self.log.warn( 'stratum timeout: error resolving transaction proof of work', tx=tx.get_struct().hex(), stratum_tx=stratum_tx.get_struct().hex() if stratum_tx else '') # start new job in stratum, so the miner doesn't waste more time on this tx self.manager.stratum_factory.update_jobs() # update metrics self.manager.metrics.send_token_timeouts += 1 self._err_tx_resolve(result, request, 'stratum_timeout')
def parseError(self, err, query, instMap): err = Failure(err) err.value = 'Received %s from query: %s'%(err.value, query) log.error(err.getErrorMessage()) results = {} for instances in instMap.values(): for tables in instances.values(): for table, props in tables: results[table] = [err,] return results
def test_process_done(self): error = Failure(exc_value=Exception()) error.type = ProcessDone error.value = Mock(exitCode=1, message="foobar") jobtype = JobType(fake_assignment()) self.assertEqual( jobtype.format_error(error), "Process has finished with no apparent errors." )
def parseError(self, err, query, instMap): err = Failure(err) err.value = 'Received %s from query: %s' % (err.value, query) log.error(err.getErrorMessage()) results = {} for instances in instMap.values(): for tables in instances.values(): for table, props in tables: results[table] = [ err, ] return results
def test_process_terminated(self): error = Failure(exc_value=Exception()) error.type = ProcessTerminated error.value = Mock(exitCode=1, message="foobar") jobtype = JobType(fake_assignment()) self.assertEqual( jobtype.format_error(error), "Process may have terminated abnormally, please check " "the logs. Message from error " "was 'foobar'" )
def parseError(self, err, query, instMap): if isinstance(err.value, pywbem.cim_http.AuthError): msg = 'AuthError: Please check zWinUser and zWinPassword zProperties' else: msg = 'Received %s from query: %s'%(err.value[1], query) err = Failure(err) err.value = msg log.error(err.getErrorMessage()) results = {} for instances in instMap.values(): for tables in instances.values(): for table, props in tables: results[table] = [err] return results
def parseError(self, err, query, instMap): if isinstance(err.value, pywbem.cim_http.AuthError): msg = 'AuthError: Please check zWinUser and zWinPassword zProperties' else: msg = 'Received %s from query: %s' % (err.value[1], query) err = Failure(err) err.value = msg log.error(err.getErrorMessage()) results = {} for instances in instMap.values(): for tables in instances.values(): for table, props in tables: results[table] = [err] return results
def _stratum_timeout(self, result: Failure, timeout: int, *, tx: 'BaseTransaction', request: Request) -> None: """ Method called when stratum timeouts when trying to solve tx pow We remove mining data and deferred from stratum and send error as response """ stratum_tx = None funds_hash = tx.get_funds_hash() if funds_hash in self.manager.stratum_factory.mining_tx_pool: # We get both tx because stratum might have updated the tx (timestamp or parents) stratum_tx = self.manager.stratum_factory.mining_tx_pool.pop(funds_hash) if funds_hash in self.manager.stratum_factory.deferreds_tx: del self.manager.stratum_factory.deferreds_tx[funds_hash] result.value = 'Timeout: error resolving transaction proof of work' self.log.info( 'Stratum timeout: error resolving transaction proof of work. Tx={tx} Stratum tx={stratum_tx}', tx=tx.get_struct().hex(), stratum_tx=stratum_tx.get_struct().hex() if stratum_tx else '' ) self._err_tx_resolve(result, request)