本文整理汇总了Python中SpiffWorkflow.specs.TaskSpec.TaskSpec.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python TaskSpec.__init__方法的具体用法?Python TaskSpec.__init__怎么用?Python TaskSpec.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpiffWorkflow.specs.TaskSpec.TaskSpec
的用法示例。
在下文中一共展示了TaskSpec.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from SpiffWorkflow.specs.TaskSpec import TaskSpec [as 别名]
# 或者: from SpiffWorkflow.specs.TaskSpec.TaskSpec import __init__ [as 别名]
def __init__(self,
parent,
name,
split_task=None,
threshold=None,
cancel=False,
**kwargs):
"""
Constructor.
@type parent: L{SpiffWorkflow.specs.WorkflowSpec}
@param parent: A reference to the parent (usually a workflow).
@type name: string
@param name: A name for the task.
@type split_task: str or None
@param split_task: The name of the task spec that was previously
used to split the branch. If this is None,
the most recent branch split is merged.
@type threshold: int or L{SpiffWorkflow.operators.Attrib}
@param threshold: Specifies how many incoming branches need to
complete before the task triggers. When the limit
is reached, the task fires but still expects all
other branches to complete.
You may also pass an attribute, in which case
the value is resolved at runtime.
@type cancel: bool
@param cancel: When True, any remaining incoming branches are
cancelled as soon as the discriminator is activated.
@type kwargs: dict
@param kwargs: See L{SpiffWorkflow.specs.TaskSpec}.
"""
TaskSpec.__init__(self, parent, name, **kwargs)
self.split_task = split_task
self.threshold = threshold
self.cancel_remaining = cancel
示例2: __init__
# 需要导入模块: from SpiffWorkflow.specs.TaskSpec import TaskSpec [as 别名]
# 或者: from SpiffWorkflow.specs.TaskSpec.TaskSpec import __init__ [as 别名]
def __init__(self,
parent,
name,
file,
in_assign = None,
out_assign = None,
**kwargs):
"""
Constructor.
:type parent: TaskSpec
:param parent: A reference to the parent task spec.
:type name: str
:param name: The name of the task spec.
:type file: str
:param file: The name of a file containing a workflow.
:type in_assign: list(str)
:param in_assign: The names of attributes to carry over.
:type out_assign: list(str)
:param out_assign: The names of attributes to carry back.
:type kwargs: dict
:param kwargs: See L{SpiffWorkflow.specs.TaskSpec}.
"""
assert parent is not None
assert name is not None
assert file is not None
TaskSpec.__init__(self, parent, name, **kwargs)
self.file = None
self.in_assign = in_assign is not None and in_assign or []
self.out_assign = out_assign is not None and out_assign or []
if file is not None:
dirname = os.path.dirname(parent.file)
self.file = os.path.join(dirname, file)
示例3: __init__
# 需要导入模块: from SpiffWorkflow.specs.TaskSpec import TaskSpec [as 别名]
# 或者: from SpiffWorkflow.specs.TaskSpec.TaskSpec import __init__ [as 别名]
def __init__(self,
parent,
name,
times = None,
times_attribute = None,
**kwargs):
"""
Constructor.
@type parent: L{SpiffWorkflow.specs.WorkflowSpec}
@param parent: A reference to the parent (usually a workflow).
@type name: string
@param name: A name for the task.
@type times: int or None
@param times: The number of tasks to create.
@type times_attribute: str or None
@param times_attribute: The name of an attribute that specifies
the number of outgoing tasks.
@type kwargs: dict
@param kwargs: See L{SpiffWorkflow.specs.TaskSpec}.
"""
if not times_attribute and not times:
raise ValueError('require times or times_attribute argument')
TaskSpec.__init__(self, parent, name, **kwargs)
self.times_attribute = times_attribute
self.times = times
self.thread_starter = ThreadStart(parent, **kwargs)
self.outputs.append(self.thread_starter)
self.thread_starter._connect_notify(self)
示例4: __init__
# 需要导入模块: from SpiffWorkflow.specs.TaskSpec import TaskSpec [as 别名]
# 或者: from SpiffWorkflow.specs.TaskSpec.TaskSpec import __init__ [as 别名]
def __init__(self, parent, **kwargs):
"""
Constructor. The name of this task is *always* 'Start'.
:type parent: TaskSpec
:param parent: A reference to the parent task spec.
:type kwargs: dict
:param kwargs: See L{SpiffWorkflow.specs.TaskSpec}.
"""
TaskSpec.__init__(self, parent, 'Start', **kwargs)
示例5: __init__
# 需要导入模块: from SpiffWorkflow.specs.TaskSpec import TaskSpec [as 别名]
# 或者: from SpiffWorkflow.specs.TaskSpec.TaskSpec import __init__ [as 别名]
def __init__(self, parent, **kwargs):
"""
Constructor. The name of this task is *always* 'ThreadStart'.
@type parent: TaskSpec
@param parent: A reference to the parent task spec.
@type kwargs: dict
@param kwargs: See L{SpiffWorkflow.specs.TaskSpec}.
"""
TaskSpec.__init__(self, parent, 'ThreadStart', **kwargs)
self.internal = True
示例6: __init__
# 需要导入模块: from SpiffWorkflow.specs.TaskSpec import TaskSpec [as 别名]
# 或者: from SpiffWorkflow.specs.TaskSpec.TaskSpec import __init__ [as 别名]
def __init__(self, parent, name, call=None, call_args=None, call_queue=None, call_server_id=None,
call_result_key=None, merge_results=True, **kwargs):
"""Constructor.
The args/kwargs arguments support Attrib classes in the parameters for
delayed evaluation of inputs until run-time. Example usage:
task = Celery(wfspec, 'MyTask', 'celery.call',
call_args=['hello', 'world', Attrib('number')],
any_param=Attrib('result'))
For serialization, the celery task_id is stored in internal_data,
but the celery async call is only storred as an attr of the task (since
it is not always serializable). When deserialized, the async_call attr
is reset in the _try_fire call.
:type parent: TaskSpec
:param parent: A reference to the parent task spec.
:type name: str
:param name: The name of the task spec.
:type call: str
:param call: The name of the celery task that needs to be called.
:type call_args: list
:param call_args: args to pass to celery task.
:type call_result_key: str
:param call_result_key: The key to use to store the results of the call in
task.data. If None, then dicts are expanded into
data and values are stored in 'result'.
:param merge_results: merge the results in instead of overwriting existing
fields.
:type kwargs: dict
:param kwargs: kwargs to pass to celery task.
"""
if not have_celery:
raise Exception("Unable to import python-celery imports.")
assert parent is not None
assert name is not None
if call is None:
call = name
TaskSpec.__init__(self, parent, name, **kwargs)
self.description = kwargs.pop('description', '')
self.call = call
self.args = call_args
self.call_queue = call_queue
self.call_server_id = call_server_id
self.merge_results = merge_results
skip = 'data', 'defines', 'pre_assign', 'post_assign', 'lock'
self.kwargs = dict(i for i in kwargs.iteritems() if i[0] not in skip)
self.call_result_key = call_result_key
LOG.debug("Celery task '%s' created to call '%s'", name, call)
示例7: __init__
# 需要导入模块: from SpiffWorkflow.specs.TaskSpec import TaskSpec [as 别名]
# 或者: from SpiffWorkflow.specs.TaskSpec.TaskSpec import __init__ [as 别名]
def __init__(self, parent, name, times = None, **kwargs):
"""
Constructor.
@type parent: TaskSpec
@param parent: A reference to the parent task spec.
@type name: str
@param name: The name of the task spec.
@type times: int
@param times: The number of tasks to create.
@type kwargs: dict
@param kwargs: See L{SpiffWorkflow.specs.TaskSpec}.
"""
TaskSpec.__init__(self, parent, name, **kwargs)
self.times = times
示例8: __init__
# 需要导入模块: from SpiffWorkflow.specs.TaskSpec import TaskSpec [as 别名]
# 或者: from SpiffWorkflow.specs.TaskSpec.TaskSpec import __init__ [as 别名]
def __init__(self, parent, name, success=False, **kwargs):
"""
Constructor.
:type parent: TaskSpec
:param parent: A reference to the parent task spec.
:type name: str
:param name: The name of the task spec.
:type success: bool
:param success: Whether to cancel successfully or unsuccessfully.
:type kwargs: dict
:param kwargs: See L{SpiffWorkflow.specs.TaskSpec}.
"""
TaskSpec.__init__(self, parent, name, **kwargs)
self.cancel_successfully = success
示例9: __init__
# 需要导入模块: from SpiffWorkflow.specs.TaskSpec import TaskSpec [as 别名]
# 或者: from SpiffWorkflow.specs.TaskSpec.TaskSpec import __init__ [as 别名]
def __init__(self, parent, name, mutex, **kwargs):
"""
Constructor.
:type parent: TaskSpec
:param parent: A reference to the parent task spec.
:type name: str
:param name: The name of the task spec.
:type mutex: str
:param mutex: The name of the mutex that should be acquired.
:type kwargs: dict
:param kwargs: See L{SpiffWorkflow.specs.TaskSpec}.
"""
assert mutex is not None
TaskSpec.__init__(self, parent, name, **kwargs)
self.mutex = mutex
示例10: __init__
# 需要导入模块: from SpiffWorkflow.specs.TaskSpec import TaskSpec [as 别名]
# 或者: from SpiffWorkflow.specs.TaskSpec.TaskSpec import __init__ [as 别名]
def __init__(self, parent, name, args=None, **kwargs):
"""
Constructor.
:type parent: TaskSpec
:param parent: A reference to the parent task spec.
:type name: str
:param name: The name of the task spec.
:type args: list
:param args: args to pass to process (first arg is the command).
:type kwargs: dict
:param kwargs: kwargs to pass-through to TaskSpec initializer.
"""
assert parent is not None
assert name is not None
TaskSpec.__init__(self, parent, name, **kwargs)
self.args = args
示例11: __init__
# 需要导入模块: from SpiffWorkflow.specs.TaskSpec import TaskSpec [as 别名]
# 或者: from SpiffWorkflow.specs.TaskSpec.TaskSpec import __init__ [as 别名]
def __init__(self, parent, name, call, call_args=None, result_key=None,
merge_results=False, **kwargs):
"""Constructor.
The args/kwargs arguments support Attrib classes in the parameters for
delayed evaluation of inputs until run-time. Example usage:
task = Celery(wfspec, 'MyTask', 'celery.call',
call_args=['hello', 'world', Attrib('number')],
any_param=Attrib('result'))
For serialization, the celery task_id is stored in internal_attributes,
but the celery async call is only storred as an attr of the task (since
it is not always serializable). When deserialized, the async_call attr
is reset in the try_fire call.
@type parent: TaskSpec
@param parent: A reference to the parent task spec.
@type name: str
@param name: The name of the task spec.
@type call: str
@param call: The name of the celery task that needs to be called.
@type call_args: list
@param call_args: args to pass to celery task.
@type result_key: str
@param result_key: The key to use to store the results of the call in
task.attributes. If None, then dicts are expanded into
attributes and values are stored in 'result'.
@param merge_results: merge the results in instead of overwriting existing
fields.
@type kwargs: dict
@param kwargs: kwargs to pass to celery task.
"""
assert parent is not None
assert name is not None
assert call is not None
TaskSpec.__init__(self, parent, name, **kwargs)
self.description = kwargs.pop('description', '')
self.call = call
self.args = call_args
self.merge_results = merge_results
self.kwargs = {key: kwargs[key] for key in kwargs if key not in \
['properties', 'defines', 'pre_assign', 'post_assign', 'lock']}
self.result_key = result_key
LOG.debug("Celery task '%s' created to call '%s'" % (name, call))
示例12: __init__
# 需要导入模块: from SpiffWorkflow.specs.TaskSpec import TaskSpec [as 别名]
# 或者: from SpiffWorkflow.specs.TaskSpec.TaskSpec import __init__ [as 别名]
def __init__(self, parent, name, context, **kwargs):
"""
Constructor.
@type parent: TaskSpec
@param parent: A reference to the parent task spec.
@type name: str
@param name: The name of the task spec.
@type context: str
@param context: The name of the task that needs to complete before
this task can execute.
@type kwargs: dict
@param kwargs: See L{SpiffWorkflow.specs.TaskSpec}.
"""
assert parent is not None
assert name is not None
assert context is not None
TaskSpec.__init__(self, parent, name, **kwargs)
self.context = context
示例13: __init__
# 需要导入模块: from SpiffWorkflow.specs.TaskSpec import TaskSpec [as 别名]
# 或者: from SpiffWorkflow.specs.TaskSpec.TaskSpec import __init__ [as 别名]
def __init__(self, parent, name, context, **kwargs):
"""
Constructor.
@type parent: TaskSpec
@param parent: A reference to the parent task spec.
@type name: str
@param name: The name of the task spec.
@type context: str
@param context: A list of the names of tasks that are to be triggered.
@type kwargs: dict
@param kwargs: See L{SpiffWorkflow.specs.TaskSpec}.
"""
assert parent is not None
assert name is not None
assert context is not None
assert type(context) == type([])
TaskSpec.__init__(self, parent, name, **kwargs)
self.context = context
self.times = kwargs.get("times", 1)
self.queued = 0
示例14: __init__
# 需要导入模块: from SpiffWorkflow.specs.TaskSpec import TaskSpec [as 别名]
# 或者: from SpiffWorkflow.specs.TaskSpec.TaskSpec import __init__ [as 别名]
def __init__(self, parent, name, transforms=None, **kwargs):
"""
Constructor.
@type parent: TaskSpec
@param parent: A reference to the parent task spec.
@type name: str
@param name: The name of the task spec.
@type transforms: list
@param transforms: The commands that this task will execute to
transform data. The commands will be executed using the
python 'exec' function. Accessing inputs and outputs is
achieved by referencing the my_task.* and self.*
variables'
@type kwargs: dict
@param kwargs: See L{SpiffWorkflow.specs.TaskSpec}.
"""
assert parent is not None
assert name is not None
TaskSpec.__init__(self, parent, name, **kwargs)
self.transforms = transforms
示例15: __init__
# 需要导入模块: from SpiffWorkflow.specs.TaskSpec import TaskSpec [as 别名]
# 或者: from SpiffWorkflow.specs.TaskSpec.TaskSpec import __init__ [as 别名]
def __init__(self, parent, name, context, times = 1, **kwargs):
"""
Constructor.
:type parent: TaskSpec
:param parent: A reference to the parent task spec.
:type name: str
:param name: The name of the task spec.
:type context: list(str)
:param context: A list of the names of tasks that are to be triggered.
:type times: int or None
:param times: The number of signals before the trigger fires.
:type kwargs: dict
:param kwargs: See L{SpiffWorkflow.specs.TaskSpec}.
"""
assert parent is not None
assert name is not None
assert context is not None
assert type(context) == type([])
TaskSpec.__init__(self, parent, name, **kwargs)
self.context = context
self.times = times
self.queued = 0