Пример #1
0
 def podman(self, image, runtime):
     options = ["--network", "none"]
     if runtime is not None:
         options.extend(["--runtime", runtime])
     container, creation = podman.create("edvgui/%s-hello-world" % image, options=options)
     _, start = podman.start(container)
     response, execution = podman.exec(container, ["/bin/echo", "Hello World"])
     podman.kill(container)
     podman.rm(container)
     if 'Hello World' not in response:
         print('Error (podman): wrong response: ' + response)
         return -1
     return [creation, creation + start, creation + start + execution]
Пример #2
0
 def podman(self, image, runtime):
     address = "127.0.0.1:3000"
     options = ["-p", address + ":80"]
     if runtime is not None:
         options.extend(["--runtime", runtime])
     container, creation = podman.create("edvgui/%s-http-server" % image, options=options)
     _, start = podman.start(container)
     _, execution = podman.exec(container, ["/usr/sbin/lighttpd", "-f", "/etc/lighttpd/lighttpd.conf"])
     result = server_get("http://" + address)
     podman.kill(container)
     podman.rm(container)
     return [creation, creation + start, creation + start + execution,
             creation + start + execution + result] if result != -1 else -1
Пример #3
0
 def podman(self, image, runtime):
     options = ["--network", "none"]
     if runtime is not None:
         options.extend(["--runtime", runtime])
     container, creation = podman.create("edvgui/%s-db-write-%s" % (image, self.size), options=options)
     _, start = podman.start(container)
     response, execution = podman.exec(container, ["/run/run.sh", "/home/tpcc.db", "/run/write.sqlite"])
     podman.kill(container)
     podman.rm(container)
     if 'Done' not in response:
         print("Error (podman): wrong response: " + response)
         return -1
     return [creation, creation + start, creation + start + execution]