本文整理汇总了Python中pinball.workflow.name.Name.get_input_prefix方法的典型用法代码示例。如果您正苦于以下问题:Python Name.get_input_prefix方法的具体用法?Python Name.get_input_prefix怎么用?Python Name.get_input_prefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pinball.workflow.name.Name
的用法示例。
在下文中一共展示了Name.get_input_prefix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_event_names
# 需要导入模块: from pinball.workflow.name import Name [as 别名]
# 或者: from pinball.workflow.name.Name import get_input_prefix [as 别名]
def get_event_names(self, workflow_name, instance, job, input_name):
"""Return names of events under a workflow instance, job, and input."""
request = GroupRequest()
name = Name()
name.workflow = workflow_name
name.instance = instance
name.job = job
name.input = input_name
request.namePrefix = name.get_input_prefix()
request.groupSuffix = Name.DELIMITER
response = self._client.group(request)
events = []
if response.counts:
for event in response.counts.keys():
name = Name.from_event_token_name(event)
events.append(name.event)
return events
示例2: _generate_missing_events
# 需要导入模块: from pinball.workflow.name import Name [as 别名]
# 或者: from pinball.workflow.name.Name import get_input_prefix [as 别名]
def _generate_missing_events(self, job_names):
"""Generate external events required to run all jobs in a set.
For a set of jobs (a subset of all jobs in the workflow), produce
events satisfying upstream dependencies external to that set. E.g.,
for job dependency structure like this:
A1 A2
| /
B1 B2
|
C1 C2
| /
D1
and job_names = (C1, D1) we would generate events satisfying the
following deps: B1->C1, C2->D1.
Args:
job_names: The set of job names whose external deps are to be
satisfied by the generated events.
"""
input_prefixes = set()
for job_name in job_names:
job = self._jobs[job_name]
for job_input in job.inputs:
if job_input not in job_names:
name = Name(workflow=self._workflow,
instance=self._instance,
job=job_name,
input_name=job_input,
event='poison_%d' % len(input_prefixes))
input_prefix = name.get_input_prefix()
if input_prefix not in input_prefixes:
input_prefixes.add(input_prefix)
event_token_name = name.get_event_token_name()
if not event_token_name in self._existing_events:
self._new_events[
name.get_event_token_name()] = Event(
'analyzer')
示例3: _make_job_runnable
# 需要导入模块: from pinball.workflow.name import Name [as 别名]
# 或者: from pinball.workflow.name.Name import get_input_prefix [as 别名]
def _make_job_runnable(self, job_token):
"""Attempt to make a job runnable.
Query event tokens in job inputs. If a combination of triggering
events exist, remove those events and make the job runnable.
Otherwise, do nothing.
Args:
job_token: The job token to make runnable.
Returns:
True if there were no errors during communication with the master,
otherwise False.
"""
job = pickle.loads(job_token.data)
name = Name.from_job_token_name(job_token.name)
request = QueryRequest(queries=[])
# TODO(pawel): handle jobs with no dependencies
assert job.inputs
for input_name in job.inputs:
prefix = Name()
prefix.workflow = name.workflow
prefix.instance = name.instance
prefix.job = name.job
prefix.input = input_name
query = Query()
query.namePrefix = prefix.get_input_prefix()
query.maxTokens = 1
request.queries.append(query)
try:
response = self._client.query(request)
except TokenMasterException:
# TODO(pawel): add a retry count and fail if a limit is reached.
LOG.exception('error sending request %s', request)
return False
triggering_events = Worker._get_triggering_events(response.tokens)
if triggering_events:
return self._move_job_token_to_runnable(job_token,
triggering_events)
return True