本文整理汇总了Python中pipeline.Pipeline.append方法的典型用法代码示例。如果您正苦于以下问题:Python Pipeline.append方法的具体用法?Python Pipeline.append怎么用?Python Pipeline.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pipeline.Pipeline
的用法示例。
在下文中一共展示了Pipeline.append方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pipeline
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import append [as 别名]
def test_pipeline():
p = Pipeline()
assert(len(p) == 0)
p = Pipeline([ajob])
assert(len(p) == 1)
assert_raises(ValueError, Pipeline, [notjob])
p.append(ajob)
assert(len(p) == 2)
示例2: App
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import append [as 别名]
class App(object):
exit_cond = threading.Event()
def __init__(self, configfile):
logger.info('App: starting ...')
self.configfile = configfile
self.config = get_env(self.configfile)
self.pipe = Pipeline(config=self.config)
# let's do init according to our purpose: IN next OUT
self.finput = self.pipe.create_module('file_input')
self.pipe.append(self.finput)
self.output = self.pipe.create_module('file_output')
self.pipe.append(self.output)
self.pipe.start()
self.core_processor = ThreadLoop(loop=self.processing_queue_loop)
self.core_processor.start()
def main(self):
rc = 0
try:
while not self.exit_cond.wait(.1):
time.sleep(.1)
except KeyboardInterrupt as e:
logger.warn('App: KeyboardInterrupt')
rc = -1
self.on_exit()
logger.info('App: exited with {}'.format(rc))
return rc
def processing_queue_loop(self):
try:
self.pipe.processing_loop()
except EOS as e:
logger.info('App: EOS')
self.core_processor.running = False
self.quit()
except Exception as e:
exc_type, exc_value, exc_tb = sys.exc_info()
logger.error('App: Fatal exception in processing_queue_loop')
logger.error('App: ' + ''.join(traceback.format_exception(exc_type, exc_value, exc_tb)))
self.core_processor.running = False
self.quit()
def quit(self):
self.exit_cond.set()
def on_exit(self):
logger.info('App: exit')
self.pipe.stop()
self.core_processor.stop()
示例3: test_iteration
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import append [as 别名]
def test_iteration():
new_p = Pipeline()
for j in p10:
new_p.append(j)
assert(new_p == p10)
示例4: get_pipeline
# 需要导入模块: from pipeline import Pipeline [as 别名]
# 或者: from pipeline.Pipeline import append [as 别名]
def get_pipeline(self):
pipeline = Pipeline()
for fid in self:
pipeline.append(self.reconstructor(fid))
return pipeline