feat: 添加了正交基模式
This commit is contained in:
@@ -16,7 +16,7 @@ class ModelBasicParametersUnit(BaseModel):
|
||||
range: List[Union[float,int,str,bool]]
|
||||
|
||||
class ModelBasicInfo(BaseModel):
|
||||
base_url = "http://localhost:8105/api/v1"
|
||||
base_url: str = Field(default="http://localhost:8105/api/v1")
|
||||
nports: int = Field(default=2)
|
||||
cell_name: str
|
||||
template_name: str
|
||||
@@ -82,6 +82,7 @@ class ModelBasic:
|
||||
parameters_list.append({parameters_name[i]:res[i] for i in range(len(res))})
|
||||
|
||||
for res in parameters_list:
|
||||
print(f"Simulating with parameters: {res}")
|
||||
request_unit = SimulationRequestUnit(
|
||||
user_id=self.info.user_id,
|
||||
template_name=self.info.template_name,
|
||||
@@ -125,21 +126,26 @@ class ModelBasic:
|
||||
|
||||
simulation_response_model:SimulationResponseUnit = SimulationResponseUnit(**(response[0]))
|
||||
|
||||
time.sleep(0.01)
|
||||
time.sleep(0.05)
|
||||
|
||||
response = send_get_request(f"{self.info.base_url}/simulations/input_hash/{simulation_response_model.input_hash}")
|
||||
|
||||
assert isinstance(response, dict), "Response is not a dictionary."
|
||||
uuid_model = UuidResponseUnit(**response)
|
||||
|
||||
|
||||
time.sleep(0.01) # Wait for 2 seconds before checking the status again
|
||||
time.sleep(0.05) # Wait for 2 seconds before checking the status again
|
||||
|
||||
status = uuid_model.status
|
||||
while status != "completed" and status != "failed":
|
||||
time.sleep(0.01) # Wait for 2 seconds before checking again
|
||||
time.sleep(0.05) # Wait for 2 seconds before checking again
|
||||
response = send_get_request(f"{self.info.base_url}/simulations/input_hash/{simulation_response_model.input_hash}")
|
||||
assert isinstance(response, dict), "Response is not a dictionary."
|
||||
uuid_model = UuidResponseUnit(**response)
|
||||
try:
|
||||
uuid_model = UuidResponseUnit(**response)
|
||||
except Exception as e:
|
||||
print(f"Error parsing response: {e}")
|
||||
continue
|
||||
assert response is not None, "No response received from the server."
|
||||
status = uuid_model.status
|
||||
|
||||
|
||||
Reference in New Issue
Block a user