🎯 Purpose

WorkflowFunctionRequest is the core unit of the workflow engine. Each workflow step becomes a separate request that must be executed by the target service (directory / manager / statistics / SSO / LOCAL).

🧭 Where it is created

There are two main creation sources in the service:

  1. API workflow start
    apps/api/v1/workflows/serializers.py
    → creates a request for the internal workflow start_new_workflow

  2. Step dispatcher
    apps/workflows/consumer.py_create_request(...)
    → creates a request for the next step based on the previous step response

🧩 Fields used in code

The following model fields are referenced directly in the code:

  • workflow — workflow name
  • service — target service
  • function — step function name
  • data_json — payload (JSON)
  • consumer_id — consumer id for a specific service
  • transaction_id — workflow transaction UUID
  • status — used to find PENDING
  • created — used to reassign PENDING requests by TTL

Full field list is in webpush.apps.workflows.models.

🔗 Relations

WorkflowFunctionRequest.responseWorkflowRequestResponse
Used in the debug endpoint and when restoring workflow state.

🔁 Lifecycle

  1. Request is created with status PENDING
  2. The target service consumer picks the request by consumer_id
  3. The service executes the function and creates WorkflowRequestResponse
  4. The dispatcher (run_workflow_dispatcher) builds the next step