1
|
|
|
""" |
2
|
|
|
Enarksh |
3
|
|
|
|
4
|
|
|
Copyright 2013-2016 Set Based IT Consultancy |
5
|
|
|
|
6
|
|
|
Licence MIT |
7
|
|
|
""" |
8
|
|
|
from enarksh.message.Message import Message |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
class LogFileMessage(Message): |
12
|
|
|
""" |
13
|
|
|
Message type for notifying the logger that a log file is available for storing into the database. |
14
|
|
|
""" |
15
|
|
|
MESSAGE_TYPE = 'logger:LogFileMessage' |
16
|
|
|
""" |
17
|
|
|
The message type. |
18
|
|
|
|
19
|
|
|
:type: str |
20
|
|
|
""" |
21
|
|
|
|
22
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
23
|
|
|
def __init__(self, rnd_id, name, total_size, filename1, filename2): |
24
|
|
|
""" |
25
|
|
|
Object constructor. |
26
|
|
|
|
27
|
|
|
:param int rnd_id: The ID of the run node. |
28
|
|
|
:param str name: The name of he output: |
29
|
|
|
- 'out' for stdout |
30
|
|
|
- 'err' for stderr |
31
|
|
|
:param int total_size: The total size in bytes of the log. |
32
|
|
|
:param str|None filename1: The name of the file where the first chunk of the log is stored. |
33
|
|
|
:param str|None filename2: The name of the file where the last chunk of the log is stored. |
34
|
|
|
""" |
35
|
|
|
Message.__init__(self, LogFileMessage.MESSAGE_TYPE) |
36
|
|
|
|
37
|
|
|
self.rnd_id = rnd_id |
38
|
|
|
""" |
39
|
|
|
The ID of the run node. |
40
|
|
|
|
41
|
|
|
:type: int |
42
|
|
|
""" |
43
|
|
|
|
44
|
|
|
self.name = name |
45
|
|
|
""" |
46
|
|
|
The name of he output: |
47
|
|
|
- 'out' for stdout |
48
|
|
|
- 'err' for stderr |
49
|
|
|
|
50
|
|
|
:type: str |
51
|
|
|
""" |
52
|
|
|
|
53
|
|
|
self.total_size = total_size |
54
|
|
|
""" |
55
|
|
|
The total size in bytes of the log. |
56
|
|
|
|
57
|
|
|
:type: int |
58
|
|
|
""" |
59
|
|
|
|
60
|
|
|
self.filename1 = filename1 |
61
|
|
|
""" |
62
|
|
|
The name of the file where the first chunk of the log is stored. |
63
|
|
|
|
64
|
|
|
:type: str |
65
|
|
|
""" |
66
|
|
|
|
67
|
|
|
self.filename2 = filename2 |
68
|
|
|
""" |
69
|
|
|
The name of the file where the last chunk of the log is stored. |
70
|
|
|
|
71
|
|
|
:type: str |
72
|
|
|
""" |
73
|
|
|
|
74
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
75
|
|
|
def send_message(self, end_point): |
76
|
|
|
""" |
77
|
|
|
Sends the message to an end point. |
78
|
|
|
|
79
|
|
|
:param str end_point: The end point. |
80
|
|
|
|
81
|
|
|
:rtype: None |
82
|
|
|
""" |
83
|
|
|
self.message_controller.send_message(end_point, self) |
84
|
|
|
|
85
|
|
|
# ---------------------------------------------------------------------------------------------------------------------- |
86
|
|
|
|