From d6c0d55de94753b2f2da55efa5beb1de028733ca Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 11 Feb 2018 11:37:39 +0100 Subject: formatting cleanup --- src/flufigut.py | 63 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 29 deletions(-) (limited to 'src/flufigut.py') diff --git a/src/flufigut.py b/src/flufigut.py index ad2bfc4..5bdff0a 100755 --- a/src/flufigut.py +++ b/src/flufigut.py @@ -93,7 +93,8 @@ class Description: search_string = pattern if '*' in pattern: if '*' in pattern[:-1]: - raise Exception("invalid worker pattern '%s' in worker '%s' component globs may only have a single '*' at the end)" % (pattern, worker)) + raise Exception("invalid worker pattern '%s' in worker '%s' component globs may only have a single '*' at the end)" + % (pattern, worker)) is_prefix = True search_string = pattern[:-1] @@ -215,7 +216,8 @@ class Planet: if pattern.is_prefix: if comp_name.startswith(search_string): if len(search_string) == match_prefix_len: - raise Exception("component '%s': both patterns '%s' of worker '%s' and '%s' of worker '%s' match the component name and have the same length" % + raise Exception("""component '%s': both patterns '%s' of worker '%s' and '%s' of worker '%s' + match the component name and have the same length""" % (comp_name, match.pattern, match.worker, pattern.pattern, pattern.worker)) elif len(search_string) > match_prefix_len: match_prefix_len = len(search_string) @@ -449,15 +451,16 @@ class Planet: return comp_name def __set_stream_mux_instance_props(self, comp_name, stream, port, mount_point, hostname_next): + next_url = "http://%s:%i%s" % (hostname_next, port, mount_point) for prop in stream: if prop == 'max-con': self.flow['streamers'][comp_name]['properties']['client-limit'] = stream[prop] if hostname_next: - self.flow['streamers'][comp_name]['properties']['redirect-on-overflow'] = "http://%s:%i%s" % (hostname_next, port, mount_point) + self.flow['streamers'][comp_name]['properties']['redirect-on-overflow'] = next_url if prop == 'max-bw': self.flow['streamers'][comp_name]['properties']['bandwidth-limit'] = stream[prop] if hostname_next: - self.flow['streamers'][comp_name]['properties']['redirect-on-overflow'] = "http://%s:%i%s" % (hostname_next, port, mount_point) + self.flow['streamers'][comp_name]['properties']['redirect-on-overflow'] = next_url if prop == 'burst-on-connect': self.flow['streamers'][comp_name]['properties']['burst-on-connect'] = 'true' self.flow['streamers'][comp_name]['properties']['burst-time'] = stream[prop] @@ -469,7 +472,8 @@ class Planet: self.flow['streamers'][comp_name]['plugs']['rrd'] = {} self.flow['streamers'][comp_name]['plugs']['rrd']['clients'] = "%s/%s_clients.rrd" % ( self._desc.globals['stats']['rrd']['directory'], comp_name) - self.flow['streamers'][comp_name]['plugs']['rrd']['bytes'] = "%s/%s_bytes.rrd" % (self._desc.globals['stats']['rrd']['directory'], comp_name) + self.flow['streamers'][comp_name]['plugs']['rrd']['bytes'] = "%s/%s_bytes.rrd" % ( + self._desc.globals['stats']['rrd']['directory'], comp_name) if 'sfive' in self._desc.globals['stats']: self.flow['streamers'][comp_name]['plugs']['sfive'] = {} @@ -500,7 +504,8 @@ class Planet: self.flow['streamers'][comp_name] = { 'type': "%s-stream" % stream['type'], - 'desc': "%s streamer for %s %s-%s (part %i of %i in %s cluster)" % (stream['type'], mux, format, profile, idx + 1, cnt, stream_name), + 'desc': "%s streamer for %s %s-%s (part %i of %i in %s cluster)" % ( + stream['type'], mux, format, profile, idx + 1, cnt, stream_name), 'worker': str(self.__get_worker(comp_name)), 'feeder': feeder, 'properties': { @@ -724,29 +729,29 @@ if __name__ == '__main__': print("- " + c) sys.exit(1) - # print("****************************************************") - # print("** atmosphere **") - # print("**") - # __pp.pprint(p.atmosphere) - # print("**") - # print("**************************") - # print("** planet **") - # print("**") - # __pp.pprint(p.flow) - # print("**") - # print("**************************") - # print("** _workers_ **") - # print("**") - # __pp.pprint(p.workers) - # print("**") - # print("****************************************************") - - k8s = K8sDeployment(d, p) - print("wiping exisiting namespace ...") - k8s.wipe() - print("deploying new planet ...") - k8s.deploy('../templates') - print("done.") + print("****************************************************") + print("** atmosphere **") + print("**") + __pp.pprint(p.atmosphere) + print("**") + print("**************************") + print("** planet **") + print("**") + __pp.pprint(p.flow) + print("**") + print("**************************") + print("** _workers_ **") + print("**") + __pp.pprint(p.workers) + print("**") + print("****************************************************") + + # k8s = K8sDeployment(d, p) + # print("wiping exisiting namespace ...") + # k8s.wipe() + # print("deploying new planet ...") + # k8s.deploy('../templates') + # print("done.") except Exception as e: print("ERROR: while running app: %s" % e) -- cgit v1.2.3