• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SpiNNakerManchester / SpiNNMan / 6574804013

19 Oct 2023 12:47PM UTC coverage: 51.937% (+1.2%) from 50.777%
6574804013

Pull #327

github

Christian-B
typing changes
Pull Request #327: Type Annotations and Checking

105 of 1288 branches covered (0.0%)

Branch coverage included in aggregate %.

2375 of 2375 new or added lines in 180 files covered. (100.0%)

4775 of 8108 relevant lines covered (58.89%)

0.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

61.9
/spinnman/messages/scp/impl/set_power.py
1
# Copyright (c) 2015 The University of Manchester
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
6
#
7
#     https://www.apache.org/licenses/LICENSE-2.0
8
#
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
# See the License for the specific language governing permissions and
13
# limitations under the License.
14

15
import logging
1✔
16
from spinn_utilities.log import FormatAdapter
1✔
17
from spinn_utilities.overrides import overrides
1✔
18
from spinnman.messages.scp.abstract_messages import (
1✔
19
    AbstractSCPRequest, BMPRequest, BMPOKResponse)
20
from spinnman.messages.scp.abstract_messages.bmp_request import Boards
1✔
21
from spinnman.messages.scp.enums import SCPCommand, PowerCommand
1✔
22
from spinnman.messages.scp import SCPRequestHeader
1✔
23

24
logger = FormatAdapter(logging.getLogger(__name__))
1✔
25

26

27
class SetPower(BMPRequest[BMPOKResponse]):
1✔
28
    """
29
    An SCP request for the BMP to power on or power off a rack of boards.
30
    """
31
    __slots__ = ()
1✔
32

33
    def __init__(
1✔
34
            self, power_command: PowerCommand, boards: Boards, *,
35
            delay=0.0, board_to_send_to=0):
36
        """
37
        .. note::
38
            There is currently a bug in the BMP that means some boards don't
39
            respond to power commands not sent to BMP 0. Thus changing the
40
            board_to_send_to parameter is not recommended!
41

42
        :param PowerCommand power_command: The power command being sent
43
        :param boards: The boards on the same backplane to power on or off
44
        :type boards: int or list(int)
45
        :param float delay:
46
            Number of seconds delay between power state changes of
47
            the different boards.
48
        :param int board_to_send_to:
49
            The optional board to send the command to if this is to be sent
50
            to a frame of boards.
51

52
            .. note::
53
                Leave this at the default because of hardware bugs.
54
        """
55
        if board_to_send_to != 0:
×
56
            logger.warning(
×
57
                "There is currently a bug in the BMP that means some boards"
58
                " don't respond to power commands not sent to BMP 0.  Thus "
59
                "changing the board_to_send_to is not recommended!")
60

61
        arg1 = (int(delay * 1000) << 16) | power_command.value
×
62
        arg2 = self.get_board_mask(boards)
×
63

64
        super().__init__(
×
65
            board_to_send_to,
66
            SCPRequestHeader(command=SCPCommand.CMD_BMP_POWER),
67
            argument_1=arg1, argument_2=arg2)
68

69
    @overrides(AbstractSCPRequest.get_scp_response)
1✔
70
    def get_scp_response(self) -> BMPOKResponse:
1✔
71
        return BMPOKResponse("powering request", SCPCommand.CMD_BMP_POWER)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc