def compile(self): try: # Compile algorithm api_response = self.client.manageApi.algorithms_username_algoname_compile_post(self.username, self.algoname) return api_response except ApiException as e: error_message = json.loads(e.body)["error"]["message"] raise ApiError(error_message)
def get_build_logs(self, build_id): # Get the algorithm build logs for a given build_id try: api_response = self.client.manageApi.get_algorithm_build_logs(self.username, self.algoname, build_id) return api_response except ApiException as e: error_message = json.loads(e.body)["error"]["message"] raise ApiError(error_message)
def info(self, algo_hash=None): try: # Get Algorithm if algo_hash: api_response = self.client.manageApi.get_algorithm_hash_version(self.username, self.algoname, algo_hash) else: api_response = self.client.manageApi.get_algorithm(self.username, self.algoname) return api_response except ApiException as e: error_message = json.loads(e.body)["error"]["message"] raise ApiError(error_message)
def versions(self, limit=None, marker=None, published=None, callable=None): kwargs = {} bools = ["True", "False"] if limit: kwargs["limit"] = limit if marker: kwargs["marker"] = marker if published: p = published kwargs["published"] = str(p).lower() if str(p) in bools else p if callable: c = callable kwargs["callable"] = str(c).lower() if str(c) in bools else c try: # Get Algorithm versions api_response = self.client.manageApi.get_algorithm_versions(self.username, self.algoname, **kwargs) return api_response except ApiException as e: error_message = json.loads(e.body)["error"]["message"] raise ApiError(error_message)