Skip to content

Instantly share code, notes, and snippets.

@lantzbuilds
Last active January 27, 2026 21:46
Show Gist options
  • Select an option

  • Save lantzbuilds/20c504ef968dfcf69e5deafda255e06a to your computer and use it in GitHub Desktop.

Select an option

Save lantzbuilds/20c504ef968dfcf69e5deafda255e06a to your computer and use it in GitHub Desktop.
Backend Engineer II - Task Queue Coding Exercise (Candidate Instructions)

Task Queue Processor — Coding Exercise

Overview

Build a simple in-memory task queue in Python. Get as far as you can in 20 min.

Requirements

Implement a class with the following methods:

add_task(task_id, priority, payload)
  • Adds a task to the queue
  • Higher priority numbers = higher priority (e.g., priority 10 runs before priority 1)
  • payload can be any data associated with the task
get_next_task()
  • Returns the highest priority task and removes it from the queue
  • Should return task information (id, priority, payload)
get_status(task_id)
  • Returns the current status of a task
  • Possible statuses: queued, processing, completed
complete_task(task_id)
  • Marks a task as completed

Example Usage

queue = TaskQueue()

queue.add_task("task-1", priority=5, payload={"action": "send_email"})
queue.add_task("task-2", priority=10, payload={"action": "process_payment"})
queue.add_task("task-3", priority=1, payload={"action": "log_event"})

print(queue.get_status("task-1"))  # "queued"

task = queue.get_next_task()  # Returns task-2 (highest priority)
print(queue.get_status("task-2"))  # "processing"

queue.complete_task("task-2")
print(queue.get_status("task-2"))  # "completed"

Notes

  • Focus on getting a working solution first
  • Think aloud as you work — we want to understand your thought process
  • Feel free to ask clarifying questions
  • You may use AI coding assistants if that's part of your normal workflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment