|
|
@ -7,6 +7,7 @@ import os
|
|
|
|
import random
|
|
|
|
import random
|
|
|
|
import signal
|
|
|
|
import signal
|
|
|
|
import socket
|
|
|
|
import socket
|
|
|
|
|
|
|
|
import urlparse
|
|
|
|
import uuid
|
|
|
|
import uuid
|
|
|
|
|
|
|
|
|
|
|
|
import argh
|
|
|
|
import argh
|
|
|
@ -202,9 +203,12 @@ class BackfillerManager(object):
|
|
|
|
def get_nodes(self):
|
|
|
|
def get_nodes(self):
|
|
|
|
"""List address of other wubloaders.
|
|
|
|
"""List address of other wubloaders.
|
|
|
|
|
|
|
|
|
|
|
|
This returns a list of the other wubloaders as URI strings"""
|
|
|
|
This returns a list of the other wubloaders as URL strings.
|
|
|
|
nodes = self.static_nodes + []
|
|
|
|
|
|
|
|
|
|
|
|
If only has a URL, infer name from the hostname of the URL"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nodes = {urlparse.urlparse(node).hostname:node for nodes in self.static_nodes}
|
|
|
|
|
|
|
|
|
|
|
|
if self.node_file is not None:
|
|
|
|
if self.node_file is not None:
|
|
|
|
self.logger.info('Fetching list of nodes from {}'.format(self.node_file))
|
|
|
|
self.logger.info('Fetching list of nodes from {}'.format(self.node_file))
|
|
|
|
try:
|
|
|
|
try:
|
|
|
@ -213,18 +217,18 @@ class BackfillerManager(object):
|
|
|
|
substrs = line.split()
|
|
|
|
substrs = line.split()
|
|
|
|
if not len(line) or substrs[0][0] == '#':
|
|
|
|
if not len(line) or substrs[0][0] == '#':
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
nodes.append(substrs[0])
|
|
|
|
elif len(substrs) == 1:
|
|
|
|
except IOError:
|
|
|
|
nodes[urlparse.urlparse(substr[0]).hostname] = substr[0]
|
|
|
|
self.logger.info('{} not found'.format(self.node_file))
|
|
|
|
else:
|
|
|
|
|
|
|
|
nodes[substrs[0]] = substrs[1]
|
|
|
|
if self.node_database:
|
|
|
|
|
|
|
|
|
|
|
|
if self.node_database is not None:
|
|
|
|
self.logger.info('Fetching list of nodes from {}'.format(self.node_database))
|
|
|
|
self.logger.info('Fetching list of nodes from {}'.format(self.node_database))
|
|
|
|
# query the database
|
|
|
|
# query the database
|
|
|
|
|
|
|
|
|
|
|
|
if self.localhost is not None:
|
|
|
|
nodes.pop(self.localhost, None)
|
|
|
|
nodes = [node for node in nodes if self.localhost not in node]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return nodes
|
|
|
|
return nodes.values()
|
|
|
|
|
|
|
|
|
|
|
|
class BackfillerWorker(object):
|
|
|
|
class BackfillerWorker(object):
|
|
|
|
"""Backfills segments from a node.
|
|
|
|
"""Backfills segments from a node.
|
|
|
|