3737from spinnman .model import P2PTable
3838from spinnman .processes .get_version_process import GetVersionProcess
3939from spinnman .messages .sdp .sdp_flag import SDPFlag
40- from spinnman .messages .scp .impl .read_memory import _SCPReadMemoryResponse
40+ from spinnman .messages .scp .impl .read_memory import Response
4141from spinnman .messages .spinnaker_boot import SystemVariableDefinition
4242from spinnman .connections .udp_packet_connections \
4343 import SCAMPConnection , BootConnection
5151
5252from spinn_utilities .overrides import overrides
5353
54- from spalloc .job import Job
55- from spalloc .states import JobState
54+ from spinnman .config_setup import unittest_setup
55+ from spinnman .spalloc import SpallocClient , SpallocState
56+ from spinn_utilities .config_holder import set_config
5657
5758from spinn_machine .machine import Machine
5859
@@ -136,7 +137,7 @@ def __init__(self, x, y, variable, size=None):
136137
137138 @overrides (AbstractSCPRequest .get_scp_response )
138139 def get_scp_response (self ):
139- return _SCPReadMemoryResponse ()
140+ return Response ()
140141
141142
142143class ReadNetinitPhaseProcess (AbstractMultiConnectionProcess ):
@@ -428,7 +429,7 @@ def __init__(self, width, height):
428429 def run (self ):
429430 matplotlib .rcParams ['toolbar' ] = 'None'
430431 self ._fig , self ._ax = pyplot .subplots ()
431- self ._fig .canvas .set_window_title ("SpiNNaker" )
432+ self ._fig .canvas .manager . set_window_title ("SpiNNaker" )
432433 self ._image = self ._ax .imshow (
433434 self ._image_data , origin = "lower" )
434435 self ._text = self ._ax .text (
@@ -530,12 +531,12 @@ def close(self):
530531
531532 def run (self , core_counter , job , save , load ):
532533 job_connections = list ()
533- for (x , y ), ip_address in iteritems (job .connections ):
534+ for (x , y ), ip_address in iteritems (job .get_connections () ):
534535 job_connections .append ((x , y , ip_address ))
535536 job_connections .sort (key = operator .itemgetter (0 , 1 ))
536537 with job :
537538 warn ("Waiting for user to start process" )
538- core_counter .wait_until_ready ()
539+ # core_counter.wait_until_ready()
539540 warn ("Process starting" )
540541
541542 # Get a list of connections to the machine and start a thread for
@@ -569,7 +570,7 @@ def run(self, core_counter, job, save, load):
569570 tries = 3
570571 while not self ._done and not boot_done and tries > 0 :
571572 warn ("Booting machine" , boot_connection .remote_ip_address )
572- boot_messages = SpinnakerBootMessages (board_version = 5 )
573+ boot_messages = SpinnakerBootMessages ()
573574 for boot_message in boot_messages .messages :
574575 boot_connection .send_boot_message (boot_message )
575576 time .sleep (2.0 )
@@ -668,6 +669,8 @@ def wait_for_state_change(self, state):
668669
669670if __name__ == "__main__" :
670671 logging .basicConfig (level = logging .INFO )
672+ unittest_setup ()
673+ set_config ("Machine" , "version" , "5" )
671674
672675 save = False
673676 load = False
@@ -688,20 +691,23 @@ def wait_for_state_change(self, state):
688691 print (job .width , job .height )
689692 close_file (load_file )
690693 else :
691- job = Job (1200 , hostname = "spinn-test.cs.man.ac.uk" ,
692- owner = "SpiNNaker Start" )
694+ client = SpallocClient ("https://spinnaker.cs.man.ac.uk/spalloc" )
695+ job = client .create_job (
696+ num_boards = 2 , machine_name = "SpiNNaker1M" )
693697 try :
694- job .wait_for_state_change (JobState .queued )
698+ job .wait_until_ready ()
699+ txrx = job .create_transceiver ()
700+ dims = txrx ._get_machine_dimensions ()
695701 if save :
696702 save_file = open_file ("record/job.dat" , "wb" )
697703 save_file .write (struct .pack (
698- "<III" , job .width , job .height , len (job .connections )))
704+ "<III" , dims .width , dims .height , len (job .connections )))
699705 for (x , y ), _ in iteritems (job .connections ):
700706 save_file .write (struct .pack ("<II" , x , y ))
701707 close_file (save_file )
702708
703709 # Create GUI
704- core_counter = CoreCounter (job .width , job .height )
710+ core_counter = CoreCounter (dims .width , dims .height )
705711
706712 # Run task in thread
707713 main_thread = MainThread (core_counter , job , save , load )
0 commit comments