Belle II Software  release-08-01-10
Basf2Calculation Class Reference
Inheritance diagram for Basf2Calculation:
Collaboration diagram for Basf2Calculation:

Public Member Functions

def __init__ (self)
 
def show_path (self, index=None)
 
def get_modules (self, index=None)
 
def show_dependencies (self, index=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)
 

Private Attributes

 _calculation_process_type
 Override the calculation process type with the basf2 one.
 

Detailed Description

Overloaded class with more functionality which is ipython_handler_basf2 specific:
  * Access the path and the module
  * Create basf2 calculations
  * Use the basf2 widgets

Definition at line 14 of file calculation.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self)
Create a new basf2 calculation mostly overloading the standard calculation.

Definition at line 22 of file calculation.py.

22  def __init__(self):
23  """Create a new basf2 calculation mostly overloading the standard calculation."""
24  super().__init__()
25 
26 
27  self._calculation_process_type = Basf2CalculationProcess
28 

Member Function Documentation

◆ __iter__()

def __iter__ (   self)
inherited
Make the class iterable over all single processes

Definition at line 38 of file calculation.py.

◆ __len__()

def __len__ (   self)
inherited
 Return the number of handled processes 

Definition at line 45 of file calculation.py.

◆ append()

def append (   self,
  result_queue,
  log_file_name,
  parameters,
**  kwargs 
)
inherited
Construct a new process with the given parameters and add it to the process_list.

Definition at line 368 of file calculation.py.

◆ create_widgets_for_all_processes()

def create_widgets_for_all_processes (   self,
  widget_function,
  index = None 
)
inherited
Create a overview widget for all processes or only one for the given process.

Definition at line 298 of file calculation.py.

◆ ensure_running()

def ensure_running (   self,
  max_processes 
)
inherited
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.

◆ get()

def get (   self,
  name,
  index = None 
)
inherited
Return the saved queue item with the given name

Definition at line 247 of file calculation.py.

◆ get_keys()

def get_keys (   self,
  index = None 
)
inherited
Return the names of the items that were saved in the queue

Definition at line 258 of file calculation.py.

◆ get_log()

def get_log (   self,
  index = None 
)
inherited
Return the log of the process if finished

Definition at line 264 of file calculation.py.

◆ get_modules()

def get_modules (   self,
  index = None 
)
Return the modules in the given path.

Definition at line 41 of file calculation.py.

◆ get_parameters()

def get_parameters (   self,
  index = None 
)
inherited
Return the parameters used to start this calculation

Definition at line 292 of file calculation.py.

◆ get_statistics()

def get_statistics (   self,
  index = None 
)
inherited
Return the statistics of the process if finished

Definition at line 356 of file calculation.py.

◆ get_status()

def get_status (   self,
  index = None 
)
inherited
Return a string describing the current status if the calculation

Definition at line 276 of file calculation.py.

◆ has_failed()

def has_failed (   self,
  index = None 
)
inherited
Test if the process has failed.

Definition at line 235 of file calculation.py.

◆ is_finished()

def is_finished (   self,
  index = None 
)
inherited
Test if the process has finished

Definition at line 229 of file calculation.py.

◆ is_running()

def is_running (   self,
  index = None 
)
inherited
Test if the process is still running

Definition at line 223 of file calculation.py.

◆ map_on_processes()

def map_on_processes (   self,
  map_function,
  index 
)
inherited
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.

◆ show_collections()

def show_collections (   self,
  index = None 
)
inherited
Show some snapshots on the collections.
Remember to add the PrintCollectionsPython Module for that!

Definition at line 342 of file calculation.py.

◆ show_dependencies()

def show_dependencies (   self,
  index = None 
)
Show the dependencies among the data store entries.

Definition at line 47 of file calculation.py.

◆ show_end_result()

def show_end_result (   self,
  process,
  process_bars 
)
inherited
Shows the end result (finished or failed) for all processes in the process_bars list

Definition at line 196 of file calculation.py.

◆ show_log()

def show_log (   self,
  index = None 
)
inherited
Show the log of the underlying process(es).

Definition at line 316 of file calculation.py.

◆ show_path()

def show_path (   self,
  index = None 
)
Show the underlaying ipython_handler_basf2 path in an interactive way

Definition at line 29 of file calculation.py.

◆ show_statistics()

def show_statistics (   self,
  index = None 
)
inherited
Show the statistics in a smart manner

Definition at line 329 of file calculation.py.

◆ start()

def start (   self,
  index = None 
)
inherited
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.

◆ start_batched_and_wait_for_end()

def start_batched_and_wait_for_end (   self,
  max_processes = None 
)
inherited
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.

◆ stop()

def stop (   self,
  index = None 
)
inherited
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.

◆ wait_for_end()

def wait_for_end (   self,
  display_bar = True,
  send_notification = False,
  max_processes = None 
)
inherited
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.


The documentation for this class was generated from the following file: