Implement indexing into Apache Druid #1
|
@ -5,7 +5,7 @@ from twisted.internet.threads import deferToThread
|
||||||
|
|
||||||
import main
|
import main
|
||||||
import modules.provision
|
import modules.provision
|
||||||
from utils.logging.debug import debug
|
from utils.logging.debug import debug, trace
|
||||||
from utils.logging.log import error, log, warn
|
from utils.logging.log import error, log, warn
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,6 +77,7 @@ def emptyChanAllocate(net, flist, relay, new):
|
||||||
chans_not_covered = toalloc - sum_free # 2148 - 250 = 1898
|
chans_not_covered = toalloc - sum_free # 2148 - 250 = 1898
|
||||||
relays_needed = chans_not_covered / chanfree[1] # 1898 / 250 = 7.592
|
relays_needed = chans_not_covered / chanfree[1] # 1898 / 250 = 7.592
|
||||||
correction = ceil(relays_needed)
|
correction = ceil(relays_needed)
|
||||||
|
if main.config["ChanKeep"]["Provision"]:
|
||||||
debug(
|
debug(
|
||||||
(
|
(
|
||||||
f"emptyChanAllocate() secondary allocation sum_free:{sum_free} "
|
f"emptyChanAllocate() secondary allocation sum_free:{sum_free} "
|
||||||
|
@ -93,6 +94,14 @@ def emptyChanAllocate(net, flist, relay, new):
|
||||||
warn("Ran out of channel spaces, provisioning additional %i relays for %s" % (correction, net))
|
warn("Ran out of channel spaces, provisioning additional %i relays for %s" % (correction, net))
|
||||||
modules.provision.provisionMultipleRelays(net, correction)
|
modules.provision.provisionMultipleRelays(net, correction)
|
||||||
return False
|
return False
|
||||||
|
else:
|
||||||
|
# We don't have enough spaces and we can't add any.
|
||||||
|
# Let's do the best we can in the circumstances.
|
||||||
|
debug(f"emptyChanAllocate() cannot create additional relays for {net}")
|
||||||
|
debug(f"emptyChanAllocate() {chans_not_covered} channels cannot be covered")
|
||||||
|
flist = flist[:sum_free]
|
||||||
|
debug(f"emptyChanAllocate() flist truncated to {sum_free}, length nis now {len(flist)}")
|
||||||
|
trace(f"emptyChanAllocate() best effort allocation: {flist}")
|
||||||
for i in chanfree[0].keys():
|
for i in chanfree[0].keys():
|
||||||
for x in range(chanfree[0][i]):
|
for x in range(chanfree[0][i]):
|
||||||
if not len(flist):
|
if not len(flist):
|
||||||
|
|
Loading…
Reference in New Issue