Example #1
0
 def __init__(self, host, port, params):
     Thread.__init__(self)
     self.host = host
     self.port = port
     self.params = params
     self._terminated = False
     self.deployment = Deployment(self, params, host, port)
Example #2
0
class Controller(Thread):
    def __init__(self, host, port, params):
        Thread.__init__(self)
        self.host = host
        self.port = port
        self.params = params
        self._terminated = False
        self.deployment = Deployment(self, params, host, port)

    def run(self):

        self.deployment.start()

        while not self._terminated:
            print("[INFO] ControllerThread is running.")
            time.sleep(2)
        print("[INFO] Exiting from ControllerThread.")

    def terminate(self):
        self._terminated = True
        self.deployment.terminate()
Example #3
0
    def CreateDeployment(self, info):
        print("Creating deployment...")

        #Check if the deployment label already exists
        if any(x for x in self.GetDeployments()
               if x.deploymentLabel == info[0]):
            print("Cannot add deployment, deployment with label", info[0],
                  "already exists.")
        else:
            #Create deployment
            deployment = Deployment(info)

            #Add to deployment list
            self.GetDeployments().append(deployment)

            print("Done. Current deployments =",
                  len(self.GetDeployments()),
                  sep=' ')
Example #4
0
 def deployment(self):
     """ The Deployment object for this server """
     assert self._deployment_href
     from Deployment import Deployment
     return Deployment(self._deployment_href, self.rsapi)