Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:416rehman DeepZero ProcessorResult

From Leeroopedia
Knowledge Sources
Domains Pipeline_Orchestration, Extensibility
Last Updated 2026-10-27 00:00 GMT

Overview

Result type returned by Map and BulkMap processors, encoding status (completed/failed/timed_out), verdict (continue/filter), artifacts, and namespaced data.

Description

The ProcessorResult dataclass is the return type for MapProcessor.process() and BulkMapProcessor.process(). It carries the outcome of processing a single sample:

  • status: COMPLETED, FAILED, or TIMED_OUT. Determines whether the sample continues downstream.
  • verdict: CONTINUE (sample moves downstream) or FILTER (sample intentionally excluded). Only meaningful when status is COMPLETED.
  • artifacts: name → relative path mapping of files this processor produced (e.g., {"ghidra_result": "decompiled/ghidra_result.json"}).
  • data: namespaced output written to history[processor_name].data. Downstream stages access these via entry.upstream_data().
  • error: human-readable error message if status is FAILED.

Four factory class methods cover the common cases: ok(), filter(), fail(), and timed_out(). The timed_out() variant records the budget that was exceeded, so a retry knows what to give the sample next time.

Usage

  • Returning a successful result: ProcessorResult.ok(data={...}, artifacts={...})
  • Filtering a sample out: ProcessorResult.filter("reason string")
  • Reporting a failure: ProcessorResult.fail("error message")
  • Reporting a timeout: ProcessorResult.timed_out(budget_seconds)

Code Reference

Source Location

  • Repository: DeepZero
  • File: src/deepzero/engine/stage.py

Signature

@dataclass
class ProcessorResult:
    status: StageStatus
    verdict: Verdict = Verdict.CONTINUE
    artifacts: dict[str, str] = field(default_factory=dict)
    data: dict[str, Any] = field(default_factory=dict)
    error: str | None = None

    @classmethod
    def ok(
        cls, data: dict[str, Any] | None = None, artifacts: dict[str, str] | None = None
    ) -> ProcessorResult: ...

    @classmethod
    def filter(cls, reason: str = "", data: dict[str, Any] | None = None) -> ProcessorResult: ...

    @classmethod
    def fail(cls, error: str) -> ProcessorResult: ...

    @classmethod
    def timed_out(cls, budget: int) -> ProcessorResult: ...

Import

from deepzero.engine.stage import ProcessorResult

I/O Contract

Inputs

Name Type Required Description
data None No Namespaced output for downstream stages
artifacts None No Name → relative path of produced files
reason str No (filter) Why the sample was excluded
error str Yes (fail) Human-readable error message
budget int Yes (timed_out) Seconds the stage was given before timing out

Outputs

Name Type Description
status StageStatus COMPLETED / FAILED / TIMED_OUT
verdict Verdict CONTINUE / FILTER
data["filter_reason"] str Set by filter() if reason is provided
data["__timeout_budget"] int Set by timed_out() with the exceeded budget

Usage Examples

All Four Result Types

from deepzero.engine.stage import ProcessorResult

# Success: sample continues with data and artifacts
result = ProcessorResult.ok(
    data={"hash_count": 42, "is_kernel_driver": True},
    artifacts={"report": "output/report.txt"},
)

# Filter: sample excluded from downstream stages
result = ProcessorResult.filter("not a kernel driver", data={"subsystem": "GUI"})

# Failure: processing broke
result = ProcessorResult.fail("cannot read file: permission denied")

# Timeout: budget exhausted (not an error)
result = ProcessorResult.timed_out(budget=300)

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment