<@ULVA73B9P> Will the new UI support custom Prefec...
# ask-marvin
l
@Marvin Will the new UI support custom Prefect flow states/results? For example, I’d like to have a custom
Skipped
state with a purple label. It shouldn’t be treated as either
Completed
or
Failed
, but as a separate state. The use case is when the flow executes successfully, but doesn’t actually make any changes. In that case, the flow technically completed without errors, but
Completed
is misleading because nothing was changed. I’d like to be able to represent this with a distinct
Skipped
state in the UI.
m
thought for 134.4 seconds
Short answer: partially. In Prefect 3.x, you can set a custom state name like
Skipped
, but you cannot create a brand-new underlying state type with its own separate UI semantics/color bucket. So for your example:
Copy code
python
from prefect import flow
from prefect.states import Completed

@flow
def my_flow():
    return Completed(
        name="Skipped",
        message="No changes were needed"
    )
That would show a state named
Skipped
, but it would still be a
COMPLETED
-type state under the hood. What that means in practice - It can display as
Skipped
- It will still be treated like
Completed
by orchestration logic - It will not be a distinct third category separate from completed/failed - You should not expect a custom purple label unless/until the UI explicitly supports color-by-name rather than color-by-type Prefect’s docs make this distinction explicit: state types drive orchestration logic, while state names are mostly for display/bookkeeping: - States docs Relevant note on custom names and emitted events: - Custom state names in docs So for your use case, the best current pattern is probably:
Copy code
python
from prefect import flow
from prefect.states import Completed

@flow
def sync_flow():
    changed = False

    if not changed:
        return Completed(
            name="Skipped",
            message="Execution succeeded, but no changes were applied."
        )

    return Completed(
        name="Completed",
        message="Changes were applied successfully."
    )
If you want, I can also show: 1. how this appears in automations/events, or 2. a cleaner pattern for distinguishing
Skipped
vs
Changed
in downstream monitoring.