Execution Runner

Modified on Tue, 14 Jul at 11:35 AM

The web server receives transform requests, but the execution runner is the component that actually schedules and tracks transform runs. The runner also invokes middleware hooks, stores intermediate results, and cleans up stale run state.

Runner types

The SDK supports two runner modes through maltego.server.TransformRunnerType:

RunnerWhen to use it
TransformRunnerType.THREADEDDefault. Use it when transforms or dependencies contain blocking code. The server starts worker threads and each worker runs its own asyncio loop.
TransformRunnerType.ASYNCUse it when your transforms and middleware are fully async and you want lower overhead on the main event loop.

Configuration

Configure the runner through MaltegoServerSettings:

from maltego.server import MaltegoServerSettings, TransformRunnerType


settings = MaltegoServerSettings(
    server_name="Acme Transforms",
    ns="acme",
    author="dev@acme.com",
    transform_runner=TransformRunnerType.THREADED,
    num_worker=4,
    transform_execution_timeout=900,
    middleware_execution_timeout=120,
    scheduled_cleanup_seconds=60,
)

The important settings are:

  • transform_runner: selects threaded vs async execution
  • num_worker: only used by the threaded runner
  • transform_execution_timeout: maximum runtime for a transform
  • middleware_execution_timeout: maximum runtime for each middleware hook
  • scheduled_cleanup_seconds: cleanup interval for inactive execution state

Execution lifecycle

At a high level, a transform run goes through these steps:

  1. the server parses input and normalizes transform settings
  2. before_transform(...) middleware hooks run
  3. the transform executes
  4. after_transform(...) middleware hooks run
  5. the runner keeps the result available until the cleanup window expires

The cleanup loop marks inactive runs as timed out and removes them on later passes, which is why scheduled_cleanup_seconds also acts as the runner's retention window for stale executions.

  • See the Server Configuration article.
  • See the Transform Middlewares article.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article