Skip to content

Commit

Permalink
0.1.3: make workable again
Browse files Browse the repository at this point in the history
  • Loading branch information
krunch3r76 committed Mar 21, 2022
1 parent 3e66887 commit 1e3af62
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 1 addition & 3 deletions gc_spyu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 5 additions & 2 deletions gc_spyu/filter_dups_ms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
12 changes: 9 additions & 3 deletions gc_spyu/mysummarylogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion gc_spyu/spyu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions gc_spyu/view/on_run_conclusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))} )"
Expand Down

0 comments on commit 1e3af62

Please sign in to comment.