ensembl-hive-python3  2.3
DigitFactory.py
Go to the documentation of this file.
1 
2 import eHive
3 
4 import time
5 
7  """Factory that creates 1 job per digit found in the decimal representation of 'b_multiplier'"""
8 
9  def param_defaults(self):
10  return {
11  'take_time' : 0
12  }
13 
14 
15  def fetch_input(self):
16  b_multiplier = self.param_required('b_multiplier')
17  sub_tasks = [ { 'digit': _ } for _ in set(str(b_multiplier)).difference('01') ]
18  self.param('sub_tasks', sub_tasks)
19 
20 
21  def run(self):
22  time.sleep( self.param('take_time') )
23 
24 
25  def write_output(self):
26  sub_tasks = self.param('sub_tasks')
27  self.dataflow(sub_tasks, 2)
28  self.warning('{0} multiplication jobs have been created'.format(len(sub_tasks)))
29 
30 
def param_required(self, param_name)
Returns the value of the parameter "param_name" or raises an exception if anything wrong happens...
Definition: Process.py:242
Factory that creates 1 job per digit found in the decimal representation of 'b_multiplier'.
Definition: DigitFactory.py:8
This is the counterpart of GuestProcess.
Definition: Process.py:50
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 ...
Definition: Process.py:208
def param(self, param_name, args)
When called as a setter: sets the value of the parameter "param_name".
Definition: Process.py:254
def dataflow(self, output_ids, branch_name_or_code=1)
Dataflows the output_id(s) on a given branch (default 1).
Definition: Process.py:213