Orchestrating Dataproc Jobs with Cloud Composer DAGs

PDE By islever Editorial Last updated

Deploying and operationalizing the pipelines. Designing automation and repeatability.

Short answer

C Create a Directed Acyclic Graph in Cloud Composer to orchestrate sequential and concurrent Spark jobs with automated scheduling.

Question

You have several Spark jobs that run on a Cloud Dataproc cluster on a schedule. Some of the jobs run in sequence, and some of the jobs run concurrently. You
need to automate this process. What should you do?
  1. Create a Cloud Dataproc Workflow Template
  2. Create an initialization action to execute the jobs
  3. Create a Directed Acyclic Graph in Cloud Composer Correct Answer
  4. Create a Bash script that uses the Cloud SDK to create a cluster, execute jobs, and then tear down the cluster

Key Takeaways

Cloud Composer (Airflow) is the correct choice because it natively supports complex dependency graphs (DAGs) and built-in scheduling, whereas Dataproc Workflow Templates lack native scheduling.

Learn how to automate scheduled Spark jobs with sequential and concurrent dependencies on Cloud Dataproc using Cloud Composer and Apache Airflow DAGs.

Common mistake: Candidates often choose A (Workflow Template) because it handles job sequencing/parallelism within Dataproc, but forget that it does not include scheduling, requiring additional components to fully automate the process.

Expert Analysis

The question requires automating a workflow involving Spark jobs on Dataproc with specific execution patterns: sequential dependencies and concurrent execution. The key constraint is the need to manage these complex relationships automatically.

A. Cloud Dataproc Workflow Template: While Workflow Templates allow you to define a set of jobs that can run sequentially or in parallel, they are essentially static blueprints. They do not have native scheduling capabilities. As noted in community comments, using this option would require an external scheduler (like Cloud Scheduler) to trigger the template, making it an incomplete solution on its own for 'automating' the entire process including timing.

B. Initialization action: Initialization actions are scripts that run only once when a cluster node starts. They cannot orchestrate multiple distinct jobs over time, nor can they handle scheduling or dynamic job submission after startup. This is incorrect.

C. Create a Directed Acyclic Graph in Cloud Composer: Cloud Composer is Google Cloud's managed Apache Airflow service. Airflow is explicitly designed for orchestrating complex workflows using Directed Acyclic Graphs (DAGs). DAGs allow you to define precise dependencies (sequential) and parallelism (concurrent) between tasks. Furthermore, Airflow has built-in scheduling capabilities, allowing you to automate the execution based on cron schedules or intervals. This directly addresses both the complexity of the job relationships and the automation requirement.

D. Bash script: While possible, writing a custom Bash script to create clusters, run jobs, and tear them down is inefficient and error-prone compared to managed services. It also lacks robust dependency management and monitoring features inherent in Airflow.

Therefore, Cloud Composer with a DAG is the most appropriate and complete managed solution for this scenario.

Official Reference

Exam Strategy

When asked to 'automate' a workflow involving dependencies, look for an orchestration tool like Airflow/Composer first. If the question mentions only job definition without scheduling, consider Workflow Templates. Always check if the selected tool has native scheduling; if not, it may be incomplete.

Frequently Asked Questions

Can Dataproc Workflow Templates schedule jobs?

No, Workflow Templates define the jobs but do not have native scheduling. You must use an external scheduler like Cloud Scheduler or Cloud Composer to trigger them.

Why not use a Bash script for automation?

While possible, custom scripts lack the robustness, retry logic, monitoring, and visual dependency management provided by managed orchestration tools like Cloud Composer.

More PDE FAQ →

Community Votes

C
82%
A
18%

82% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.

Discussion 18 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 18

  1. captainbu 👍 5
    I've would've gone for Workflow Templates as well. But those are lacking the scheduling capability. Hence you would need to use Cloud Composer (or Cloud Functions or Cloud Scheduler) anyway. Hence C seems to be the better solution. Pls see here: https://cloud.google.com/dataproc/docs/concepts/workflows/workflow-schedule-solutions
  2. LP_PDE 👍 5
    Correct answer is A. https://cloud.google.com/dataproc/docs/concepts/workflows/using-workflows
  3. devaid 👍 4 Answered C
    C. Composer fits better to schedule Dataproc Workflows, check the documentation: https://cloud.google.com/dataproc/docs/concepts/workflows/workflow-schedule-solutions Also A is not enough. Dataproc Workflow Template itself don't has a native schedule option.
  4. MaxNRG 👍 3
    While the other options have some merit, they fall short in certain aspects: A. Cloud Dataproc Workflow Templates: While workflow templates can automate job submission on a cluster, they lack the ability to define dependencies and coordinate concurrent execution effectively. B. Initialization action: An initialization action can only run a single script before a Dataproc cluster starts, not suitable for orchestrating multiple scheduled jobs with dependencies. D. Bash script: A Bash script might work for simple cases, but it can be cumbersome to manage and lacks the advanced scheduling and error handling capabilities of Cloud Composer. Therefore, utilizing a Cloud Composer DAG offers the most comprehensive and flexible solution for automating your scheduled Spark jobs with sequential and concurrent execution on Cloud Dataproc.
  5. MaxNRG 👍 3 Answered C
    The best option for automating your scheduled Spark jobs on Cloud Dataproc, considering sequential and concurrent execution, is: C. Create a Directed Acyclic Graph (DAG) in Cloud Composer.
Show 13 more comments
  1. AzureDP900 👍 3
    C. Create a Directed Acyclic Graph in Cloud Composer
  2. MaxNRG 👍 2
    Here's why: DAG workflows: Cloud Composer excels at orchestrating complex workflows with dependencies, making it ideal for managing sequential and concurrent execution of your Spark jobs. You can define dependencies between tasks to ensure certain jobs only run after others finish. Automation: Cloud Composer lets you schedule workflows to run automatically based on triggers like time intervals or data availability, eliminating the need for manual intervention. Integration: Cloud Composer integrates seamlessly with Cloud Dataproc, allowing you to easily launch and manage your Spark clusters within the workflow. Scalability: Cloud Composer scales well to handle a large number of jobs and workflows, making it suitable for managing complex data pipelines.
  3. midgoo 👍 2 Answered C
    I would choose A if there was one more step to schedule the Template. It is like creating DAG without running it in Airflow. So only option C is correct here.
  4. louisgcpde 👍 2
    To me, the point is "automate" the process, so that Composer DAG is needed and can be used with Dataproc Workflow Template.
  5. saurabhsingh4k 👍 2 Answered A
    Why go for an expensive Composer when you only have to schedule and create a DAG for Dataproc, A is sufficient.
  6. dmzr 👍 2 Answered A
    Ans A makes more sense, since a question is regarding Dataproc jobs only
  7. barnac1es 👍 1 Answered C
    Directed Acyclic Graph (DAG): Cloud Composer (formerly known as Cloud Composer) is a managed Apache Airflow service that allows you to create and manage workflows as DAGs. You can define a DAG that includes tasks for running Spark jobs in sequence or concurrently. Scheduling: Cloud Composer provides built-in scheduling capabilities, allowing you to specify when and how often your DAGs should run. You can schedule the execution of your Spark jobs at specific times or intervals. Dependency Management: In a DAG, you can define dependencies between tasks. This means you can set up tasks to run sequentially or concurrently based on your requirements. For example, you can specify that Job B runs after Job A has completed, or you can schedule jobs to run concurrently when there are no dependencies.
  8. carbonscave 👍 1 Answered C
    Why C is correct Complex Dependencies (DAGs): Cloud Composer is a fully managed workflow orchestration service built on Apache Airflow. Airflow is designed around the concept of Directed Acyclic Graphs (DAGs), which makes it the perfect tool for explicitly defining complex relationships where some Spark jobs must wait for others to finish (sequence) while others can execute at the same time (concurrently). Built-in Scheduling: The prompt explicitly states the jobs must run "on a schedule." Cloud Composer has a native, highly robust scheduler built right into the platform, allowing you to trigger these complex workflows automatically based on time (cron) or event-driven triggers.
  9. skhaire 👍 1
    A. Create a Cloud Dataproc Workflow Template Dataproc Workflow Template can be used to run jobs concurrently and sequentially. DAG is an overkill. https://cloud.google.com/dataproc/docs/concepts/workflows/use-workflows
  10. emmylou 👍 1 Answered C
    I thought it might be A but the templates can only run sequentially, not concurrently.
  11. ducc 👍 1 Answered C
    You have streaming and batch job, so Composer is the choice for me
  12. louisgcpde 👍 1 Answered C
    So that I thing the answer should be C (Composer).
  13. HarshKothari21 👍 1 Answered C
    Option c

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

← Back to PDE Study Guide