Beispiel #1
0
    def get_solution_name(self):
        self._threebot_start()
        valid = False

        while not valid:
            self.solution_name = self.string_ask(self.CREATE_NAME_MESSAGE,
                                                 required=True,
                                                 field="name",
                                                 is_identifier=True)
            threebot_solutions = list_threebot_solutions(
                self.solution_metadata["owner"])
            valid = True
            for sol in threebot_solutions:
                if sol["name"] == self.solution_name:
                    valid = False
                    self.md_show(
                        "The specified 3Bot name already exists. please choose another name."
                    )
                    break
                valid = True

            if valid and self._existing_3bot():
                valid = False
                self.md_show(
                    f"The specified 3Bot name was deployed before. Please go to the previous step and enter a new name."
                )

        self.backup_model = BACKUP_MODEL_FACTORY.get(
            f"{self.solution_name}_{self.threebot_name}")
Beispiel #2
0
    def get_solution_name(self):
        self.md_show_update("Starting The Chatflow")
        self._threebot_start()

        threebot_solutions = list_threebot_solutions(
            self.solution_metadata["owner"])
        threebot_solutions_names = [
            threebot["name"] for threebot in threebot_solutions
        ]
        not_valid_name = True
        while not_valid_name:
            self.solution_name = self.string_ask(
                self.CREATE_NAME_MESSAGE,
                required=True,
                field="name",
                is_identifier=True,
                not_exist=["3Bot", threebot_solutions_names],
            )
            if self._existing_3bot():
                self.md_show(
                    f"The specified 3Bot name was deployed before. Please go to the previous step and enter a new name."
                )
            else:
                not_valid_name = False

        self.backup_model = BACKUP_MODEL_FACTORY.get(
            f"{self.solution_name}_{self.threebot_name}")
Beispiel #3
0
 def wait_for_threebot_state(self, threebot_name, status, timeout=300):
     now = j.data.time.now().timestamp
     while j.data.time.now().timestamp < now + timeout:
         threebot = [
             threebot for threebot in list_threebot_solutions(self.tname)
             if threebot["name"] == threebot_name
         ][0]
         if not threebot:
             raise j.exceptions.Runtime(
                 f"Couldn't find threebot {threebot_name}")
         if threebot["state"] == status.value:
             return True
         sleep(2)
     return False
Beispiel #4
0
 def choose_name(self):
     self._init_solution()
     self.branch = "development"
     all_3bot_solutions = list_threebot_solutions(self.threebot_name)
     self.stoped_3bots = [
         threebot for threebot in all_3bot_solutions
         if threebot["state"] == ThreebotState.STOPPED.value
     ]
     self.stopped_names = {
         threebot["name"]: threebot
         for threebot in self.stoped_3bots
     }
     self.name = self.kwargs["tname"]
     self.threebot_info = self.stopped_names[self.name]
     self.pool_id = self.threebot_info["compute_pool"]
Beispiel #5
0
 def choose_name(self):
     self._init_solution()
     all_3bot_solutions = list_threebot_solutions(self.threebot_name)
     self.non_running_3bots = [
         threebot for threebot in all_3bot_solutions if threebot["state"] not in [ThreebotState.RUNNING.value]
     ]
     self.non_running_names = {threebot["name"]: threebot for threebot in self.non_running_3bots}
     self.name = self.kwargs["tname"]
     self.threebot_info = self.non_running_names[self.name]
     self.pool_id = self.threebot_info["compute_pool"]
     self.query = {
         "cru": self.threebot_info["cpu"],
         "mru": self.threebot_info["memory"] / 1024,
         "sru": self.threebot_info["disk_size"] / 1024,
     }
Beispiel #6
0
 def choose_name(self):
     self.expiration = 10 * 60  # 10 minutes for 3bot
     self.retry = True
     self._init_solution()
     all_3bot_solutions = list_threebot_solutions(self.threebot_name)
     self.stoped_3bots = [
         threebot for threebot in all_3bot_solutions
         if threebot["state"] == ThreebotState.STOPPED.value
     ]
     self.stopped_names = {
         threebot["name"]: threebot
         for threebot in self.stoped_3bots
     }
     self.name = self.kwargs["tname"]
     self.threebot_info = self.stopped_names[self.name]
     self.pool_id = self.threebot_info["compute_pool"]
Beispiel #7
0
 def choose_name(self):
     self._init_solution()
     self.expiration = 10 * 60  # 10 minutes for 3bot
     self.retry = True
     all_3bot_solutions = list_threebot_solutions(self.threebot_name)
     self.stopped_3bots = [
         threebot for threebot in all_3bot_solutions if threebot["state"] == ThreebotState.STOPPED.value
     ]
     self.stopped_names = {threebot["name"]: threebot for threebot in self.stopped_3bots}
     self.name = self.kwargs["tname"]
     self.threebot_info = self.stopped_names[self.name]
     self.pool_id = self.threebot_info["compute_pool"]
     self.query = {
         "cru": self.threebot_info["cpu"],
         "mru": self.threebot_info["memory"] / 1024,
         "sru": self.threebot_info["disk_size"] / 1024,
     }
Beispiel #8
0
 def choose_name(self):
     self._init_solution()
     self.branch = "development"
     all_3bot_solutions = list_threebot_solutions(self.threebot_name)
     self.stopped_3bots = [
         threebot for threebot in all_3bot_solutions if threebot["state"] == ThreebotState.STOPPED.value
     ]
     self.stopped_names = {threebot["name"]: threebot for threebot in self.stopped_3bots}
     self.name = self.kwargs["tname"]
     self.threebot_info = self.stopped_names[self.name]
     self.pool_id = self.threebot_info["compute_pool"]
     self.query = {
         "cru": self.threebot_info["cpu"] + 1,
         "mru": self.threebot_info["memory"] / 1024 + 1,
         "sru": self.threebot_info["disk_size"] / 1024 + 0.25,
     }
     self.retry = True
Beispiel #9
0
def list_threebots() -> str:
    user_info = j.data.serializers.json.loads(get_user_info())
    threebots = list_threebot_solutions(user_info["username"])
    return j.data.serializers.json.dumps({"data": threebots})