Get job execution details

Demonstrates how to request detailed information about the execution status of the job.

Code sample

Go


package main

import (
	"context"

	dataflow "cloud.google.com/go/dataflow/apiv1beta3"
	"google.golang.org/api/iterator"
	dataflowpb "google.golang.org/genproto/googleapis/dataflow/v1beta3"
)

func main() {
	ctx := context.Background()
	c, err := dataflow.NewMetricsV1Beta3Client(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataflowpb.GetJobExecutionDetailsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/dataflow/v1beta3#GetJobExecutionDetailsRequest.
	}
	it := c.GetJobExecutionDetails(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

Python

from google.cloud import dataflow_v1beta3


def sample_get_job_execution_details():
    # Create a client
    client = dataflow_v1beta3.MetricsV1Beta3Client()

    # Initialize request argument(s)
    request = dataflow_v1beta3.GetJobExecutionDetailsRequest(
    )

    # Make the request
    page_result = client.get_job_execution_details(request=request)

    # Handle the response
    for response in page_result:
        print(response)

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.