Search in sources :

Example 1 with CloudDebugger

use of com.google.api.services.clouddebugger.v2.CloudDebugger in project beam by apache.

the class DataflowRunner method registerDebuggee.

private Debuggee registerDebuggee(CloudDebugger debuggerClient, String uniquifier) {
    RegisterDebuggeeRequest registerReq = new RegisterDebuggeeRequest();
    registerReq.setDebuggee(new Debuggee().setProject(options.getProject()).setUniquifier(uniquifier).setDescription(uniquifier).setAgentVersion("google.com/cloud-dataflow-java/v1"));
    try {
        RegisterDebuggeeResponse registerResponse = debuggerClient.controller().debuggees().register(registerReq).execute();
        Debuggee debuggee = registerResponse.getDebuggee();
        if (debuggee.getStatus() != null && debuggee.getStatus().getIsError()) {
            throw new RuntimeException("Unable to register with the debugger: " + debuggee.getStatus().getDescription().getFormat());
        }
        return debuggee;
    } catch (IOException e) {
        throw new RuntimeException("Unable to register with the debugger: ", e);
    }
}
Also used : RegisterDebuggeeResponse(com.google.api.services.clouddebugger.v2.model.RegisterDebuggeeResponse) Debuggee(com.google.api.services.clouddebugger.v2.model.Debuggee) RegisterDebuggeeRequest(com.google.api.services.clouddebugger.v2.model.RegisterDebuggeeRequest) IOException(java.io.IOException)

Example 2 with CloudDebugger

use of com.google.api.services.clouddebugger.v2.CloudDebugger in project beam by apache.

the class DataflowRunner method registerDebuggee.

private Debuggee registerDebuggee(Clouddebugger debuggerClient, String uniquifier) {
    RegisterDebuggeeRequest registerReq = new RegisterDebuggeeRequest();
    registerReq.setDebuggee(new Debuggee().setProject(options.getProject()).setUniquifier(uniquifier).setDescription(uniquifier).setAgentVersion("google.com/cloud-dataflow-java/v1"));
    try {
        RegisterDebuggeeResponse registerResponse = debuggerClient.controller().debuggees().register(registerReq).execute();
        Debuggee debuggee = registerResponse.getDebuggee();
        if (debuggee.getStatus() != null && debuggee.getStatus().getIsError()) {
            throw new RuntimeException("Unable to register with the debugger: " + debuggee.getStatus().getDescription().getFormat());
        }
        return debuggee;
    } catch (IOException e) {
        throw new RuntimeException("Unable to register with the debugger: ", e);
    }
}
Also used : RegisterDebuggeeResponse(com.google.api.services.clouddebugger.v2.model.RegisterDebuggeeResponse) Debuggee(com.google.api.services.clouddebugger.v2.model.Debuggee) RegisterDebuggeeRequest(com.google.api.services.clouddebugger.v2.model.RegisterDebuggeeRequest) IOException(java.io.IOException)

Example 3 with CloudDebugger

use of com.google.api.services.clouddebugger.v2.CloudDebugger in project beam by apache.

the class DataflowRunner method maybeRegisterDebuggee.

private void maybeRegisterDebuggee(DataflowPipelineOptions options, String uniquifier) {
    if (!options.getEnableCloudDebugger()) {
        return;
    }
    if (options.getDebuggee() != null) {
        throw new RuntimeException("Should not specify the debuggee");
    }
    CloudDebugger debuggerClient = DataflowTransport.newClouddebuggerClient(options).build();
    Debuggee debuggee = registerDebuggee(debuggerClient, uniquifier);
    options.setDebuggee(debuggee);
    System.out.println(debuggerMessage(options.getProject(), debuggee.getUniquifier()));
}
Also used : CloudDebugger(com.google.api.services.clouddebugger.v2.CloudDebugger) Debuggee(com.google.api.services.clouddebugger.v2.model.Debuggee)

Aggregations

Debuggee (com.google.api.services.clouddebugger.v2.model.Debuggee)3 RegisterDebuggeeRequest (com.google.api.services.clouddebugger.v2.model.RegisterDebuggeeRequest)2 RegisterDebuggeeResponse (com.google.api.services.clouddebugger.v2.model.RegisterDebuggeeResponse)2 IOException (java.io.IOException)2 CloudDebugger (com.google.api.services.clouddebugger.v2.CloudDebugger)1