def lxd(self, image, runtime): container, launching_time = lxc.launch("edvgui/%s-hello-world" % image, ["-e"]) response, execution_time = lxc.exec(container, ["/bin/echo", "Hello World"]) if 'Hello World' not in response: print("Error (lxc): wrong response: " + response) lxc.kill(container) return [launching_time + execution_time]
def lxd(self, image, runtime): container, creation = lxc.init("edvgui/%s-hello-world" % image, ["-e", "--profile", "default"]) start = lxc.start(container) response, execution_time = lxc.exec(container, ["/bin/echo", "Hello World"]) lxc.kill(container) if 'Hello World' not in response: print("Error (lxc): wrong response: " + response) return -1 return [creation, creation + start, creation + start + execution_time]
def lxd(self, image, runtime): container, creation = lxc.init("edvgui/%s-db-write-%s" % (image, self.size), ["-e", "--profile", "default"]) start = lxc.start(container) response, execution_time = lxc.exec(container, ["./sqlite.sh", "tpcc.db", "write.sqlite"]) lxc.kill(container) if 'Done' not in response: print("Error (lxc): wrong response: " + response) return -1 return [creation, creation + start, creation + start + execution_time]
def lxd(self, image, runtime): address = "127.0.0.1:3000" container, creation = lxc.init("edvgui/%s-http-server" % image, ["-e", "--profile", "default", "--profile", "online", "--profile", "server-3000"]) start = lxc.start(container) response, execution = lxc.exec(container, ["/usr/sbin/lighttpd", "-f", "/etc/lighttpd/lighttpd.conf"]) result = server_get("http://" + address) lxc.kill(container) return [creation, creation + start, creation + start + execution, creation + start + execution + result] if result != -1 else -1
def lxd(self, image, runtime): container, launching_time = lxc.launch( "edvgui/%s-ping" % image, ["-e", "--profile", "default", "--profile", "online"]) for i in range(0, 10): try: response, _ = lxc.exec(container, ["./ping.sh", "10"]) except lxc.LXCApiException: pass else: lxc.kill(container) if '=' not in response: print('Error (lxc): wrong response: ' + response) return -1 else: return [float(response.split(" ")[3].split("/")[1]) / 1000] time.sleep(1) lxc.kill(container) print('Error (lxc): maximum retry reached') return -1