Workflow Status
You can monitor the status of the workflow by calling the running() method, which returns true if the workflow is still running and false if it has completed or failed.
while ($workflow->running());
Status Values
The status() method returns string statuses:
reserved
pending
running
waiting
cancelled
terminated
completed
failed
reservedmeans an instance id has been created but the first start command has not been accepted yetpendingmeans the run exists and has work ready to be claimedrunningmeans a workflow task is actively leased to a workerwaitingmeans the run is blocked on a durable resume source such as an activity, timer, or named signalcancelledmeans an accepted engine-level cancel command closed the current runterminatedmeans an accepted engine-level terminate command force-closed the current runcompleted,failed,cancelled, andterminatedare terminal run states
When a run uses continueAsNew(), the old run ends with status = completed and closed_reason = continued. Waterline keeps that run in the completed bucket while still surfacing the exact closed_reason so operators can see that the instance rolled forward into a newer run.
running() returns true for pending, running, and waiting.
State Machine
This is the state machine for a workflow status.