summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2012-10-11 22:57:48 +0200
committerChristian Pointner <equinox@spreadspace.org>2012-10-11 22:57:48 +0200
commita8b6da3e5aac872852bfc6b7a6759a19ed372297 (patch)
tree0c47ee07ebd86841c61ba168a44958c14ecdbf8f /src
parentrenamed worker variable (diff)
improved error messages
added check for duplicate worker added check for existing input worker
Diffstat (limited to 'src')
-rwxr-xr-xsrc/flufigut.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/flufigut.py b/src/flufigut.py
index a27060e..c80c1b0 100755
--- a/src/flufigut.py
+++ b/src/flufigut.py
@@ -43,7 +43,7 @@ def rand_string(size=8, chars=string.ascii_lowercase + string.ascii_uppercase +
### parse json file #############################################
#
if len(sys.argv) <= 2:
- raise SystemExit("No template name and or configuration file given")
+ raise SystemExit("ERROR: No template name and or configuration file given")
cf = open(sys.argv[2], 'r')
config = json.load(cf);
@@ -61,13 +61,20 @@ flow = {}
### sanity checks ###############################################
machines = {}
-# TODO:
-# - worker<->machine only 1:1
-# - list of workers (mark usage later)
+worker = {}
+
+for machine in globals['machines']:
+ for w in globals['machines'][machine]:
+ if w in worker:
+ raise SystemExit("ERROR: worker '%s' is assigned to more than one machine!!" % w)
+ else:
+ worker[w] = False
### generate input components ###################################
flow['input'] = {}
+if 'input' not in worker:
+ raise SystemExit("ERROR: worker 'input' is not assigned to any machine!!")
flow['input']['raw-input'] = {
'type': input['source'],
'desc': "capture raw AV from %s" % input['source'],
@@ -84,7 +91,6 @@ for property in input.keys():
elif property != 'source':
flow['input']['raw-input']['properties'][property] = input[property]
-
samplerates = [ ]
resolutions = [ ]
for format in transcode.keys():
@@ -98,7 +104,7 @@ for format in transcode.keys():
if resolution not in resolutions:
if input['resolution'] != resolution:
if globals['resolutions'][resolution]['rate'] != globals['resolutions'][input['resolution']]['rate']:
- raise SystemExit("video rate conversion is not yet supported!!!")
+ raise SystemExit("ERROR: video rate conversion is not yet supported!!!")
resolutions.append(resolution)
for resolution in resolutions:
@@ -198,7 +204,7 @@ for cluster in stream.keys():
if machine in machines:
if 'porter' in machines[machine]:
if port in machines[machine]['porter']:
- raise SystemExit("Porter: machine %s already uses port %i" % (machine, port))
+ raise SystemExit("ERROR: porter cannot be created machine %s already uses port %i" % (machine, port))
else:
machines[machine]['porter'] = {}
else: