Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/schema/queue.py: 100%

36 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 -*- 

3from marshmallow import Schema, fields 

4from daiquiri.core.schema.validators import Any 

5 

6import logging 

7 

8logger = logging.getLogger(__name__) 

9 

10 

11class QueueItemSchema(Schema): 

12 args = fields.Dict(metadata={"description": "Arguments passed to the queue item"}) 

13 cls = fields.Str( 

14 metadata={"description": "The class of which this is an instance of"} 

15 ) 

16 desc = fields.Str(metadata={"description": "Description of the item"}) 

17 name = fields.Str(metadata={"description": "Name of the item"}) 

18 running = fields.Bool(metadata={"description": "Whether the queue item is running"}) 

19 uid = fields.Str(metadata={"description": "The unique identifier"}) 

20 created = fields.Float(metadata={"description": "Time added to queue"}) 

21 started = fields.Float(metadata={"description": "Time started"}) 

22 finished = fields.Float(metadata={"description": "Time finished"}) 

23 estimate = fields.Float(metadata={"description": "Estimated time required"}) 

24 status = fields.Str() 

25 stdout = fields.Str() 

26 

27 

28class QueueStatusSchema(Schema): 

29 running = fields.Bool(metadata={"description": "Whether the queue is running"}) 

30 ready = fields.Bool( 

31 metadata={"description": "Whether the queue is ready to process"} 

32 ) 

33 stack = fields.Nested( 

34 QueueItemSchema, 

35 many=True, 

36 metadata={"description": "A list of queue items in the stack"}, 

37 ) 

38 current = fields.Nested( 

39 QueueItemSchema, metadata={"description": "The currently running queue item"} 

40 ) 

41 all = fields.Nested( 

42 QueueItemSchema, 

43 many=True, 

44 metadata={"description": "A list of all queue items"}, 

45 ) 

46 pause_on_fail = fields.Bool( 

47 metadata={"description": "Whether to pause the queue if an actor fails"} 

48 ) 

49 

50 

51class ChangeQueueStatusSchema(Schema): 

52 state = fields.Bool(required=True, metadata={"description": "The new queue state"}) 

53 

54 

55class ChangeQueueSettingSchema(Schema): 

56 setting = fields.Str( 

57 required=True, metadata={"description": "The new queue setting"} 

58 ) 

59 value = Any(required=True, metadata={"description": "The queue setting value"}) 

60 

61 

62class MoveQueueItemSchema(Schema): 

63 uid = fields.Str(metadata={"description": "The queue item uuid"}) 

64 position = fields.Int(metadata={"description": "The new position"}) 

65 

66 

67class ClearQueueItemsSchema(Schema): 

68 finished = fields.Bool(metadata={"description": "Clear the finished queue items"}) 

69 

70 

71class KillQueueSchema(Schema): 

72 stop = fields.Bool( 

73 metadata={"description": "Whether to Stop the queue if an actor is killed"} 

74 )