Module supervisor :: Class Supervisor
[hide private]
[frames] | no frames]

type Supervisor

source code

object --+
         |
        Supervisor

Class used to globally check accesses from device threads and verify result correctness.

Instance Methods [hide private]
 
__init__(self, testcase, die_on_error=True)
!!! This is not part of the assignment API, do not call it !!!
source code
 
register_banned_thread(self, thread=None)
!!! This is not part of the assignment API, do not call it !!!
source code
 
check_execution(self, method, device)
!!! This is not part of the assignment API, do not call it !!!
source code
 
check_termination(self)
!!! This is not part of the assignment API, do not call it !!!
source code
 
validate(self, crt_timepoint)
!!! This is not part of the assignment API, do not call it !!!
source code
 
report(self, message, die_on_error=None)
!!! This is not part of the assignment API, do not call it !!!
source code
List of String
status(self)
!!! This is not part of the assignment API, do not call it !!!
source code
 
__compute_neighbour_ids(self, device_id, time_point) source code
List of device.Device
get_neighbours(self, device_id)
!!! This is not part of the assignment API, do not call it !!!
source code
Integer
run_testcase(self)
!!! This is not part of the assignment API, do not call it !!!
source code
Static Methods [hide private]
 
__setup_devices(setup_event, device, neighbours) source code
 
__send_scripts(device, scripts, delay, wait) source code
 
__send_end(device, wait, count) source code
Method Details [hide private]

__init__(self, testcase, die_on_error=True)
(Constructor)

source code 

!!! This is not part of the assignment API, do not call it !!!

Create a new supervisor for the test case.

Parameters:
  • testcase (testcase.TestCase) - the test to supervise
  • die_on_error (Boolean) - true for the test to be killed on first error
Overrides: object.__init__

register_banned_thread(self, thread=None)

source code 

!!! This is not part of the assignment API, do not call it !!!

Registers a tester thread. This thread must not be used by devices for any method execution.

Parameters:
  • thread (Thread) - the thread

check_execution(self, method, device)

source code 

!!! This is not part of the assignment API, do not call it !!!

Check device execution.

Parameters:
  • method (String) - the name of the checked method
  • device (device.Device) - the device which is checked

check_termination(self)

source code 

!!! This is not part of the assignment API, do not call it !!!

Checks for correct device shutdown. There must not be any active device threads.

validate(self, crt_timepoint)

source code 

!!! This is not part of the assignment API, do not call it !!!

Validates the current state of the data.

report(self, message, die_on_error=None)

source code 

!!! This is not part of the assignment API, do not call it !!!

Reports an error message. All messages are stored in a list for retrieval at the end of the test.

Parameters:
  • message (String) - the error message to log

status(self)

source code 

!!! This is not part of the assignment API, do not call it !!!

Returns the list of logged error messages.

Returns: List of String
the list of encountered errors

get_neighbours(self, device_id)

source code 

!!! This is not part of the assignment API, do not call it !!!

Returns the list of neighbours for device_id for the current timepoint, and increments the timepoint for the next invocation. This method is wrapped by Runtime. WARNING: this method is not thread-safe and must not be called concurrently with the same device_id.

Parameters:
  • device_id (Integer) - the id of the device for which neighbours must be returned
Returns: List of device.Device
the list of neighbours for the current timepoint

run_testcase(self)

source code 

!!! This is not part of the assignment API, do not call it !!!

Runs the test case by creating the devices, unblocking the script assignment and waiting for device termination.

Returns: Integer
the number of errors