From 1e3af621305a4c6366e100224f01704556ea0362 Mon Sep 17 00:00:00 2001 From: krunch3r76 Date: Mon, 21 Mar 2022 03:01:13 -0700 Subject: [PATCH] 0.1.3: make workable again --- README.md | 6 +++--- gc_spyu.py | 4 +--- gc_spyu/filter_dups_ms.py | 7 +++++-- gc_spyu/mysummarylogger.py | 12 +++++++++--- gc_spyu/spyu.py | 2 +- gc_spyu/view/on_run_conclusion.py | 1 + 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index bd2759b..8f3b195 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ For a listing of providers to inspect, visit https://stats.golem.network or invo ```bash $ git clone https://github.com/krunch3r76/gc_spyu.git $ cd gc_spyu -(gc_spyu)$ git checkout v0.1.2 +(gc_spyu)$ git checkout v0.1.3 (gc_spyu)$ python3 -m venv myvenv # python3.9 or python3.8 (gc_spyu)$ . myvenv/bin/activate (myvenv)$ pip install -r requirements.txt @@ -22,14 +22,14 @@ $ cd gc_spyu (gc_spyu)$ git fetch From github.com:krunch3r76/gc_spyu d87b579..01f72be master -> origin/master - * [new tag] v0.1.2 -> v0.1.2 + * [new tag] v0.1.3 -> v0.1.3 ``` # upgrade installation to latest tag, removing current installation ```bash (gc_spyu)$ git clean -dfx (gc_spyu)$ git pull -(gc_spyu)$ git checkout v0.1.2 +(gc_spyu)$ git checkout v0.1.3 ``` # DEMO diff --git a/gc_spyu.py b/gc_spyu.py index e520a18..ba3fab2 100755 --- a/gc_spyu.py +++ b/gc_spyu.py @@ -11,11 +11,9 @@ utils.run_golem_example(spyu_ctx()) mySummaryLogger, nodeInfoIds, myModel = spyu_ctx.get_results() - mySummaryLogger.providersFailed.append( - {"address": "0x3a8052f782c55f96be7ffbce22587ed917ad98b9", "name": "michal"} - ) merged_list = mySummaryLogger.providersFailed merged_list.extend(mySummaryLogger.skipped) + debug.dlog(f"merged_list: {merged_list}") if len(merged_list) > 0: msg = ( "The following providers were skipped because they were" diff --git a/gc_spyu/filter_dups_ms.py b/gc_spyu/filter_dups_ms.py index f4ba14d..a2389e3 100644 --- a/gc_spyu/filter_dups_ms.py +++ b/gc_spyu/filter_dups_ms.py @@ -46,10 +46,13 @@ async def score_offer(self, offer, history=None): "\033[5m already have model information!\033[25m" ) partial_addr = self._find_partial_match(offer.issuer) - if partial_addr != None: - debug.dlog(f"discarding {partial_addr}", 11) + # if partial_addr != None: + if True: + debug.dlog(f"discarding {partial_addr}", 10) self.whitelist.discard(partial_addr) self.whitelist.discard(name) + if partial_addr != None: + self.dupIds.add(partial_addr) debug.dlog(f"remaining count: {len(self.whitelist)}") else: debug.dlog(f"scoring {name}@{offer.issuer} count: {count}") diff --git a/gc_spyu/mysummarylogger.py b/gc_spyu/mysummarylogger.py index 6a2a01a..321a411 100644 --- a/gc_spyu/mysummarylogger.py +++ b/gc_spyu/mysummarylogger.py @@ -151,7 +151,7 @@ def log(self, event: yapapi.events.Event) -> None: f"agreement created with agr_id: {event.agr_id} with" f" provider named: {event.provider_info.name}" ) - self._blacklist_provider(event.provider_id, event.provider_info.name) + # self._blacklist_provider(event.provider_id, event.provider_info.name) elif isinstance(self, yapapi.events.AgreementConfirmed): pass # [ TaskAccepted ] @@ -180,11 +180,14 @@ def log(self, event: yapapi.events.Event) -> None: try: agr_id = self._jobid_to_agr[event.job_id] info = self.id_to_info[agr_id] - self.providersFailed.append(info["address"], info["name"]) - self._blacklist_provider(info["address"], info["name"]) except: agr_id = "unknown agreement" info = "no info" + else: + self.providersFailed.extend( + [{"address": info["address"], "name": info["name"]}] + ) + self._blacklist_provider(info["address"], info["name"]) if ( event.exc_info != None and len(event.exc_info) > 0 @@ -278,6 +281,9 @@ def log(self, event: yapapi.events.Event) -> None: agreements_with_invoices = set(self._invoicesReceived.keys()) agreementsConfirmed = set(self._agreementsConfirmed) if agreements_with_invoices == agreementsConfirmed: + + debug.dlog(f"agreements_with_invoices: {agreements_with_invoices}") + debug.dlog(f"agreemintsConfirmd: {agreementsConfirmed}") debug.dlog("raising keyboardinterrupt") raise KeyboardInterrupt else: diff --git a/gc_spyu/spyu.py b/gc_spyu/spyu.py index dc684c5..b7a4c87 100644 --- a/gc_spyu/spyu.py +++ b/gc_spyu/spyu.py @@ -297,7 +297,7 @@ def _check_args(self, args): sys.exit(0) else: break - whitelist = set(args.spy) + # whitelist = set(args.spy) os.environ["GNPROVIDER"] = f'[{",".join(args.spy)}]' else: print("Using GNPROVIDER filterms environment variable to select" " nodes") diff --git a/gc_spyu/view/on_run_conclusion.py b/gc_spyu/view/on_run_conclusion.py index 76029c4..9159cb4 100644 --- a/gc_spyu/view/on_run_conclusion.py +++ b/gc_spyu/view/on_run_conclusion.py @@ -43,6 +43,7 @@ def console_interface(mySummaryLogger, nodeInfoIds, myModel, dupIds): print("") if len(dupIds) > 0: + debug.dlog(dupIds) ss = "SELECT nodename, addr, modelname" \ + " FROM provider NATURAL JOIN nodeInfo" \ +f" WHERE providerId IN ( {', '.join(map(str,dupIds))} )"