Commit 8a7842da authored by Paul Rich's avatar Paul Rich
Browse files

Clarifying comments and updating docstring per review comments.

parent 95d9a2a6
......@@ -54,22 +54,36 @@ def run_component (component_cls, argv=None, register=True, state_name=False,
cls_kwargs={}, extra_getopt='', time_out=10,
single_threaded=False, seq_num=0, aug_comp_name=False,
state_name_match_component=False):
'''Run the Cobalt component.
arguments:
component_cls
argv
register
state_name
cls_kwargs
extra_getopt
time_out
single_threaded
seq_num
aug_comp_name
This will run until a the component is terminated.
'''Run the specified Cobalt component until recieving signal to terminate.
Args::
component_cls: underlying component library class to use for execution
argv: component-specific arguments [Default: None]
register: If true, register the component with the service-locator [Default: True]
state_name: Name of statefile to use for a component. If false, do not
generate a statefile [Default: False]
cls_kwargs: keyword arguments to pass to the underlying component class
[Default: {}]
extra_getopt: extra options to getopt [Default: '']
time_out: timeout for default task iteration in seconds. [Default: 10]
single_threaded: If true, run as a single-threaded componenent.
[Default: False]
seq_num: Sequence number of the componenent. This should be incremented
for multiple components on one host. [Default: 0]
aug_comp_name: Add the hostname and a sequence number to the component
name registered with the service-loactor if True.
[Default: False]
state_name_match_component: Make the statefile name match the component
name in the service-locator if using the
augmented name. [Default: False]
Returns:
Exit status of the component
Notes:
Components that make use of the fork system call must use
single-threaded mode.
'''
......@@ -95,8 +109,10 @@ def run_component (component_cls, argv=None, register=True, state_name=False,
elif item[0] == '-d':
level = logging.DEBUG
# form new component name for running on multiple hosts override in
# component_cls passed in
# form new component name for running on multiple hosts.
# This includes a hostname and the sequence number to allow for multiple
# copies of the same component to be run. This is primarily used with
# forkers at this time.
if aug_comp_name:
component_cls.name = '_'.join([component_cls.name, socket.gethostname(),
str(seq_num)])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment