| Total Complexity | 3 |
| Total Lines | 57 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | """ |
||
| 11 | class PossibleNodeActionsWebMessage(Message): |
||
| 12 | """ |
||
| 13 | Message type for requesting all possible node actions for a run node made through the web application. |
||
| 14 | """ |
||
| 15 | MESSAGE_TYPE = 'controller:PossibleNodeActionsWebMessage' |
||
| 16 | """ |
||
| 17 | The message type. |
||
| 18 | |||
| 19 | :type: str |
||
| 20 | """ |
||
| 21 | |||
| 22 | # ------------------------------------------------------------------------------------------------------------------ |
||
| 23 | def __init__(self, sch_id, rnd_id): |
||
| 24 | """ |
||
| 25 | Object constructor. |
||
| 26 | |||
| 27 | :param int sch_id: The ID of the schedule. |
||
| 28 | :param int rnd_id: The ID of the run node. |
||
| 29 | """ |
||
| 30 | Message.__init__(self, PossibleNodeActionsWebMessage.MESSAGE_TYPE) |
||
| 31 | |||
| 32 | self.sch_id = sch_id |
||
| 33 | """ |
||
| 34 | The ID of the schedule. |
||
| 35 | |||
| 36 | :type: int |
||
| 37 | """ |
||
| 38 | |||
| 39 | self.rnd_id = rnd_id |
||
| 40 | """ |
||
| 41 | The ID of the run node. |
||
| 42 | |||
| 43 | :type: int |
||
| 44 | """ |
||
| 45 | |||
| 46 | # ------------------------------------------------------------------------------------------------------------------ |
||
| 47 | @staticmethod |
||
| 48 | def create_from_json(message): |
||
| 49 | """ |
||
| 50 | Object constructor using JSON encoded message. |
||
| 51 | |||
| 52 | :param * message: The message. |
||
| 53 | |||
| 54 | :rtype: enarksh.controller.message.PossibleNodeActionsWebMessage.PossibleNodeActionsWebMessage |
||
| 55 | """ |
||
| 56 | return PossibleNodeActionsWebMessage(int(message['sch_id']), int(message['rnd_id'])) |
||
| 57 | |||
| 58 | # ------------------------------------------------------------------------------------------------------------------ |
||
| 59 | def send_message(self, end_point): |
||
| 60 | """ |
||
| 61 | Sends the message to an end point. |
||
| 62 | |||
| 63 | :param str end_point: The end point. |
||
| 64 | |||
| 65 | :rtype: None |
||
| 66 | """ |
||
| 67 | self.message_controller.send_message(end_point, self) |
||
| 68 | |||
| 70 |