mirror of
https://github.com/tig-pool-nk/tig-monorepo.git
synced 2026-03-03 14:57:22 +08:00
Clean up logs.
This commit is contained in:
parent
e15ba6e25c
commit
13e34e4e2b
@ -39,7 +39,7 @@ async def main(
|
||||
last_update = time.time()
|
||||
while not exit_event.is_set():
|
||||
now = time.time()
|
||||
if now - last_update > 6:
|
||||
if now - last_update > 1:
|
||||
last_update = now
|
||||
await emit('update')
|
||||
await process_events(extensions)
|
||||
|
||||
@ -268,7 +268,7 @@ class Extension:
|
||||
num_finished = sum(x is not None for x in job.batch_merkle_roots)
|
||||
if num_finished != len(job.batch_merkle_roots):
|
||||
c_name = self.challenge_id_2_name[job.settings.challenge_id]
|
||||
logger.info(f"precommit {job.benchmark_id}: (challenge: {c_name}, progress: {num_finished} of {len(job.batch_merkle_roots)}, elapsed: {now_ - job.start_time}ms)")
|
||||
logger.info(f"precommit {job.benchmark_id}: (challenge: {c_name}, progress: {num_finished} of {len(job.batch_merkle_roots)} batches, elapsed: {now_ - job.start_time}ms)")
|
||||
if len(retry_batch_idxs) == 0:
|
||||
return
|
||||
for batch_idx in retry_batch_idxs:
|
||||
|
||||
@ -42,6 +42,7 @@ class Extension:
|
||||
self.batches = {}
|
||||
self.priority_batches = {}
|
||||
self.challenge_name_2_id = {}
|
||||
self.last_update = 0
|
||||
self.lock = True
|
||||
self._start_server()
|
||||
|
||||
@ -179,6 +180,10 @@ class Extension:
|
||||
self.batches.setdefault(challenge_id, deque()).append((batch, now_))
|
||||
|
||||
async def on_update(self):
|
||||
now_ = now()
|
||||
if now_ - self.last_update < 10000:
|
||||
return
|
||||
self.last_update = now_
|
||||
logger.info(f"#batches in queue (normal: {sum(len(x) for x in self.batches.values())}, priority: {sum(len(x) for x in self.priority_batches.values())})")
|
||||
|
||||
async def on_new_block(self, precommits: Dict[str, Precommit], challenges: Dict[str, Challenge], **kwargs):
|
||||
|
||||
@ -51,6 +51,7 @@ class Extension:
|
||||
"benchmark": [],
|
||||
"proof": []
|
||||
}
|
||||
self.last_submit = 0
|
||||
self._restore_pending_submissions()
|
||||
|
||||
def _restore_pending_submissions(self):
|
||||
@ -162,7 +163,11 @@ class Extension:
|
||||
len(self.pending_submissions['proof']) == 0
|
||||
):
|
||||
return
|
||||
|
||||
now_ = now()
|
||||
if now_ - self.last_submit < 5500:
|
||||
return
|
||||
self.last_submit = now_
|
||||
|
||||
logger.debug(f"pending submissions: (#precommits: {len(self.pending_submissions['precommit'])}, #benchmarks: {len(self.pending_submissions['benchmark'])}, #proofs: {len(self.pending_submissions['proof'])})")
|
||||
|
||||
now_ = now()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user