Anirban
Anirban

Reputation: 277

AWS Glue job status using Java SDK

I have used below code to invoke Glue job from Lambda written in Java. How do I get the status of the job ?

    AWSGlue awsGlueClient = AWSGlueClient.builder().withRegion("us-east-1").build();
    StartJobRunRequest jobRunRequest = new StartJobRunRequest();
    jobRunRequest.setJobName("my_transformer");
    jobRunRequest.addArgumentsEntry("--Mode",mode);
    jobRunRequest.addArgumentsEntry("--Paramfile",paramfile);
    StartJobRunResult jobRunResult = 
    awsGlueClient.startJobRun(jobRunRequest);

Upvotes: 1

Views: 2159

Answers (2)

smac2020
smac2020

Reputation: 10704

We are building new Java V2 examples to work with AWS Glue. Once done, I will post a link to these new V2 examples. We will cover common use cases like how to create a crawler, how to start a crawler, and so on.

UPDATE See the GlueScenario.java example that demonstrates how to perform multiple AWS Glue operations.

https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/javav2/example_code/glue/src/main/java/com/example/glue/GlueScenario.java

Upvotes: 0

Harsh Bafna
Harsh Bafna

Reputation: 2224

The startJobRun function/action returns "JobRunId" which is a UTF-8 string and represents the ID assigned to current job run.

The GetJobRun function/action retrieves the metadata for a given job run. It takes the JobRunId as input and returns a JobRun object from which you can pull out current job status.

Reference AWS documentation :

AWS Glue start job run

AWS Glue get job run

AWS Glue Job Run Object structure

Upvotes: 1

Related Questions