Skip to content

[feature:gsoc26] Add MassCommand asynchronous execution pipeline for batch device commands #1344

@dee077

Description

@dee077

Is your feature request related to a problem? Please describe.

Currently, in the controller module, command execution is limited to a single device at a time through the Command model and the existing asynchronous launch_command task. While this works well for individual device management, it becomes inefficient for operational scenarios where administrators need to run the same command across dozens or hundreds of devices, such as checking uptime, verifying interface status, or collecting diagnostics across an organization, device group, or location.

At the moment, there is no backend abstraction for grouping command executions under a single operation, tracking the overall execution state of a batch, or associating individual command executions with a parent operation. This makes large-scale command execution difficult to manage, monitor, and extend through admin views or APIs.

Describe the solution I would implement

I would like to introduce a backend foundation for mass command execution by adding a new MassCommand model and execution pipeline that builds on top of the existing single-command workflow.

  1. Introduce an abstract AbstractMassCommand model (and concrete MassCommand) to represent a batch command operation and support device targeting using filters such as:

    • all devices
    • organization
    • device group
    • location
    • manual device selection
  2. Store command metadata such as:

    • command type
    • command input
    • execution status (idle, processing, success, failed)
  3. On creation of a MassCommand, schedule a new asynchronous Celery task launch_mass_command using transaction.on_commit. The batch task will:

    • create individual Command objects for each device
    • reuse the existing launch_command execution pipeline for actual device execution
    • Aggregate execution progress at the MassCommand level based on the status of child commands.
  4. Add a new WebSocket endpoint to listen to real-time status updates for mass command execution, allowing the frontend to receive and display command progress and final execution states such as success or failure.

Metadata

Metadata

Assignees

Labels

enhancementgsocPart of a Google Summer of Code project

Projects

Status

ToDo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions