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

40 statements  

« prev     ^ index     » next       coverage.py v7.6.5, created at 2024-11-15 02:12 +0000

1#!/usr/bin/env python 

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

3from marshmallow import Schema, fields 

4 

5from daiquiri.core.schema.component import ComponentSchema 

6from daiquiri.core.schema.validators import OneOf 

7 

8 

9class TaskSchema(Schema): 

10 status = OneOf(["reserved", "pending", "running"]) 

11 name = fields.Str() 

12 id = fields.Str() 

13 time_start: fields.Float() 

14 args = fields.List(fields.Raw()) 

15 kwargs = fields.Dict() 

16 

17 

18class WorkersSchema(Schema): 

19 host = fields.Str() 

20 stats = fields.Dict() 

21 tasks = fields.Nested(TaskSchema, many=True) 

22 

23 

24class TaskConfigSchema(Schema): 

25 actor = fields.Str(required=True) 

26 description = fields.Str() 

27 

28 

29class ExecutedTasksSchema(Schema): 

30 job_id = fields.Str() 

31 name = fields.Str() 

32 received = fields.Int() 

33 started = fields.Int() 

34 finished = fields.Int() 

35 status = fields.Str() 

36 args = fields.Str() 

37 kwargs = fields.Str() 

38 result = fields.Field() 

39 uris = fields.Dict() 

40 exception = fields.Str() 

41 traceback = fields.Str() 

42 

43 

44class CeleryConfigSchema(ComponentSchema): 

45 ewoks_config = fields.Str() 

46 broker_url = fields.Str() 

47 backend_url = fields.Str() 

48 broker_dlq = fields.Bool() 

49 broker_queue = fields.Str() 

50 beamline_queue = fields.Str() 

51 monitor = fields.Bool() 

52 ewoks_events_backend_url = fields.Str() 

53 tasks = fields.Nested(TaskConfigSchema, many=True)