9from multiprocessing
import Process, Pipe
14 Abstract base class for doing the real processing of a calculation. Is used by the handler to
15 process the calculation you requested. Overload the start_process
and prepare method to implement your calculation
16 and maybe also the __init__ method
if you need to store more information on your process (like what to calculate).
18 See ipython_handler_basf2/calculation_process.py
for an example implementation.
21 def __init__(self, result_queue, log_file_name, parameters):
23 Create a new calculation process instance. The parameters here are the absolute standard. You probably have to redefine the
24 constructor in your own
class.
26 if result_queue
is None:
27 raise ValueError(
"Invalid result_queue")
58 Delete the log file and copy its content to the
class.
67 Return the log file content.
68 Use the methods of the Calculation for a better handling.
78 Return an item from the result queue. Only gives a result
if the calculation has finished.
79 Use the Calculation
for a better handling.
81 if not self.is_alive():
86 Return the names of all item from the result queue. Only gives a result
if the calculation has finished.
87 Use the Calculation
for a better handling.
89 if not self.is_alive():
94 The function given to the process to start the calculation.
95 Do not call by yourself.
96 Resets the logging system, logs onto console
and a file
and sets the queues
97 (the result queue
and the process queue) correctly.
102 Overload this function if you need to process some preparations
103 before doing the real calculation.