如何从disco python获得工作结果?
我尝试过迪斯科工作:
jmunsch@disco-master-5147:~$ disco jobs
KeyCount@5ca:2d323:53093
KeyCount@5ca:2bcb5:4f479
迪斯科结果:
jmunsch@disco-master-5147:~$ disco results "KeyCount@5ca:2bcb5:4f479"
dir://disco-node-9144/disco/disco-node-9144/1a/KeyCount@5ca:2bcb5:4f479/.disco/reduce-1001-1482183896238504.results
这是输入:
jmunsch@disco-master-5147:~$ disco jobdict "KeyCount@5ca:2bcb5:4f479"
inputs [ ... a bunch of inputs ... ]
pipeline [[u'iter_pgs_item', u'split', False], [u'reduce', u'group_label', False]]
save_info ddfs
worker virtualenvworker
save_results False
prefix KeyCount
scheduler {}
owner jenkins@jenkins-4139
相关:
https://github.com/discoproject/disco/search?p=3&q=dir%3A%2F%2F&utf8=%E2%9C%93
https://groups.google.com/forum/?nomobile=true#!searchin/disco-dev/job%20results%7Csort:relevance
答案 0 :(得分:1)
我打开了一个pull请求,但基本上这是一种方法,我希望将reduce结果作为len(2)元组流出,作为bin/discocli.py
的一部分:
@Disco.job_command
def results_get(program, jobname):
"""Usage: jobname
Print out the data of a completed job.
`disco jobs | xargs -IJOB_ID disco results_get JOB_ID`
"""
status, results = program.disco.results(jobname)
if sys.version_info[0] == 2:
binary_type = str
elif sys.version_info[0] == 3:
binary_type = bytes
if status == 'ready':
for line in program.disco.result_iterator(results):
if isinstance(line, binary_type):
line = line.decode('utf-8')
print(line)
请参阅: