Exemple #1
0
    def assert_on_master(self):
        """Make sure that this is the master processor and not a slave.

        @raises Exception:  If not on the master processor.
        """

        raise_unimplemented(self.assert_on_master)
Exemple #2
0
    def assert_on_master(self):
        """Make sure that this is the master processor and not a slave.

        @raises Exception:  If not on the master processor.
        """

        raise_unimplemented(self.assert_on_master)
Exemple #3
0
    def master_receive_result(self):
        """Slave to master processor data transfer - receive the result command from the slave.

        This is invoked by the master processor.

        @return:        The result command sent by the slave.
        @rtype:         Result_command instance
        """

        raise_unimplemented(self.master_receive_result)
Exemple #4
0
    def master_receive_result(self):
        """Slave to master processor data transfer - receive the result command from the slave.

        This is invoked by the master processor.

        @return:        The result command sent by the slave.
        @rtype:         Result_command instance
        """

        raise_unimplemented(self.master_receive_result)
Exemple #5
0
    def rank(self):
        """Get the rank of this processor - an abstract method.

        The rank of the processor should be a number between 0 and n where n is the number of slave
        processors, the rank of 0 is reserved for the master processor.

        @return:    The rank of the processor.
        @rtype:     int
        """

        raise_unimplemented(self.rank)
Exemple #6
0
    def return_object(self, result):
        """Return a result to the master processor from a slave - an abstract method.

        @param result:  A result to be returned to the master processor.
        @type result:   Result_string, Result_command or Exception instance

        @see:   multi.processor.Result_string.
        @see:   multi.processor.Resulf_command.
        """

        raise_unimplemented(self.return_object)
Exemple #7
0
    def rank(self):
        """Get the rank of this processor - an abstract method.

        The rank of the processor should be a number between 0 and n where n is the number of slave
        processors, the rank of 0 is reserved for the master processor.

        @return:    The rank of the processor.
        @rtype:     int
        """

        raise_unimplemented(self.rank)
Exemple #8
0
    def return_object(self, result):
        """Return a result to the master processor from a slave - an abstract method.

        @param result:  A result to be returned to the master processor.
        @type result:   Result_string, Result_command or Exception instance

        @see:   multi.processor.Result_string.
        @see:   multi.processor.Resulf_command.
        """

        raise_unimplemented(self.return_object)
Exemple #9
0
    def master_queue_command(self, command, dest):
        """Slave to master processor data transfer - send the result command from the slave.

        This is invoked by the slave processor.


        @param command: The results command to send to the master.
        @type command:  Results_command instance
        @param dest:    The destination processor's rank.
        @type dest:     int
        """

        raise_unimplemented(self.master_queue_command)
Exemple #10
0
    def master_queue_command(self, command, dest):
        """Slave to master processor data transfer - send the result command from the slave.

        This is invoked by the slave processor.


        @param command: The results command to send to the master.
        @type command:  Results_command instance
        @param dest:    The destination processor's rank.
        @type dest:     int
        """

        raise_unimplemented(self.master_queue_command)
Exemple #11
0
    def get_name(self):
        """Get the name of the current processor - an abstract method.

        The string should identify the current master or slave processor uniquely but is purely for
        information and debugging. For example the mpi implementation uses the string
        <host-name>-<process-id> whereas the thread implementation uses the id of the current thread
        as provided by python.

        @return:    The processor identifier.
        @rtype:     str
        """

        raise_unimplemented(self.get_name)
Exemple #12
0
    def get_name(self):
        """Get the name of the current processor - an abstract method.

        The string should identify the current master or slave processor uniquely but is purely for
        information and debugging. For example the mpi implementation uses the string
        <host-name>-<process-id> whereas the thread implementation uses the id of the current thread
        as provided by python.

        @return:    The processor identifier.
        @rtype:     str
        """

        raise_unimplemented(self.get_name)
Exemple #13
0
    def get_intro_string(self):
        """Get a string describing the multi processor - designed for overriding.

        The string should be suitable for display at application startup and should be less than 100
        characters wide. A good example is the string returned by mpi4py_processor:

        >>> MPI running via mpi4py with <n> slave processors & 1 master, mpi version = <x>.<y>

        @see:       multi.processor.mpi4py_processor.Mpi4py_processor.get_intro_string.

        @return:    A string describing the multi processor.
        @rtype:     str
        """

        raise_unimplemented(self.get_intro_string)
Exemple #14
0
    def get_intro_string(self):
        """Get a string describing the multi processor - designed for overriding.

        The string should be suitable for display at application startup and should be less than 100
        characters wide. A good example is the string returned by mpi4py_processor:

        >>> MPI running via mpi4py with <n> slave processors & 1 master, mpi version = <x>.<y>

        @see:       multi.processor.mpi4py_processor.Mpi4py_processor.get_intro_string.

        @return:    A string describing the multi processor.
        @rtype:     str
        """

        raise_unimplemented(self.get_intro_string)
Exemple #15
0
    def add_to_queue(self, command, memo=None):
        """Add a command for remote execution to the queue - an abstract method.

        @see: multi.processor.Slave_command
        @see: multi.processor.Result_command
        @see: multi.processor.Memo

        @param command: A command to execute on a slave processor.
        @type command:  ? subclass instance
        @keyword memo:  A place to place data needed on command completion (e.g. where to save the
                        results) the data stored in the memo is provided to Result_commands
                        generated by the command submitted.
        @type memo:     Memo subclass instance
        """

        raise_unimplemented(self.add_to_queue)
Exemple #16
0
    def add_to_queue(self, command, memo=None):
        """Add a command for remote execution to the queue - an abstract method.

        @see: multi.processor.Slave_command
        @see: multi.processor.Result_command
        @see: multi.processor.Memo

        @param command: A command to execute on a slave processor.
        @type command:  ? subclass instance
        @keyword memo:  A place to place data needed on command completion (e.g. where to save the
                        results) the data stored in the memo is provided to Result_commands
                        generated by the command submitted.
        @type memo:     Memo subclass instance
        """

        raise_unimplemented(self.add_to_queue)
    def run(self, processor, completed):
        """Run the slave command on the slave processor
        
        This is a base method which must be overridden.

        The run command B{must} return at least one Result_command even if it is a processor.NULL_RESULT.  Results are returned from the Slave_command to the master processor using the return_object method of the processor passed to the command. Any exceptions raised will be caught wrapped and returned to the master processor by the slave processor.


        @param processor:   The slave processor the command is running on.  Results from the command are returned via calls to processor.return_object.
        @type processor:    Processor instance
        @param completed:   The flag used in batching result returns to indicate that the sequence of batched result commands has completed. This value should be returned via the last result object retuned by this method or methods it calls. All other Result_commands should be initialised with completed=False. This is an optimisation to prevent the sending an extra batched result queue completion result command being sent, it may be an over early optimisation.
        @type completed:    bool
        """

        # This must be overridden!
        raise_unimplemented(self.run)
Exemple #18
0
    def run(self, processor, completed):
        """Run the slave command on the slave processor
        
        This is a base method which must be overridden.

        The run command B{must} return at least one Result_command even if it is a processor.NULL_RESULT.  Results are returned from the Slave_command to the master processor using the return_object method of the processor passed to the command. Any exceptions raised will be caught wrapped and returned to the master processor by the slave processor.


        @param processor:   The slave processor the command is running on.  Results from the command are returned via calls to processor.return_object.
        @type processor:    Processor instance
        @param completed:   The flag used in batching result returns to indicate that the sequence of batched result commands has completed. This value should be returned via the last result object retuned by this method or methods it calls. All other Result_commands should be initialised with completed=False. This is an optimisation to prevent the sending an extra batched result queue completion result command being sent, it may be an over early optimisation.
        @type completed:    bool
        """

        # This must be overridden!
        raise_unimplemented(self.run)
 def run_all(self):
     raise_unimplemented(self.run_all)
Exemple #20
0
 def slave_receive_commands(self):
     raise_unimplemented(self.slave_receive_commands)
Exemple #21
0
 def return_result_command(self, result_object):
     raise_unimplemented(self.slave_queue_result)
 def slave_receive_commands(self):
     raise_unimplemented(self.slave_receive_commands)
 def return_result_command(self, result_object):
     raise_unimplemented(self.slave_queue_result)
Exemple #24
0
 def run_all(self):
     raise_unimplemented(self.run_all)