Skip to content

Commit

Permalink
Merge branch 'master' into simplify_data_in
Browse files Browse the repository at this point in the history
  • Loading branch information
rowleya authored Jul 22, 2024
2 parents d540b8a + 8b0e819 commit b6a8516
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 28 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/python_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ jobs:
call:
uses: SpiNNakerManchester/SupportScripts/.github/workflows/python_checks.yml@main
with:
base-package: spinnman

dependencies: SpiNNUtils SpiNNMachine
test_directories: unittests spinnman_integration_tests
coverage-package: spinnman
flake8-packages: spinnman unittests spinnman_integration_tests
secrets: inherit
pylint-packages: spinnman
mypy-packages: spinnman unittests spinnman_integration_tests
secrets: inherit
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.mypy]
exclude = ["doc", "setup.py", "unittests", "quick_tests"]
exclude = ["doc", "setup.py", "quick_tests"]
8 changes: 7 additions & 1 deletion spinnman/spalloc/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,13 @@ def renew(self) -> JsonObject:
self.__login_form_url, r.status_code)
m = csrf_matcher.search(r.text)
if not m:
raise SpallocException("could not establish temporary session")
msg = ("Could not establish temporary session to "
f"{self._service_url} for user {self.__username} ")
if self.__password is None:
msg += "with a no password"
else:
msg += f"with a {len(self.__password)} character password."
raise SpallocException(msg)
csrf = m.group(1)
session = r.cookies[_SESSION_COOKIE]

Expand Down
14 changes: 12 additions & 2 deletions spinnman/spalloc/spalloc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""
Implementation of the client for the Spalloc web service.
"""
import os
import time
from logging import getLogger

Expand Down Expand Up @@ -108,12 +109,21 @@ def __init__(
location; if so, the ``username`` and ``password`` arguments
*must* be ``None``. If ``username`` and ``password`` are not given,
not even within the URL, the ``bearer_token`` must be not ``None``.
:param str username: The user name to use
:param str password: The password to use
:param str username:
The user name to use. If not provided nor in service_url
environment variable SPALLOC_USER will be used.
:param str password:
The password to use. If not provided nor in service_url
environment variable SPALLOC_PASSWORD will be used.
:param str bearer_token: The bearer token to use
"""
if username is None and password is None:
service_url, username, password = parse_service_url(service_url)
if username is None:
username = os.getenv("SPALLOC_USER", None)
if password is None:
password = os.getenv("SPALLOC_PASSWORD", None)

self.__session: Optional[Session] = Session(
service_url, username, password, bearer_token)
obj = self.__session.renew()
Expand Down
24 changes: 7 additions & 17 deletions spinnman/spinnman.cfg
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
# Adds or overwrites values in SpiNNMachine/spinn_machine/spinn_machine.cfg
# Which in turn adds or overwrites values in SpiNNUtils/spinn_utilities/spinn_utilities.cfg
# DO NOT EDIT!
# The are the default values
# Edit the cfg in your home directory to change your preferences
# Add / Edit a cfg in the run directory for script specific changes

# Adds to values in SpiNNMachine/spinn_machine/spinn_machine.cfg
# Which in turn adds values in SpiNNUtils/spinn_utilities/spinn_utilities.cfg

# This is a place holder for any future SpiNNMan level cfg settings
[Machine]
# machine name is typically a URL and then version is required
machine_name = None

# When True if any non ethernet chip claims it has a IP address this is logged and ignored
# When False the whole chip is removed
ignore_bad_ethernets = True
report_waiting_logs = False
turn_off_machine = False

# format is:
# bmp_names = <host>[/(<board-range>|board_id[,board_id]*)
# <board_range> = <board_id>-<board_id>
# where:
# <host> is the hostname or IP address of the BMP
# <board_range> is a range of boards that the BMP can speak to
# <board_id> is the ID of a single board in a frame
# Note this no longer supports multiple host nor cabinet or frame
bmp_names = None

auto_detect_bmp = False
6 changes: 1 addition & 5 deletions spinnman_integration_tests/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import unittest

from spinn_utilities.config_holder import set_config
Expand All @@ -29,12 +28,9 @@ def setUp(self):
set_config("Machine", "version", FIVE)
self.spalloc_url = "https://spinnaker.cs.man.ac.uk/spalloc"
self.spalloc_machine = "SpiNNaker1M"
self.spalloc_user = os.environ["SPALLOC_USER"]
self.spalloc_password = os.environ["SPALLOC_PASSWORD"]

def test_create_job(self):
client = SpallocClient(
self.spalloc_url, self.spalloc_user, self.spalloc_password)
client = SpallocClient(self.spalloc_url)
# job = client.create_job_rect_at_board(
# WIDTH, HEIGHT, triad=(x, y, b), machine_name=SPALLOC_MACHINE,
# max_dead_boards=1)
Expand Down

0 comments on commit b6a8516

Please sign in to comment.