如何使用python客户端实时捕获来自HiveServer2的查询日志?

时间:2015-09-11 18:37:09

标签: python hadoop hive thrift hue

我使用pyhs2(https://pypi.python.org/pypi/pyhs2)的修改版本,能够在Hue(https://github.com/cloudera/hue/blob/master/apps/beeswax/gen-py/TCLIService/TCLIService.py#L739)的源代码中运行异步查询和来自TCLIService.Client(GetLog,send_GetLog,recv_GetLog)的其他方法

但是当我运行TCLIService.Client.GetLog方法时,出现错误:

public final class A {

    private final A2 a2;
    // other fields

    public A(A2 a2) { 
        this.a2 = a2;
    }
}

public final class B {

    private final B2 b2;
    // other fields

    public B(B2 b2) {
        this.b2 = b2;
    }
}

public final class C {

    private final A2 a2 = new A2();
    private final B2 b2 = new B2();

    ...

    public void setMember7(String s) {
        b2.setMember7(s);
    }

    public String getMember7() {
        return b2.getMember7();
    }

    ...

    public A getA() {
        return new A(a2);
    }

    public B getB() {
        return new B(b2);
    } 
}

在脚本中我使用Cloudera VM的HiveServer2。正如我所说的那样,Hue使用相同的服务器并且它成功运行。另外,我尝试使用0到7范围内的client_protocol来创建会话。

$ python example.py 
Traceback (most recent call last):
  File "example.py", line 85, in <module>
    rq = client.GetLog(lq)
  File "/Users/toly/hive_streaming/libs/pyhs4/TCLIService/TCLIService.py", line 757, in GetLog
    return self.recv_GetLog()
  File "/Users/toly/hive_streaming/libs/pyhs4/TCLIService/TCLIService.py", line 773, in recv_GetLog
    raise x
thrift.Thrift.TApplicationException: Invalid method name: 'GetLog'

如何实时捕获来自HiveServer2的配置单元查询日志?

UPD Hive版本 - 1.2.1

0 个答案:

没有答案