Пример #1
0
    def start(self):
        """Starts the service.
        """
        if not self.model_deployment:
            self.skil.printer.pprint(
                "No model deployed yet, call 'deploy()' on a model first.")
        else:
            self.skil.api.model_state_change(
                self.deployment.id,
                self.model_deployment.id,
                skil_client.SetState("start")
            )

            self.skil.printer.pprint(">>> Starting to serve model...")
            while True:
                time.sleep(5)
                model_state = self.skil.api.model_state_change(
                    self.deployment.id,
                    self.model_deployment.id,
                    skil_client.SetState("start")
                ).state
                if model_state == "started":
                    time.sleep(15)
                    self.skil.printer.pprint(
                        ">>> Model server started successfully!")
                    break
                else:
                    self.skil.printer.pprint(">>> Waiting for deployment...")
Пример #2
0
 def stop(self):
     """Stops the service.
     """
     # TODO: test this
     self.skil.api.model_state_change(
         self.deployment.id,
         self.model_deployment.id,
         skil_client.SetState("stop")
     )
Пример #3
0
 def stop(self):
     # TODO: test this
     self.skil.api.model_state_change(self.deployment.id,
                                      self.model_deployment.id,
                                      skil_client.SetState("stop"))
Пример #4
0
 def stop(self):
     """Stops the service.
     """
     self.skil.api.model_state_change(self.deployment.id,
                                      self.model_entity.id,
                                      skil_client.SetState("stop"))