Signals

Signals of the orchestrator app.

They announce the Orchestrator’s api calls and each step of a run’s lifecycle: a run is queued by smarter.apps.orchestrator.runtime.start_run(), then started, stepped and finished by smarter.apps.orchestrator.runtime.execute_run(), in a Celery worker. A run’s signals let the platform observe it, e.g. to notify the user who started it, or to meter its steps, without polling its status.

Example:

from django.dispatch import receiver
from smarter.apps.orchestrator.signals import orchestration_run_finished

@receiver(orchestration_run_finished)
def notify(sender, run, **kwargs):
    ...
smarter.apps.orchestrator.signals.orchestration_run_finished = <django.dispatch.dispatcher.Signal object>

succeeded, failed or max_iterations_exceeded.

Parameters:

run (OrchestrationRun) – The run, whose status, result, error_message and iteration_count are final.

Example:

orchestration_run_finished.send(sender=finish, run=run)
Type:

Sent when a run ends, with its final status

smarter.apps.orchestrator.signals.orchestration_run_queued = <django.dispatch.dispatcher.Signal object>

Sent when a run is recorded, pending, and its execution is queued.

Parameters:

run (OrchestrationRun) – The run.

Example:

orchestration_run_queued.send(sender=start_run, run=run)
smarter.apps.orchestrator.signals.orchestration_run_started = <django.dispatch.dispatcher.Signal object>

Sent when a worker starts to execute a run, whose status is now running.

Parameters:

run (OrchestrationRun) – The run.

Example:

orchestration_run_started.send(sender=execute_run, run=run)
smarter.apps.orchestrator.signals.orchestration_step_finished = <django.dispatch.dispatcher.Signal object>

Sent when a step of a run is recorded, whether its LLMClient answered or the step failed.

Parameters:

Example:

orchestration_step_finished.send(sender=self.__class__, run=run, step=step)
smarter.apps.orchestrator.signals.orchestrator_called = <django.dispatch.dispatcher.Signal object>

Signal triggered when a orchestrator is called.

Parameters:
  • orchestrator (Orchestrator) – The orchestrator instance.

  • request (HttpRequest) – The HTTP request object.

  • args – Positional arguments.

  • kwargs – Keyword arguments.

Example:

orchestrator_called.send(sender=self.__class__, orchestrator=self.orchestrator, request=request, args=args, kwargs=kwargs)