Skip to content

feat: Include plan outcome in WorkerEvents#1357

Open
tpoliaw wants to merge 14 commits intomainfrom
plan-result
Open

feat: Include plan outcome in WorkerEvents#1357
tpoliaw wants to merge 14 commits intomainfrom
plan-result

Conversation

@tpoliaw
Copy link
Contributor

@tpoliaw tpoliaw commented Jan 27, 2026

The TaskStatus included in each WorkerEvent now contains a result
field that will be populated when the plan is complete. This can be
either a TaskResult that contains a serialized representation of the
return value from a plan that succeeded, or a TaskError containing the
Exception type and message raised by a plan that failed.

The existing task_complete and task_failed flags have been left for
backwards compatibility but are now redundant and may be removed in a
future version.

Error reporting in WorkerEvents is left unchanged for now but may also
change in future as plan errors are included in the worker error list
making it unclear where an error occurred.

The new outcome states in the returned TaskStatus allows better
feedback in the CLI and errors/return values are included in the output.

The BlueapiClient run_task method now returns only the TaskStatus as it
now contains all relevant information about the plan. A plan failing
will now not raise an exception with exceptions being raised only in the
case of the communication errors or internal server errors. Users of the
client should check if plans were successful.

@tpoliaw tpoliaw requested a review from DominicOram January 27, 2026 16:48
@tpoliaw tpoliaw linked an issue Jan 27, 2026 that may be closed by this pull request
@tpoliaw
Copy link
Contributor Author

tpoliaw commented Jan 27, 2026

This would need a matching change in GDA (back-ported to 9.38?) to add the result type to TaskStatus here.

@tpoliaw tpoliaw changed the title WIP returning results from plans Include plan return values in WorkerEvents Jan 29, 2026
@tpoliaw tpoliaw marked this pull request as ready for review January 29, 2026 16:15
@tpoliaw tpoliaw requested a review from a team as a code owner January 29, 2026 16:15
@tpoliaw
Copy link
Contributor Author

tpoliaw commented Jan 29, 2026

Ignoring the GDA change, I think the blueapi side of this is workable

@tpoliaw tpoliaw changed the title Include plan return values in WorkerEvents feat!: Include plan return values in WorkerEvents Jan 29, 2026
@tpoliaw
Copy link
Contributor Author

tpoliaw commented Jan 29, 2026

Change in gerrit: https://gerrit.diamond.ac.uk/c/gda/gda-core/+/44673

Copy link
Contributor

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks. Should: it would be nice to add some tests on the case where the plan is actually returning something, ideally parametrized against a few different return types.

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.01%. Comparing base (23e780d) to head (5f316d8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1357      +/-   ##
==========================================
- Coverage   95.03%   95.01%   -0.02%     
==========================================
  Files          43       43              
  Lines        2780     2830      +50     
==========================================
+ Hits         2642     2689      +47     
- Misses        138      141       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tpoliaw tpoliaw changed the title feat!: Include plan return values in WorkerEvents feat: Include plan return values in WorkerEvents Feb 9, 2026
@tpoliaw
Copy link
Contributor Author

tpoliaw commented Feb 11, 2026

Putting this back to draft so #1312 can be included in the result

@tpoliaw tpoliaw marked this pull request as draft February 11, 2026 15:03
Allow callers to access both return values and exceptions raised by
plans.
@tpoliaw tpoliaw marked this pull request as ready for review February 13, 2026 11:56
@tpoliaw tpoliaw requested a review from DominicOram February 13, 2026 11:56
@tpoliaw tpoliaw changed the title feat: Include plan return values in WorkerEvents feat: Include plan outcome in WorkerEvents Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return plan_result to the client BlueAPI should expose type information from exceptions raised in plans to calling clients.

2 participants