a few ideas extra

pull/18/head
Christopher Usher 6 years ago committed by Mike Lang
parent 0e7ba25b76
commit 05fed36ac8

@ -3,6 +3,10 @@
# lots about web services and the like I don't know # lots about web services and the like I don't know
# needs logging, exception handling and the like # needs logging, exception handling and the like
# when starting the backfiller and every few hours, backfill everything
# more frequently, backfill the last couple hours
# (last three hour directories so always at least two hours).
import glob import glob
import requests import requests
import os import os
@ -10,8 +14,8 @@ import os
def get_nodes(): def get_nodes():
# either read a config file or query the database to get the addresses of # either read a config file or query the database to get the addresses
# the other nodes # of the other nodes
# as a prototype can just hardcode some addresses. # as a prototype can just hardcode some addresses.
@ -46,8 +50,8 @@ def get_remote_segment(node, segment):
def back_fill(base_dir, nodes=None): def back_fill(base_dir, nodes=None):
# loop over nodes asking for a list of segments then downloads any segments # loop over nodes asking for a list of segments then downloads any
# it doesn't have # segments it doesn't have
if nodes is None: if nodes is None:
nodes = get_nodes() nodes = get_nodes()
@ -55,12 +59,13 @@ def back_fill(base_dir, nodes=None):
for node in nodes: for node in nodes:
# need to figure out how to properly check whether this node is the # need to figure out how to properly check whether this node is
# same # the same
if node == 'localhost': if node == 'localhost':
continue continue
# not sure how much we want to hard code the search # not sure how much we want to hard code the search
# replace with something from the restreamer
local_segments = set(glob.glob(base_dir + '/*/*/*.ts')) local_segments = set(glob.glob(base_dir + '/*/*/*.ts'))
remote_segments = set(list_remote_segments(node)) remote_segments = set(list_remote_segments(node))
@ -80,4 +85,5 @@ def main(base_dir, wait_time=60):
# time from start of back_fill # time from start of back_fill
# to keep things simple don't try two back_fills at the same time # to keep things simple don't try two back_fills at the same time
# wait for previous one to start before launching second. # wait for previous one to start before launching second.
# if it's taken more than wait_time for back_fill to run, start immediately # if it's taken more than wait_time for back_fill to run, start
# immediately

Loading…
Cancel
Save