diff --git a/spinnman/spalloc/spalloc_client.py b/spinnman/spalloc/spalloc_client.py index cd2758d4a..1563406b5 100644 --- a/spinnman/spalloc/spalloc_client.py +++ b/spinnman/spalloc/spalloc_client.py @@ -457,8 +457,8 @@ def __init__(self, session, job_handle): self.__proxy_thread = None self.__proxy_ping = None - @overrides(SpallocJob._write_session_credentials_to_db) - def _write_session_credentials_to_db(self, cur): + @overrides(SpallocJob.get_session_credentials_for_db) + def get_session_credentials_for_db(self): config = {} config["SPALLOC", "service uri"] = self._service_url config["SPALLOC", "job uri"] = self._url @@ -471,10 +471,7 @@ def _write_session_credentials_to_db(self, cur): # We never write the auth headers themselves; we just extend the # session del headers["Authorization"] - cur.executemany(""" - INSERT INTO proxy_configuration(kind, name, value) - VALUES(?, ?, ?) - """, [(k1, k2, v) for (k1, k2), v in config.items()]) + return config @overrides(SpallocJob.get_state) def get_state(self): diff --git a/spinnman/spalloc/spalloc_job.py b/spinnman/spalloc/spalloc_job.py index 3ed3edd16..e9afaef95 100644 --- a/spinnman/spalloc/spalloc_job.py +++ b/spinnman/spalloc/spalloc_job.py @@ -194,17 +194,13 @@ def where_is_machine(self, x: int, y: int) -> Tuple[int, int, int]: """ @abstractmethod - def _write_session_credentials_to_db(self, cur: Cursor): + def get_session_credentials_for_db(self): """ - Write the session credentials for the job to the database accessed by - the given cursor. + Get the session credentials for the job to be written into a database .. note:: May assume that there is a ``proxy_configuration`` table with ``kind``, ``name`` and ``value`` columns. - - :param ~sqlite3.Cursor cur: - The open cursor to the database. """ def __enter__(self):