diff --git a/pyproject.toml b/pyproject.toml index 8754da95..ca6e43ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ad_sdl.wei" -version = "0.6.1" +version = "0.6.2" description = "The Rapid Prototyping Laboratory's Workflow Execution Interface." authors = [ {name = "Rafael Vescovi", email = "ravescovi@anl.gov"}, diff --git a/src/ui/src/components/Workflow.vue b/src/ui/src/components/Workflow.vue index 56dd1291..e2456c7a 100644 --- a/src/ui/src/components/Workflow.vue +++ b/src/ui/src/components/Workflow.vue @@ -57,7 +57,7 @@ const data_headers = [ ] -props.steps.forEach((step : any)=> { test.value[step.id] = {}; if(step.result.data) +props.steps.forEach((step : any)=> { test.value[step.id] = {}; if(step.result && step.result.data) {Object.keys(step.result.data).forEach(async (key: string) => { let val = await ((await fetch( "http://".concat(window.location.host).concat("/runs/data/").concat(step.result.data[key]).concat("/info"))).json()) diff --git a/src/wei/core/state_manager.py b/src/wei/core/state_manager.py index 1f37e4e4..b47a158c 100644 --- a/src/wei/core/state_manager.py +++ b/src/wei/core/state_manager.py @@ -53,6 +53,7 @@ def _redis_client(self) -> Any: port=int(Config.redis_port), db=0, decode_responses=True, + password=Config.redis_password if Config.redis_password else None, ) return self._redis_connection diff --git a/src/wei/types/workcell_types.py b/src/wei/types/workcell_types.py index dbf396ac..33f6a308 100644 --- a/src/wei/types/workcell_types.py +++ b/src/wei/types/workcell_types.py @@ -80,6 +80,9 @@ class WorkcellConfig(BaseModel, extra="allow"): default="localhost", description="Hostname for the Redis server" ) redis_port: int = Field(default=6379, description="Port for the Redis server") + redis_password: str = Field( + default="", description="Password for the Redis server, if any" + ) data_directory: PathLike = Field( default=Path.home() / ".wei", description="Directory to store data produced by WEI", diff --git a/tests/test_module/test_rest_node.py b/tests/test_module/test_rest_node.py index c5983094..dabcacfa 100644 --- a/tests/test_module/test_rest_node.py +++ b/tests/test_module/test_rest_node.py @@ -2,6 +2,7 @@ REST-based node that interfaces with WEI and provides various fake actions for testing purposes """ +import time from typing import Annotated from fastapi import UploadFile @@ -190,41 +191,9 @@ def synthesize( ) -> StepResponse: """Synthesizes a sample using specified amounts `foo` and `bar` according to file `protocol`""" - # Read the uploaded protocol file content (not used further in this example) - protocol_content = protocol.file.read().decode("utf-8") - print(protocol_content) - - # Retrieve the plate resource - plate = state.resource_interface.get_resource( - resource_name="Plate0", module_name=state.module_name - ) - - if not plate: - return StepResponse.step_failed("Plate0 resource not found") - - try: - # Update specific wells - state.resource_interface.update_plate_well(plate, "A1", 80.0) # Set A1 to 80 - # Safely retrieve well 'B1' quantity before modification - well_B1_quantity = state.resource_interface.get_well_quantity(plate, "B1") - state.resource_interface.update_plate_well( - plate, "B1", well_B1_quantity - 1 - ) # Decrease B1 by 'bar' - - # Update the entire contents of wells, setting C1 to well capacity - state.resource_interface.update_plate_contents( - plate, {"C1": plate.well_capacity} - ) - - # Set D1 well to zero - state.resource_interface.update_plate_well(plate, "D1", 0.0) - - all_plates = state.resource_interface.get_all_resources(PlateTable) - print("All Plates in the database:", all_plates) - return StepResponse.step_succeeded() - - except Exception as e: - return StepResponse.step_failed(f"Failed to synthesize: {e}") + state.foobar = foo + bar + time.sleep(5) + return StepResponse.step_succeeded() @test_rest_node.action( @@ -267,10 +236,10 @@ def measure_action(state: State, action: ActionRequest) -> StepResponse: all_collections = state.resource_interface.get_all_resources(CollectionTable) print("All Collections in the database:", all_collections) # Return the success response with the generated files - # return StepResponse.step_succeeded( - # files={"test_file": "test.txt", "test2_file": "test2.txt"}, - # data={"test": {"test": "test"}}, - # ) + return StepResponse.step_succeeded( + files={"test_file": "test.txt", "test2_file": "test2.txt"}, + data={"test": {"test": "test"}}, + ) return StepResponse.step_succeeded() else: