Exemple #1
0
def pipeline_helper(start_time):
    '''Wrapper function.'''
    arg_parser = build_arg_parse()
    args = arg_parser.parse_args()
    config = make_config(args)
    if config['verbose']:
        print_header(config)
    pipeline.pipeline(config)
    if config['verbose']:
        print_footer(start_time)
Exemple #2
0
	def test_badexec(self):
		cmd1 = (self.unique, self.unique)
		failed = 0
		results = [] 
		try:
			p1 = pipeline.pipeline(cmd1)
		except Exception as e:
			results.append('passed')
			return
		self.assertNotEqual(results[0], 'passed')
Exemple #3
0
	def test_error(self):
		result = None
		try:
			cmd1 = (sys.executable, '-c' ,'raise RuntimeError("some error")')
			p1 = pipeline.pipeline(cmd1)
			results=[]
			results = p1.close()
		except pipeline.PipelineError as e:
			result = ast.literal_eval(str(e.args[0]))

		self.assertNotEqual(None, result)
		self.assertEqual('process status' ,result['msg'])
Exemple #4
0
	def test_close_active(self):
		cmd1 = (sys.executable, sys.executable, '-c' ,'''
import time
time.sleep(10)
print("hello")
		''')
		p1 = pipeline.pipeline(cmd1)
		outchan = p1.open()
		result = None 
		try:
			p1.close()
		except pipeline.PipelineError as e:
			result = ast.literal_eval(str(e.args[0]))

		self.assertNotEqual(None, result)
		self.assertEqual('process status' ,result['msg'])
Exemple #5
0
	def test_test1(self):
		p1 = pipeline.pipeline(
			('yes', 'easy as py'),
			('cat'),
			('tr', 'a', 'A'),
			('tr', 'g', 'G'),
			('awk', '{ print $0 }'),
			('sed', 's/pipe/PIPE/g'),
			('sed', 's/import/IMPORT/g'),
		)
		chan = p1.open()
		data1 = chan.read(3)
		data2 = chan.read(3)
		p1.terminate()
		self.assertEqual(data1, 'eAs')
		self.assertEqual(data2, 'y A')
Exemple #6
0
def run(*args):
	p1 = pipeline.pipeline(*args)
	outchan = p1.open()
	data = outchan.read()
	p1.close()
	return data