summaryrefslogtreecommitdiff
path: root/src/flufigut.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/flufigut.py')
-rwxr-xr-xsrc/flufigut.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/flufigut.py b/src/flufigut.py
index c80c1b0..f715e03 100755
--- a/src/flufigut.py
+++ b/src/flufigut.py
@@ -59,7 +59,6 @@ atmosphere = {}
flow = {}
### sanity checks ###############################################
-
machines = {}
worker = {}
@@ -75,6 +74,7 @@ flow['input'] = {}
if 'input' not in worker:
raise SystemExit("ERROR: worker 'input' is not assigned to any machine!!")
+worker['input'] = True
flow['input']['raw-input'] = {
'type': input['source'],
'desc': "capture raw AV from %s" % input['source'],
@@ -148,10 +148,14 @@ for format in transcode.keys():
feeder = 'resize-%s' % resolution
video_encoder = 'encode-%s-%s' % (encoder, resolution)
if video_encoder not in flow['encoder_video'].keys():
+ worker_name = 'encoder-%s-%s' % (encoder, resolution)
+ if worker_name not in worker:
+ raise SystemExit("ERROR: worker '%s' is not assigned to any machine!!" % worker_name)
+ worker[worker_name] = True
flow['encoder_video'][video_encoder] = {
'type': '%s-encode' % encoder,
'desc': "%s encoder for %sx%s" % (encoder, globals['resolutions'][resolution]['width'], globals['resolutions'][resolution]['height']),
- 'worker': 'encoder-%s-%s' % (encoder, resolution),
+ 'worker': worker_name,
'feeder': feeder,
'properties': {
'bitrate': bitrate,
@@ -170,10 +174,14 @@ for format in transcode.keys():
feeder = 'raw-input:audio'
audio_encoder = 'encode-%s-%i-%i' % (encoder, bitrate, samplerate)
if audio_encoder not in flow['encoder_audio']:
+ worker_name = 'encoder-%s-%s' % (encoder, bitrate)
+ if worker_name not in worker:
+ raise SystemExit("ERROR: worker '%s' is not assigned to any machine!!" % worker_name)
+ worker[worker_name] = True
flow['encoder_audio'][audio_encoder] = {
'type': '%s-encode' % encoder,
'desc': "%s encoder for %i kbit/s @ %i Hz" % (encoder, bitrate, samplerate),
- 'worker': 'encoder-%s-%s' % (encoder, bitrate),
+ 'worker': worker_name,
'feeder': feeder,
'properties': {
'bitrate': bitrate,
@@ -181,10 +189,14 @@ for format in transcode.keys():
}
muxer = globals['formats'][format]['muxer']
+ worker_name = 'muxer-%s-%s' % (format, profile)
+ if worker_name not in worker:
+ raise SystemExit("ERROR: worker '%s' is not assigned to any machine!!" % worker_name)
+ worker[worker_name] = True
flow['muxer']['muxer-%s-%s' % (format, profile)] = {
'type': '%s-mux' % muxer,
'desc': "%s muxer profile %s" % (format, profile),
- 'worker': 'muxer-%s' % muxer,
+ 'worker': worker_name,
'feeder_audio': audio_encoder,
'feeder_video': video_encoder,
'properties': {},
@@ -204,7 +216,7 @@ for cluster in stream.keys():
if machine in machines:
if 'porter' in machines[machine]:
if port in machines[machine]['porter']:
- raise SystemExit("ERROR: porter cannot be created machine %s already uses port %i" % (machine, port))
+ raise SystemExit("ERROR: porter cannot be created because machine '%s' already uses port %i" % (machine, port))
else:
machines[machine]['porter'] = {}
else:
@@ -216,6 +228,9 @@ for cluster in stream.keys():
'password': rand_string(size=12),
}
+ if stream_worker not in worker:
+ raise SystemExit("ERROR: worker '%s' is not assigned to any machine!!" % stream_worker)
+ worker[stream_worker] = True
atmosphere['porter-%s-%i'%(machine, port)] = {
'type': "porter",
'desc': "Porter for %s on port %i"%(machine, port),
@@ -272,6 +287,11 @@ for cluster in stream.keys():
flow['streamer'][name]['properties']['burst-on-connect'] = 'true'
flow['streamer'][name]['properties']['burst-time'] = stream[cluster][prop]
+### sanity checks, cont'd #######################################
+
+for w in worker:
+ if not worker[w]:
+ print("WARNING: worker '%s' is not used" % w)
### initialize and render templates #############################
#