TensorTonic
Problems
ETL Dependency Orchestration
MLOps
Hard

Schedule ETL tasks that form a dependency graph under a shared resource budget. Each task has a unique name, positive integer duration, resource requirement, and depends_on list.

At each time value, first complete every running task whose end time has been reached. Next, collect unscheduled tasks whose dependencies are complete, sort them alphabetically, and greedily start each task that fits the remaining resource budget. Skipped tasks may start at a later completion event. Advance time to the next running-task completion.

Return a list of {"task_name": str, "start_time": int} dictionaries sorted by start time and then task name.

Loading visualization...

Examples

Input: tasks = [{"name": "extract", "duration": 2, "resources": 1, "depends_on": []}, {"name": "transform", "duration": 3, "resources": 1, "depends_on": ["extract"]}, {"name": "load", "duration": 1, "resources": 1, "depends_on": ["transform"]}], resource_budget = 2

Output: [{"task_name": "extract", "start_time": 0}, {"task_name": "transform", "start_time": 2}, {"task_name": "load", "start_time": 5}]

Explanation: Each task starts when its preceding dependency finishes.

Input: tasks = [{"name": "fetch_orders", "duration": 3, "resources": 1, "depends_on": []}, {"name": "fetch_users", "duration": 2, "resources": 1, "depends_on": []}, {"name": "join", "duration": 1, "resources": 2, "depends_on": ["fetch_users", "fetch_orders"]}], resource_budget = 2

Output: [{"task_name": "fetch_orders", "start_time": 0}, {"task_name": "fetch_users", "start_time": 0}, {"task_name": "join", "start_time": 3}]

Hint 1

Track running tasks as {name: end_time} and advance to min(running.values()).

Hint 2

After completions, sort ready task dictionaries with key=lambda task: task["name"].

Requirements

  • Start tasks only after all dependencies complete
  • Never exceed resource_budget
  • Consider ready tasks alphabetically at each event
  • Return the named schedule dictionaries in deterministic order

Constraints

  • Tasks form a directed acyclic graph
  • Every task fits within the resource budget
  • Names are unique and dependencies refer to existing tasks
Try Similar Problems
Monitoring Metrics SelectionHardETL Schema Validation in PythonHardRetraining Trigger DesignHardFeature Store LookupEasyETL DeduplicationEasyShadow Deployment EvaluationMediumDetect Train-Serving SkewMediumPoint-in-Time Feature JoinMediumSimulate Continuous BatchingHardSimulate Chunked Prefill SchedulingHardImplement Dynamic Request BatchingMediumOptimize Throughput and Cost Under a Latency SLOMedium
Scratchpad

Accepts: array

Accepts: number

You must run your code first.
ETL Dependency Orchestration

ETL Dependency Orchestration

MLOps
Hard

Schedule ETL tasks that form a dependency graph under a shared resource budget. Each task has a unique name, positive integer duration, resource requirement, and depends_on list.

At each time value, first complete every running task whose end time has been reached. Next, collect unscheduled tasks whose dependencies are complete, sort them alphabetically, and greedily start each task that fits the remaining resource budget. Skipped tasks may start at a later completion event. Advance time to the next running-task completion.

Return a list of {"task_name": str, "start_time": int} dictionaries sorted by start time and then task name.

Loading visualization...

Examples

Input: tasks = [{"name": "extract", "duration": 2, "resources": 1, "depends_on": []}, {"name": "transform", "duration": 3, "resources": 1, "depends_on": ["extract"]}, {"name": "load", "duration": 1, "resources": 1, "depends_on": ["transform"]}], resource_budget = 2

Output: [{"task_name": "extract", "start_time": 0}, {"task_name": "transform", "start_time": 2}, {"task_name": "load", "start_time": 5}]

Explanation: Each task starts when its preceding dependency finishes.

Input: tasks = [{"name": "fetch_orders", "duration": 3, "resources": 1, "depends_on": []}, {"name": "fetch_users", "duration": 2, "resources": 1, "depends_on": []}, {"name": "join", "duration": 1, "resources": 2, "depends_on": ["fetch_users", "fetch_orders"]}], resource_budget = 2

Output: [{"task_name": "fetch_orders", "start_time": 0}, {"task_name": "fetch_users", "start_time": 0}, {"task_name": "join", "start_time": 3}]

Hint 1

Track running tasks as {name: end_time} and advance to min(running.values()).

Hint 2

After completions, sort ready task dictionaries with key=lambda task: task["name"].

Requirements

  • Start tasks only after all dependencies complete
  • Never exceed resource_budget
  • Consider ready tasks alphabetically at each event
  • Return the named schedule dictionaries in deterministic order

Constraints

  • Tasks form a directed acyclic graph
  • Every task fits within the resource budget
  • Names are unique and dependencies refer to existing tasks
Try Similar Problems
Monitoring Metrics SelectionHardETL Schema Validation in PythonHardRetraining Trigger DesignHardFeature Store LookupEasyETL DeduplicationEasyShadow Deployment EvaluationMediumDetect Train-Serving SkewMediumPoint-in-Time Feature JoinMediumSimulate Continuous BatchingHardSimulate Chunked Prefill SchedulingHardImplement Dynamic Request BatchingMediumOptimize Throughput and Cost Under a Latency SLOMedium
Scratchpad

Accepts: array

Accepts: number

You must run your code first.
Problems
Loading...
1 / 1