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
# 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 requests
import os
@ -10,8 +14,8 @@ import os
def get_nodes():
# either read a config file or query the database to get the addresses of
# the other nodes
# either read a config file or query the database to get the addresses
# of the other nodes
# 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):
# loop over nodes asking for a list of segments then downloads any segments
# it doesn't have
# loop over nodes asking for a list of segments then downloads any
# segments it doesn't have
if nodes is None:
nodes = get_nodes()
@ -55,12 +59,13 @@ def back_fill(base_dir, nodes=None):
for node in nodes:
# need to figure out how to properly check whether this node is the
# same
# need to figure out how to properly check whether this node is
# the same
if node == 'localhost':
continue
# 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'))
remote_segments = set(list_remote_segments(node))
@ -80,4 +85,5 @@ def main(base_dir, wait_time=60):
# time from start of back_fill
# to keep things simple don't try two back_fills at the same time
# 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