Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/reference/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ components:
title: Errors
type: array
is_complete:
default: false
readOnly: true
title: Is Complete
type: boolean
is_pending:
Expand All @@ -389,6 +389,7 @@ components:
required:
- task_id
- task
- is_complete
title: TrackableTask
type: object
ValidationError:
Expand Down Expand Up @@ -449,7 +450,7 @@ info:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
title: BlueAPI Control
version: 1.5.0
version: 1.5.1
openapi: 3.1.0
paths:
/api/v1/devices:
Expand Down
2 changes: 1 addition & 1 deletion src/blueapi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class ApplicationConfig(BlueapiBaseModel):
"""

#: API version to publish in OpenAPI schema
REST_API_VERSION: ClassVar[str] = "1.5.0"
REST_API_VERSION: ClassVar[str] = "1.5.1"

LICENSE_INFO: ClassVar[dict[str, str]] = {
"name": "Apache 2.0",
Expand Down
12 changes: 8 additions & 4 deletions src/blueapi/worker/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from collections.abc import Mapping
from typing import Any

from bluesky.run_engine import RunEngineResult
from pydantic import BaseModel, Field, TypeAdapter

from blueapi.core import BlueskyContext
Expand Down Expand Up @@ -29,7 +30,7 @@ def prepare_params(self, ctx: BlueskyContext) -> Mapping[str, Any]:
# Re-create dict manually to avoid nesting in model_dump output
return {field: getattr(model, field) for field in model.__pydantic_fields__}

def do_task(self, ctx: BlueskyContext) -> None:
def do_task(self, ctx: BlueskyContext) -> Any:
LOGGER.info(
f"Asked to run plan {self.name} with {self.params} and "
f"metadata {self.metadata} for all runs"
Expand All @@ -39,9 +40,12 @@ def do_task(self, ctx: BlueskyContext) -> None:
prepared_params = self.prepare_params(ctx)
ctx.run_engine.md.update(self.metadata)
result = ctx.run_engine(func(**prepared_params))
if isinstance(result, tuple): # pragma: no cover
# this is never true if the run_engine is configured correctly
return None
if not isinstance(result, RunEngineResult):
# this is unreachable unless something has misconfigured it.
raise RuntimeError(
"RunEngine did not return a RunEngineResult - is "
"call_returns_result set on this RunEngine instance?"
)
return result.plan_result


Expand Down
Loading
Loading