Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/hardware/abstract/procedure.py: 0%

23 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-14 02:13 +0000

1#!/usr/bin/env python 

2# -*- coding: utf-8 -*- 

3 

4from marshmallow import fields 

5from daiquiri.core.hardware.abstract import HardwareObject 

6from daiquiri.core.schema.hardware import HardwareSchema 

7from daiquiri.core.schema.validators import OneOf 

8from daiquiri.core.schema.validators import RequireEmpty 

9 

10import logging 

11 

12logger = logging.getLogger(__name__) 

13 

14ProcedureStates = [ 

15 "STANDBY", 

16 "DISABLED", 

17 "RUNNING", 

18 "ABORTING", 

19 "AWAITING_USER_INPUT", 

20 "UNKNOWN", 

21] 

22 

23 

24class ProcedurePropertiesSchema(HardwareSchema): 

25 state = OneOf(ProcedureStates, metadata={"readOnly": True}) 

26 previous_run_state = fields.String() 

27 previous_run_exception = fields.String() 

28 parameters = fields.Dict() 

29 

30 

31class ProcedureCallablesSchema(HardwareSchema): 

32 start = RequireEmpty() 

33 abort = RequireEmpty() 

34 clear = RequireEmpty() 

35 validate = fields.Dict(allow_none=True) 

36 

37 

38class Procedure(HardwareObject): 

39 _type = "procedure" 

40 _state_ok = ["STANDBY", "RUNNING"] 

41 

42 _properties = ProcedurePropertiesSchema() 

43 _callables = ProcedureCallablesSchema()