station_server
- class ochra.manager.station.station_server.StationServer(name, location, station_type, logging_path='.', station_ip='0.0.0.0', station_port=8000)
Bases:
objectA class to represent the station server.
Initialize the StationServer instance.
- Parameters:
name (str) – Unique name of the station for identification and frontend connection.
location (Location) – Physical or logical location of the station.
station_type (StationType) – Type of the station.
logging_path (str, optional) – Directory path for logging. Defaults to current directory.
station_ip (str, optional) – IP address to bind the server. Defaults to “0.0.0.0”.
station_port (int, optional) – Port to run the server on. Defaults to 8000.
- add_device(device)
add a device to the station dict
- Parameters:
device (Device) – device to add to the station
- Return type:
None
- async get_device(request, device_id)
get the device html page
- Parameters:
request (Request) – fastapi request object
device_id (str) – id of the device to get the view for
- Returns:
the device html page
- Return type:
HTMLResponse
- async get_device_view(request, device_id)
get the device view html page
- Parameters:
request (Request) – fastapi request object
device_id (str) – id of the device to get the view for
- Returns:
the device view html page
- Return type:
HTMLResponse
- async get_pannel(request)
get the station side pannel html page
- Parameters:
request (Request) – fastapi request object
- Returns:
the station side pannel html page
- Return type:
HTMLResponse
- async get_station(request)
get the station html page
- Parameters:
request (Request) – fastapi request object
- Returns:
the station html page
- Return type:
HTMLResponse
- async get_station_devices(request)
get the station devices html page
- Parameters:
request (Request) – fastapi request object
- Returns:
the station devices html page
- Return type:
HTMLResponse
- property id
- async perform_device_operation(request, device_id)
perform a device operation from the UI
- Parameters:
request (Request) – fastapi request object
device_id (str) – id of the device to perform the operation on
- Return type:
None
- ping()
- process_op(op)
Processes an operation by retrieving the target device or station and executing the specified method.
- Parameters:
op (Operation) – The operation to be processed.
- Raises:
HTTPException – If the entity type or device is not found, or if the station is locked by another user.
- Return type:
None
- run()
start the server
- setup(lab_ip=None)
setup the station server and connect to the lab server if lab_ip is provided
- Parameters:
lab_ip (str, optional) – ip of the lab server connection. Defaults to None.
- Return type:
None
- shutdown()
Shutdown the station server and remove its entry from the lab server.
- Returns:
HTTP status code indicating success (200).
- Return type:
int
- pydantic model ochra.manager.station.station_server.operationExecute
Bases:
BaseModelCreate a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- field args: Dict | None = None
- field deviceName: str [Required]
- field operation: str [Required]