ensembl-hive-python3  2.3
All Classes Namespaces Files Functions Variables
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)
 
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. 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 or False, whether the parameter exists (it doesn't mean it can be successfully substituted) More...
 
def param_is_defined (self, param_name)
 Returns True or False, whether the parameter exists, can be successfully substituted, and is not None. More...
 

Public Attributes

 debug
 
 input_job
 
 autoflow
 

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 50 of file Process.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 55 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 131 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 63 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 117 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 95 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 188 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 71 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 109 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 85 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 195 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 213 of file Process.py.

+ 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 254 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 236 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 or False, whether the parameter exists (it doesn't mean it can be successfully substituted)

Definition at line 268 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 or False, whether the parameter exists, can be successfully substituted, and is not None.

Definition at line 273 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.

The exception is marked as non-transient.

Definition at line 242 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 208 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 224 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 120 of file Process.py.

◆ __params

eHive.Process.BaseRunnable.__params
private

Definition at line 135 of file Process.py.

◆ __pid

eHive.Process.BaseRunnable.__pid
private

Definition at line 59 of file Process.py.

◆ __read_pipe

eHive.Process.BaseRunnable.__read_pipe
private

Definition at line 57 of file Process.py.

◆ __write_pipe

eHive.Process.BaseRunnable.__write_pipe
private

Definition at line 58 of file Process.py.

◆ autoflow

eHive.Process.BaseRunnable.autoflow

Definition at line 215 of file Process.py.

◆ debug

eHive.Process.BaseRunnable.debug

Definition at line 60 of file Process.py.

◆ input_job

eHive.Process.BaseRunnable.input_job

Definition at line 138 of file Process.py.


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