HipparchiaGolangHelpers
GrabberModule: golanggrabber and golangmodule
a binary and a python module to provide helper functions to HipparchiaServer; only one need be used at a time
NB: the python module will require HipparchiaGolangHelpers/WebSocketApp
to work properly
here is the logic flow adumbrated by HipparchiaServer's sharedlibrarysearcher()
:
[1] send the searchdict to redis as a list of json.dumps(items) (keyed to the searchid)
[2] send the external fnc the searchid, cap value, worker #, psql login info, redis login info
[3] wait for the function to (a) gather; (b) search; (c) store
[4] pull the results back from redis via the searchid
NB: redis makes sense because the activity poll is going to have to be done via redis anyway...
the searched items are stored under the redis key 'searchid_results'
json.loads() will leave you with a dictionary of k/v pairs that can be turned into a dbWorkLine
we are doing [3]
above with HipparchiaGolangModule
gopy does not automatically generate the right import
statements in go.py
and
hipparchiagolangsearching.py
after running:
gopy build -output=golangmodule -vm=`which python3` $GOPATH/src/github.com/e-gun/HipparchiaGolangModule/
in golangmodule/go.py
and golangmodule/hipparchiagolangsearching.py
for import _hipparchiagolangsearching
substitute from server.golangmodule import _hipparchiagolangsearching
and for import go
substitute
from server.golangmodule import go
that is, run postmodulebuild.sh
#!/bin/sh
sed -i "s/import _hipparchiagolangsearching/from server.golangmodule import _hipparchiagolangsearching/" golangmodule/go.py
sed -i "s/import _hipparchiagolangsearching/from server.golangmodule import _hipparchiagolangsearching/" golangmodule/hipparchiagolangsearching.py
sed -i "s/import go/from server.golangmodule import go/" golangmodule/hipparchiagolangsearching.py
# cp HipparchiaGolangModule golangmodule/golanggrabber