Beeline 无法在 python 中使用 subprocess.run,永远卡住
Beeline not working with subprocess.run in python, getting stuck forever
我正在尝试从 Python 脚本和 运行 hql 脚本通过直线连接。我无法 运行 与 subprocess.run 或 subprocess.popen。我可以 运行 直接在命令提示符下
beeline_connect=str('"jdbc:hive2://192.168.0.100:10000/serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;transportMode=http;httpPath=cliservice;principal=hive/system1.example.co.in@EXAMPLE.CO.IN"')
#passing params as a list
param_list= ['beeline -u' + beeline_connection,'-hivevar', 'VAR1=val1', '-hivevar', 'VAR2=val2', '-hivevar', 'VAR3=val3', '-hivevar', 'VAR4=val4', '-hivevar', 'VAR5=val5', '-f', '/my/path/filename.hql']
command = subprocess.run(param_list, check=True, stdout=subprocess.PIPE)
output = command.stdout
status = str(output.decode('utf-8'))
print(
'****Its failed****, return code {1} with return count {2} :'.format(command.returncode, status))
if command.returncode > 0:
print('Job failed. Raising exception')
raise Exception('Job ' + job_name + ' failed')
else:
## do something else###
#####我也尝试过使用 shell=True 和 False,并删除 stdout
它永远卡住了,我联系直线命令的方式有什么问题吗?我尝试了以下连接的许多组合,但没有运气。任何帮助将不胜感激。谢谢
param_list =['beeline', '-u' + beeline_connection...]
param_list =['beeline', '-u', beeline_connection....]
如下更改代码行对我有用
param_list= ['beeline', '-u',beeline_connection,'-hivevar', 'VAR1=val1', '-hivevar', 'VAR2=val2', '-hivevar', 'VAR3=val3', '-hivevar', 'VAR4=val4', '-hivevar', 'VAR5=val5', '-f', '/my/path/filename.hql']
我正在尝试从 Python 脚本和 运行 hql 脚本通过直线连接。我无法 运行 与 subprocess.run 或 subprocess.popen。我可以 运行 直接在命令提示符下
beeline_connect=str('"jdbc:hive2://192.168.0.100:10000/serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=hiveserver2;transportMode=http;httpPath=cliservice;principal=hive/system1.example.co.in@EXAMPLE.CO.IN"')
#passing params as a list
param_list= ['beeline -u' + beeline_connection,'-hivevar', 'VAR1=val1', '-hivevar', 'VAR2=val2', '-hivevar', 'VAR3=val3', '-hivevar', 'VAR4=val4', '-hivevar', 'VAR5=val5', '-f', '/my/path/filename.hql']
command = subprocess.run(param_list, check=True, stdout=subprocess.PIPE)
output = command.stdout
status = str(output.decode('utf-8'))
print(
'****Its failed****, return code {1} with return count {2} :'.format(command.returncode, status))
if command.returncode > 0:
print('Job failed. Raising exception')
raise Exception('Job ' + job_name + ' failed')
else:
## do something else###
#####我也尝试过使用 shell=True 和 False,并删除 stdout
它永远卡住了,我联系直线命令的方式有什么问题吗?我尝试了以下连接的许多组合,但没有运气。任何帮助将不胜感激。谢谢
param_list =['beeline', '-u' + beeline_connection...]
param_list =['beeline', '-u', beeline_connection....]
如下更改代码行对我有用
param_list= ['beeline', '-u',beeline_connection,'-hivevar', 'VAR1=val1', '-hivevar', 'VAR2=val2', '-hivevar', 'VAR3=val3', '-hivevar', 'VAR4=val4', '-hivevar', 'VAR5=val5', '-f', '/my/path/filename.hql']