Belle II Software light-2406-ragdoll
|
Public Member Functions | |
def | __init__ (self, process_list=None) |
def | __iter__ (self) |
def | __len__ (self) |
def | stop (self, index=None) |
def | start_batched_and_wait_for_end (self, max_processes=None) |
def | start (self, index=None) |
def | ensure_running (self, max_processes) |
def | wait_for_end (self, display_bar=True, send_notification=False, max_processes=None) |
def | show_end_result (self, process, process_bars) |
def | map_on_processes (self, map_function, index) |
def | is_running (self, index=None) |
def | is_finished (self, index=None) |
def | has_failed (self, index=None) |
def | get (self, name, index=None) |
def | get_keys (self, index=None) |
def | get_log (self, index=None) |
def | get_status (self, index=None) |
def | get_parameters (self, index=None) |
def | create_widgets_for_all_processes (self, widget_function, index=None) |
def | show_log (self, index=None) |
def | show_statistics (self, index=None) |
def | show_collections (self, index=None) |
def | get_statistics (self, index=None) |
def | append (self, result_queue, log_file_name, parameters, **kwargs) |
Public Attributes | |
process_list | |
The process list (possibly empty, even later) | |
Protected Attributes | |
_calculation_process_type | |
The calculation process type to use. | |
Create a Calculation from the given Process that handles the status of the process and the actions like start, stop or wait_for_end Do not create instances of this class by yourself but rather use the IPythonHandler for this.
Definition at line 19 of file calculation.py.
def __init__ | ( | self, | |
process_list = None |
|||
) |
Init with an empty list of processes
Reimplemented in Basf2Calculation.
Definition at line 27 of file calculation.py.
def __iter__ | ( | self | ) |
Make the class iterable over all single processes
Definition at line 38 of file calculation.py.
def __len__ | ( | self | ) |
Return the number of handled processes
Definition at line 45 of file calculation.py.
def append | ( | self, | |
result_queue, | |||
log_file_name, | |||
parameters, | |||
** | kwargs | ||
) |
Construct a new process with the given parameters and add it to the process_list.
Definition at line 368 of file calculation.py.
def create_widgets_for_all_processes | ( | self, | |
widget_function, | |||
index = None |
|||
) |
Create a overview widget for all processes or only one for the given process.
Definition at line 298 of file calculation.py.
def ensure_running | ( | self, | |
max_processes | |||
) |
Ensure that the max_processes number of processes is running and will start processes which are waiting and have not been started yet.
Definition at line 90 of file calculation.py.
def get | ( | self, | |
name, | |||
index = None |
|||
) |
Return the saved queue item with the given name
Definition at line 247 of file calculation.py.
def get_keys | ( | self, | |
index = None |
|||
) |
Return the names of the items that were saved in the queue
Definition at line 258 of file calculation.py.
def get_log | ( | self, | |
index = None |
|||
) |
Return the log of the process if finished
Definition at line 264 of file calculation.py.
def get_parameters | ( | self, | |
index = None |
|||
) |
Return the parameters used to start this calculation
Definition at line 292 of file calculation.py.
def get_statistics | ( | self, | |
index = None |
|||
) |
Return the statistics of the process if finished
Definition at line 356 of file calculation.py.
def get_status | ( | self, | |
index = None |
|||
) |
Return a string describing the current status if the calculation
Definition at line 276 of file calculation.py.
def has_failed | ( | self, | |
index = None |
|||
) |
Test if the process has failed.
Definition at line 235 of file calculation.py.
def is_finished | ( | self, | |
index = None |
|||
) |
Test if the process has finished
Definition at line 229 of file calculation.py.
def is_running | ( | self, | |
index = None |
|||
) |
Test if the process is still running
Definition at line 223 of file calculation.py.
def map_on_processes | ( | self, | |
map_function, | |||
index | |||
) |
Calculate a function on all processes and collect the results if index is None. Else calculate the function only one the given process or the process number.
Definition at line 207 of file calculation.py.
def show_collections | ( | self, | |
index = None |
|||
) |
Show some snapshots on the collections. Remember to add the PrintCollectionsPython Module for that!
Definition at line 342 of file calculation.py.
def show_end_result | ( | self, | |
process, | |||
process_bars | |||
) |
Shows the end result (finished or failed) for all processes in the process_bars list
Definition at line 196 of file calculation.py.
def show_log | ( | self, | |
index = None |
|||
) |
Show the log of the underlying process(es).
Definition at line 316 of file calculation.py.
def show_statistics | ( | self, | |
index = None |
|||
) |
Show the statistics in a smart manner
Definition at line 329 of file calculation.py.
def start | ( | self, | |
index = None |
|||
) |
Start the processes in the background. Raises an error of the process has been started already. You can not restart a process. If you want to do so, create another Calculation instance.
Definition at line 75 of file calculation.py.
def start_batched_and_wait_for_end | ( | self, | |
max_processes = None |
|||
) |
Start part of the processes and wait for all to finish. If max_processes is None, only n processes will be started where n is the number of cores on the current machine. As soon as one process is finished, a waiting one will be started in order to fill all cores of the machine. Parameters: max_processes: The number of processes which can be run at the same time
Definition at line 59 of file calculation.py.
def stop | ( | self, | |
index = None |
|||
) |
Kill the processes. Please keep in mind that killing a process is normaly accompanied with data loss.
Definition at line 49 of file calculation.py.
def wait_for_end | ( | self, | |
display_bar = True , |
|||
send_notification = False , |
|||
max_processes = None |
|||
) |
Send the calculation into the foreground by halting the notebook as long as the process is running. Shows a progress bar with the number of processed events. Please keep in mind that you can not execute cells in the notebook when having called wait_for_end (but before - although a calculation is running.) Parameters: display_bar: If true, the display bar is used to show in the notebook that the computation is complete. send_notification: If true, the notify2 library will be used to notify the user if the computation is complete. This will only work if the jupyter notebook is hosted on the local desktop machine. max_processes: The maximum number of processes which will be run on the machine. This has no effect when start() has been called before. This parameter can not be used directly, but start_batched_and_wait_for_end() should be used.
Definition at line 107 of file calculation.py.
|
protected |
The calculation process type to use.
Definition at line 36 of file calculation.py.
process_list |
The process list (possibly empty, even later)
Definition at line 31 of file calculation.py.