ensembl-hive-python3  2.5
eHive.Process.BaseRunnable Class Reference

This is the counterpart of GuestProcess. More...

+ Inheritance diagram for eHive.Process.BaseRunnable:

Public Member Functions

def __init__ (self, read_fileno, write_fileno, debug)
 
def warning (self, message, is_error=False)
 Store a message in the log_message table with is_error indicating whether the warning is actually an error or not. More...
 
def dataflow (self, output_ids, branch_name_or_code=1)
 Dataflows the output_id(s) on a given branch (default 1). More...
 
def worker_temp_directory (self)
 Returns the full path of the temporary directory created by the worker. More...
 
def param_defaults (self)
 Returns the defaults parameters for this runnable. More...
 
def param_required (self, param_name)
 Returns the value of the parameter "param_name" or raises an exception if anything wrong happens or the value is None. More...
 
def param (self, param_name, args)
 When called as a setter: sets the value of the parameter "param_name". More...
 
def param_exists (self, param_name)
 Returns True if the parameter exists and can be successfully substituted, None if the substitution fails, False if it is missing. More...
 
def param_is_defined (self, param_name)
 Returns True if the parameter exists and can be successfully substituted to a defined value, None if the substitution fails, False if it is missing or evaluates as None. More...
 

Public Attributes

 debug
 
 input_job
 

Private Member Functions

def __print_debug (self, args)
 
def __send_message (self, event, content)
 seralizes the message in JSON and send it to the parent process More...
 
def __send_response (self, response)
 Sends a response message to the parent process. More...
 
def __read_message (self)
 Read a message from the parent and parse it. More...
 
def __send_message_and_wait_for_OK (self, event, content)
 Send a message and expects a response to be 'OK'. More...
 
def __process_life_cycle (self)
 Simple loop: wait for job parameters, do the job's life-cycle. More...
 
def __job_life_cycle (self, config)
 Job's life-cycle. More...
 
def __run_method_if_exists (self, method)
 method is one of "pre_cleanup", "fetch_input", "run", "write_output", "post_cleanup". More...
 
def __traceback (self, skipped_traces)
 Remove "skipped_traces" lines from the stack trace (the eHive part) More...
 

Private Attributes

 __read_pipe
 
 __write_pipe
 
 __pid
 
 __created_worker_temp_directory
 
 __params
 

Detailed Description

This is the counterpart of GuestProcess.

Note that most of the methods are private to be hidden in the derived classes.

This class can be used as a base-class for people to redefine fetch_input(), run() and/or write_output() (and/or pre_cleanup(), post_cleanup()). Jobs are supposed to raise CompleteEarlyException in case they complete before reaching. They can also raise JobFailedException to indicate a general failure

Definition at line 66 of file Process.py.

Constructor & Destructor Documentation

◆ __init__()

def eHive.Process.BaseRunnable.__init__ (   self,
  read_fileno,
  write_fileno,
  debug 
)

Definition at line 71 of file Process.py.

Member Function Documentation

◆ __job_life_cycle()

def eHive.Process.BaseRunnable.__job_life_cycle (   self,
  config 
)
private

Job's life-cycle.

See GuestProcess for a description of the protocol to communicate with the parent

Definition at line 147 of file Process.py.

+ Here is the call graph for this function:

◆ __print_debug()

def eHive.Process.BaseRunnable.__print_debug (   self,
  args 
)
private

Definition at line 79 of file Process.py.

+ Here is the caller graph for this function:

◆ __process_life_cycle()

def eHive.Process.BaseRunnable.__process_life_cycle (   self)
private

Simple loop: wait for job parameters, do the job's life-cycle.

Definition at line 133 of file Process.py.

+ Here is the call graph for this function:

◆ __read_message()

def eHive.Process.BaseRunnable.__read_message (   self)
private

Read a message from the parent and parse it.

Definition at line 111 of file Process.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __run_method_if_exists()

def eHive.Process.BaseRunnable.__run_method_if_exists (   self,
  method 
)
private

method is one of "pre_cleanup", "fetch_input", "run", "write_output", "post_cleanup".

We only the call the method if it exists to save a trip to the database.

Definition at line 205 of file Process.py.

+ Here is the call graph for this function:

◆ __send_message()

def eHive.Process.BaseRunnable.__send_message (   self,
  event,
  content 
)
private

seralizes the message in JSON and send it to the parent process

Definition at line 87 of file Process.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __send_message_and_wait_for_OK()

def eHive.Process.BaseRunnable.__send_message_and_wait_for_OK (   self,
  event,
  content 
)
private

Send a message and expects a response to be 'OK'.

Definition at line 125 of file Process.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __send_response()

def eHive.Process.BaseRunnable.__send_response (   self,
  response 
)
private

Sends a response message to the parent process.

Definition at line 101 of file Process.py.

+ Here is the call graph for this function:

◆ __traceback()

def eHive.Process.BaseRunnable.__traceback (   self,
  skipped_traces 
)
private

Remove "skipped_traces" lines from the stack trace (the eHive part)

Definition at line 212 of file Process.py.

◆ dataflow()

def eHive.Process.BaseRunnable.dataflow (   self,
  output_ids,
  branch_name_or_code = 1 
)

Dataflows the output_id(s) on a given branch (default 1).

Returns whatever the Perl side returns

Definition at line 230 of file Process.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ param()

def eHive.Process.BaseRunnable.param (   self,
  param_name,
  args 
)

When called as a setter: sets the value of the parameter "param_name".

When called as a getter: returns the value of the parameter "param_name". It does not raise an exception if the parameter (or another one in the substitution stack) is undefined

Definition at line 274 of file Process.py.

+ Here is the caller graph for this function:

◆ param_defaults()

def eHive.Process.BaseRunnable.param_defaults (   self)

Returns the defaults parameters for this runnable.

Definition at line 253 of file Process.py.

+ Here is the caller graph for this function:

◆ param_exists()

def eHive.Process.BaseRunnable.param_exists (   self,
  param_name 
)

Returns True if the parameter exists and can be successfully substituted, None if the substitution fails, False if it is missing.

Definition at line 289 of file Process.py.

+ Here is the caller graph for this function:

◆ param_is_defined()

def eHive.Process.BaseRunnable.param_is_defined (   self,
  param_name 
)

Returns True if the parameter exists and can be successfully substituted to a defined value, None if the substitution fails, False if it is missing or evaluates as None.

Definition at line 302 of file Process.py.

+ Here is the call graph for this function:

◆ param_required()

def eHive.Process.BaseRunnable.param_required (   self,
  param_name 
)

Returns the value of the parameter "param_name" or raises an exception if anything wrong happens or the value is None.

The exception is marked as non-transient.

Definition at line 260 of file Process.py.

+ Here is the caller graph for this function:

◆ warning()

def eHive.Process.BaseRunnable.warning (   self,
  message,
  is_error = False 
)

Store a message in the log_message table with is_error indicating whether the warning is actually an error or not.

Definition at line 225 of file Process.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ worker_temp_directory()

def eHive.Process.BaseRunnable.worker_temp_directory (   self)

Returns the full path of the temporary directory created by the worker.

Runnables can implement "worker_temp_directory_name()" to return the name they would like to use

Definition at line 241 of file Process.py.

+ Here is the call graph for this function:

Member Data Documentation

◆ __created_worker_temp_directory

eHive.Process.BaseRunnable.__created_worker_temp_directory
private

Definition at line 136 of file Process.py.

◆ __params

eHive.Process.BaseRunnable.__params
private

Definition at line 151 of file Process.py.

◆ __pid

eHive.Process.BaseRunnable.__pid
private

Definition at line 75 of file Process.py.

◆ __read_pipe

eHive.Process.BaseRunnable.__read_pipe
private

Definition at line 73 of file Process.py.

◆ __write_pipe

eHive.Process.BaseRunnable.__write_pipe
private

Definition at line 74 of file Process.py.

◆ debug

eHive.Process.BaseRunnable.debug

Definition at line 76 of file Process.py.

◆ input_job

eHive.Process.BaseRunnable.input_job

Definition at line 154 of file Process.py.


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