2 from multiprocessing
import Process, Pipe
7 Abstract base class for doing the real processing of a calculation. Is used by the handler to
8 process the calculation you requested. Overload the start_process and prepare method to implement your calculation
9 and maybe also the __init__ method if you need to store more information on your process (like what to calculate).
11 See ipython_handler_basf2/calculation_process.py for an example implementation.
14 def __init__(self, result_queue, log_file_name, parameters):
16 Create a new calculation process instance. The parameters here are the absolute standard. You probably have to redefine the
17 constructor in your own class.
19 if result_queue
is None:
20 raise ValueError(
"Invalid result_queue")
51 Delete the log file and copy its content to the class.
60 Return the log file content.
61 Use the methods of the Calculation for a better handling.
71 Return an item from the result queue. Only gives a result if the calculation has finished.
72 Use the Calculation for a better handling.
74 if not self.is_alive():
79 Return the names of all item from the result queue. Only gives a result if the calculation has finished.
80 Use the Calculation for a better handling.
82 if not self.is_alive():
87 The function given to the process to start the calculation.
88 Do not call by yourself.
89 Resets the logging system, logs onto console and a file and sets the queues
90 (the result queue and the process queue) correctly.
96 Overload this function if you need to process some preparations
97 before doing the real calculation.