python重定向jupyter上的sqoop执行输出

ni65a41a  于 2021-06-03  发布在  Sqoop
关注(0)|答案(0)|浏览(219)

我正在尝试将sqoop命令作为python的shell脚本执行,我正在jupyter中执行代码。我试图将执行的输出重定向到jupyter的output单元格,但是当我在shell中单独执行脚本时,我得到了原始输出的部分结果。下面是我的代码,请有人告诉我为什么我看不到所有日志:

try:  
    print 'Statring the execution of file:' + 'sh', './'+file_name
    print subprocess.check_output(['sh', './'+file_name], stderr=subprocess.PIPE, stdin=subprocess.PIPE)#, shell=True,stderr=subprocess.STDOUT
except subprocess.CalledProcessError as e:
    print 'Error Occurred'
    print("command '{}' return with error (code {}): {}".format(e.cmd,e.returncode,e.output))
print 'Execution finished'

我得到了以下输出:

Statring the execution of file:sh ./xxxxxxxxxx_30-jun-2019.sh
Warning: /opt/cloudera/parcels/CDH-5.13.1-1.cdh5.13.1.p0.2/bin/../lib/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.

Execution finished

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题