gitea workflows: added missing dependency imports, remove redundant mlbox_logic test, update workdflows and bec_worker due to local import
This commit is contained in:
1 parent
7f6bd788e2
commit
c9463583bc
6 files changed
+66
-50
No files matched your search
+23
-8
@@ -1,14 +1,15 @@
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from typing import Optional, Iterable
|
||||
from typing import Optional, Iterable, TYPE_CHECKING, Any
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
import time
|
||||
|
||||
from aarelcinfer_client.models import LatestPredictionModel
|
||||
if TYPE_CHECKING:
|
||||
from aarelcinfer_client.models import LatestPredictionModel
|
||||
else:
|
||||
LatestPredictionModel = Any
|
||||
|
||||
from aare.common.aarelc_infer import AareLCInferWrapper
|
||||
from aare.common.beamline import MXBeamline
|
||||
from aare.common.models import MLBoxModel, MLOutputModel, MLBoxType, BoundingBoxModel
|
||||
from aare.common.logger_config import setup_logger
|
||||
@@ -47,23 +48,37 @@ class MLBundle:
|
||||
|
||||
|
||||
class MlBox:
|
||||
|
||||
RETRY_COUNT = 3
|
||||
RETRY_SLEEP_S = 0.1
|
||||
|
||||
def __init__(self, bl: MXBeamline, wrapper=None):
|
||||
"""
|
||||
wrapper:
|
||||
Optional injected inference wrapper for tests.
|
||||
If None, the production wrapper is created lazily.
|
||||
"""
|
||||
self.__beamline = bl
|
||||
|
||||
if wrapper is not None:
|
||||
self.__wrapper = wrapper
|
||||
return
|
||||
|
||||
def __init__(self, bl:MXBeamline): #mx-aare-test.psi.ch, mx-ml.psi.ch
|
||||
if bl == MXBeamline.SIMULATED:
|
||||
raise NotImplementedError(f"MLBox bundle mode not implemented for {bl}")
|
||||
|
||||
elif bl == MXBeamline.X06DA:
|
||||
raise NotImplementedError(f"MLBox bundle mode not implemented for {bl}")
|
||||
|
||||
elif bl == MXBeamline.X10SA:
|
||||
# Lazy import keeps module importable without external client installed
|
||||
from aare.common.aarelc_infer import AareLCInferWrapper
|
||||
self.__wrapper = AareLCInferWrapper(bl)
|
||||
self.__beamline = bl
|
||||
|
||||
elif bl == MXBeamline.X06SA:
|
||||
raise NotImplementedError(f"MLBox bundle mode not implemented for {bl}")
|
||||
|
||||
else:
|
||||
raise Exception(f"unknown beamline {bl}")
|
||||
raise ValueError(f"unknown beamline {bl}")
|
||||
|
||||
@staticmethod
|
||||
def _decode_bundle_image(jpeg_bytes: bytes | None) -> np.ndarray | None:
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from aare.common.models import StagePositionEnum
|
||||
from aare.daq.devices import BeamlineDevices
|
||||
from aare.daq.config import BeamlineConfig, ABR_POS_MOUNT
|
||||
from pxii_bec.macros.planner import BeamlineState
|
||||
|
||||
from aare.devices.area_detector import AutoEnum
|
||||
from aare.common.logger_config import setup_logger
|
||||
from aare.devices.bec_worker import BeamlineState
|
||||
|
||||
logger = setup_logger("aareDAQ")
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from enum import Enum
|
||||
|
||||
from bec_ipython_client import BECIPythonClient
|
||||
from bec_ipython_client.signals import OperationMode
|
||||
from bec_lib.service_config import ServiceConfig
|
||||
from bec_lib.procedures.helper import FrontendProcedureHelper, BackendProcedureHelper
|
||||
from pxii_bec.macros.planner import BeamlineState
|
||||
from aare.common.beamline import MXBeamline, mx_beamline
|
||||
|
||||
|
||||
@@ -23,6 +24,20 @@ from aare.common.beamline import MXBeamline, mx_beamline
|
||||
def bec_exception_handler(exception: Exception):
|
||||
print(f"Exception: {exception}")
|
||||
|
||||
|
||||
class BeamlineState(str, Enum):
|
||||
ROBOT_SAMPLE_EXCHANGE = "robot_sample_exchange"
|
||||
SAMPLE_ALIGNMENT = "sample_alignment"
|
||||
DATA_COLLECTION = "data_collection"
|
||||
DC_XRF = "DC_XRF"
|
||||
MANUAL_SAMPLE_EXCHANGE = "manual_sample_exchange"
|
||||
BEAM_VISUALISATION = "beam_visualisation"
|
||||
FLUX_MEASUREMENT = "flux_measurement"
|
||||
BEAMSTOP_ALIGNMENT = "beamstop_alignment"
|
||||
MAINTENANCE = "maintenance"
|
||||
XTAL_SNAPSHOT = "xtal_snapshot"
|
||||
|
||||
|
||||
class BECClientWorker:
|
||||
def __init__(self, beamline:MXBeamline, name:str = "default"):
|
||||
BEAMLINE = beamline.value.lower()
|
||||
|
||||
Reference in new issue
Block a user