@ -250,8 +252,15 @@ class BackfillerManager(object):
nodes[substrs[0]]=substrs[1]
nodes[substrs[0]]=substrs[1]
ifself.node_databaseisnotNone:
ifself.node_databaseisnotNone:
self.logger.info('Fetching list of nodes from {}'.format(self.node_database))
self.logger.info('Fetching list of nodes from {}'.format(
# TODO query the database
urlparse.urlparse(self.node_database).hostname))
conn=self.db_manager.query()
results=database.query(conn,"""
SELECTname,url,backfill_from
FROMnodes""")
forrowinresults:
ifrow.backfill_from:
nodes[row.name]=row.url
nodes.pop(self.localhost,None)
nodes.pop(self.localhost,None)
returnnodes.values()
returnnodes.values()
@ -368,7 +377,7 @@ class BackfillerWorker(object):
@argh.arg('--start',help='If a datetime only backfill hours after that datetime. If a number, bacfill hours more recent than that number of hours ago. If None (default), all hours are backfilled.')
@argh.arg('--start',help='If a datetime only backfill hours after that datetime. If a number, bacfill hours more recent than that number of hours ago. If None (default), all hours are backfilled.')
@argh.arg('--run-once',help='If True, backfill only once. By default False.')
@argh.arg('--run-once',help='If True, backfill only once. By default False.')
@argh.arg('--node-file',help="Name of file listing nodes to backfill from. One node per line in the form NAME URI with whitespace only lines or lines starting with '#' ignored. If None (default) do not get nodes from a file.")
@argh.arg('--node-file',help="Name of file listing nodes to backfill from. One node per line in the form NAME URI with whitespace only lines or lines starting with '#' ignored. If None (default) do not get nodes from a file.")
@argh.arg('--node-database',help='Address of database node to fetch a list of nodes from. If None (default) do not get nodes from database.')
@argh.arg('--node-database',help='Postgres conection string for database to fetch a list of nodes from. Either a space-separated list of key=value pairs, or a URI like: postgresql://USER:PASSWORD@HOST/DBNAME?KEY=VALUE . If None (default) do not get nodes from database.')
@argh.arg('--localhost',help='Name of local machine. Used to prevent backfilling from itself. By default the result of socket.gethostname()')
@argh.arg('--localhost',help='Name of local machine. Used to prevent backfilling from itself. By default the result of socket.gethostname()')