Skip to content

Use new version of ansys-api-speos & docker image speos-rpc (23r2) #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.4"
services:
optics_speos-rpc:
image: ghcr.io/pyansys/pyoptics/speos-rpc:2023.2.0.305
image: ghcr.io/pyansys/pyoptics/speos-rpc:2023.2.0.666
container_name: optics_speos-rpc
ports:
- "50051:50051"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ classifiers=[
dependencies=[
"grpcio==1.51.3",
"grpcio-tools==1.48.2",
"ansys-api-speos==0.1.0",
"ansys-api-speos==1.0.0",
]

[project.optional-dependencies]
Expand Down
11 changes: 5 additions & 6 deletions tests/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@
def test_job():
# Stubs creations for Simulations
simu_manager_stub = grpc_stub.get_stub_insecure_channel(
target="localhost:50051",
stub_type=simulation__v1__pb2_grpc.SpeosSimulationsManagerStub,
target="localhost:" + str(config.get("SpeosServerPort")),
stub_type=simulation__v1__pb2_grpc.SimulationsManagerStub,
)
simu_stub = grpc_stub.get_stub_insecure_channel(
target="localhost:50051",
target="localhost:" + str(config.get("SpeosServerPort")),
stub_type=simulation__v1__pb2_grpc.SpeosSimulationStub,
)
# Stubs creations for Jobs
job_manager_stub = grpc_stub.get_stub_insecure_channel(
target="localhost:50051",
target="localhost:" + str(config.get("SpeosServerPort")),
stub_type=job__v1__pb2_grpc.SpeosJobsManagerStub,
)
job_stub = grpc_stub.get_stub_insecure_channel(
target="localhost:50051",
target="localhost:" + str(config.get("SpeosServerPort")),
stub_type=job__v1__pb2_grpc.SpeosJobStub,
)

Expand Down Expand Up @@ -85,7 +85,6 @@ def test_job():
job_information = job_stub.GetInformation(job__v1__pb2.GetInformation_Request(guid=job_create_res.guid))
assert job_information.title == "Direct Simulation Processing"
assert job_information.name == "ASSEMBLY1.DS (0)"
assert job_information.progress < 1 # progress < 1 because job was stopped

# Get results
get_results_res = job_stub.GetResults(job__v1__pb2.GetResults_Request(guid=job_create_res.guid))
Expand Down
35 changes: 11 additions & 24 deletions tests/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_simulation():
# Stub on simulation manager
simulation_manager_stub = grpc_stub.get_stub_insecure_channel(
target="localhost:" + str(config.get("SpeosServerPort")),
stub_type=simulation__v1__pb2_grpc.SpeosSimulationsManagerStub,
stub_type=simulation__v1__pb2_grpc.SimulationsManagerStub,
)

# Stub on simulation
Expand All @@ -50,12 +50,6 @@ def test_simulation():

simulation_stub.Load(load_request)

# GetName
get_name_request = simulation__v1__pb2.GetName_Request()
get_name_request.guid = guid_simu.guid
get_name_response = simulation_stub.GetName(get_name_request)
assert get_name_response.name == "ASSEMBLY1.DS (0)"

# Delete simulation
delete_request = simulation__v1__pb2.Delete_Request()
delete_request.guid = guid_simu.guid
Expand All @@ -65,15 +59,15 @@ def test_simulation():
def test_simu_allocateSyst_load_run_with_file_transfer():
# Stubs creations
file_transfer_stub = grpc_stub.get_stub_insecure_channel(
target="localhost:50051",
target="localhost:" + str(config.get("SpeosServerPort")),
stub_type=file_transfer__v1__pb2_grpc.FileTransferServiceStub,
)
simu_manager_stub = grpc_stub.get_stub_insecure_channel(
target="localhost:50051",
stub_type=simulation__v1__pb2_grpc.SpeosSimulationsManagerStub,
target="localhost:" + str(config.get("SpeosServerPort")),
stub_type=simulation__v1__pb2_grpc.SimulationsManagerStub,
)
simu_stub = grpc_stub.get_stub_insecure_channel(
target="localhost:50051",
target="localhost:" + str(config.get("SpeosServerPort")),
stub_type=simulation__v1__pb2_grpc.SpeosSimulationStub,
)

Expand All @@ -100,15 +94,15 @@ def test_simu_allocateSyst_load_run_with_file_transfer():
def test_simu_allocateSyst_load_save_with_file_transfer():
# Stubs creations
file_transfer_stub = grpc_stub.get_stub_insecure_channel(
target="localhost:50051",
target="localhost:" + str(config.get("SpeosServerPort")),
stub_type=file_transfer__v1__pb2_grpc.FileTransferServiceStub,
)
simu_manager_stub = grpc_stub.get_stub_insecure_channel(
target="localhost:50051",
stub_type=simulation__v1__pb2_grpc.SpeosSimulationsManagerStub,
target="localhost:" + str(config.get("SpeosServerPort")),
stub_type=simulation__v1__pb2_grpc.SimulationsManagerStub,
)
simu_stub = grpc_stub.get_stub_insecure_channel(
target="localhost:50051",
target="localhost:" + str(config.get("SpeosServerPort")),
stub_type=simulation__v1__pb2_grpc.SpeosSimulationStub,
)
sv5_name = "LG_50M_Colorimetric_short.sv5"
Expand All @@ -134,20 +128,13 @@ def test_simu_allocateSyst_load_save_with_file_transfer():
# And Save
simu_stub.Save(simulation__v1__pb2.Save_Request(guid=create_res.guid, input_folder_path=reserve_res.uri))

# We can then list dependencies of the reserved item to check that it contains two deps with correct names
deps_response = file_transfer_stub.ListDependencies(
file_transfer__v1__pb2.ListDependencies_Request(uri=reserve_res.uri)
)
assert len(deps_response.dependency_infos) == 2
assert [dep_info for dep_info in deps_response.dependency_infos if dep_info.file_name == blue_spectrum]
assert [dep_info for dep_info in deps_response.dependency_infos if dep_info.file_name == red_spectrum]

# And download locally the simu saved - using download_folder helper provided within ansys.api.speos.file.v1
# Download locally the simu saved - using download_folder helper provided within ansys.api.speos.file.v1
download_loc = os.path.join(local_test_path, "download_simu")
os.mkdir(download_loc)
download_responses = file_transfer.download_folder(
file_transfer_service_stub=file_transfer_stub, main_file_uri=reserve_res.uri, download_location=download_loc
)

# Check that file are well downloaded
for res in download_responses:
downloaded_file = os.path.join(download_loc, res.info.file_name)
Expand Down