Bird
0
0

Given the following Python snippet using Google Cloud Dataproc API to submit a Hadoop job, what will be the output if the job completes successfully?

medium📝 Predict Output Q13 of 15
Hadoop - Modern Data Architecture with Hadoop
Given the following Python snippet using Google Cloud Dataproc API to submit a Hadoop job, what will be the output if the job completes successfully?
from google.cloud import dataproc_v1
client = dataproc_v1.JobControllerClient()
job = {
  "placement": {"cluster_name": "my-cluster"},
  "hadoop_job": {"main_jar_file_uri": "gs://my-bucket/my-job.jar"}
}
response = client.submit_job(project_id="my-project", region="us-central1", job=job)
print(response.status.state)
AJobStatus.State.DONE
BJobStatus.State.ERROR
CJobStatus.State.RUNNING
DJobStatus.State.PENDING
Step-by-Step Solution
Solution:
  1. Step 1: Understand the job submission and response

    The submit_job method returns a job response with a status field indicating job state.
  2. Step 2: Interpret the status.state value after submission

    The submit_job returns immediately with initial state JobStatus.State.PENDING. The print occurs right after submission, before completion, even if the job succeeds later.
  3. Final Answer:

    JobStatus.State.PENDING -> Option D
  4. Quick Check:

    submit_job initial state = PENDING [OK]
Quick Trick: submit_job returns PENDING immediately [OK]
Common Mistakes:
  • Thinking the code waits for DONE on completion
  • Confusing initial PENDING with final state
  • Assuming RUNNING or ERROR on submission

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Hadoop Quizzes