Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make worker queue have a size of 1 #158

Merged
merged 4 commits into from
May 3, 2023

Conversation

rosesyrett
Copy link
Contributor

made queue have one thing in it. Raising error if attempt to submit while worker is running

@rosesyrett
Copy link
Contributor Author

I would write tests for this, but we need #145 to be merged before we can do that. So I think this should be a WIP until that is done.

@rosesyrett rosesyrett changed the title make worker queue have a size of 1 WIP: make worker queue have a size of 1 May 2, 2023
@codecov
Copy link

codecov bot commented May 2, 2023

Codecov Report

Merging #158 (239da6d) into main (b6453d9) will increase coverage by 0.12%.
The diff coverage is 100.00%.

❗ Current head 239da6d differs from pull request most recent head 10a0ab8. Consider uploading reports for the commit 10a0ab8 to get more accurate results

@@            Coverage Diff             @@
##             main     #158      +/-   ##
==========================================
+ Coverage   82.95%   83.07%   +0.12%     
==========================================
  Files          39       40       +1     
  Lines        1103     1111       +8     
==========================================
+ Hits          915      923       +8     
  Misses        188      188              
Impacted Files Coverage Δ
src/blueapi/worker/reworker.py 80.35% <100.00%> (+0.60%) ⬆️
src/blueapi/worker/worker_busy_error.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rosesyrett
Copy link
Contributor Author

solves #157

@rosesyrett
Copy link
Contributor Author

there's a lot more changes in this than there ought to be... investigating now.

@rosesyrett rosesyrett changed the title WIP: make worker queue have a size of 1 make worker queue have a size of 1 May 3, 2023
@@ -125,3 +126,12 @@ def on_event(event: E, event_id: Optional[str]) -> None:
sub = stream.subscribe(on_event)
future.add_done_callback(lambda _: stream.unsubscribe(sub))
return future


def test_worker_only_accepts_one_task_on_queue(worker: Worker, timeout: float = 5.0):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Timeout is unused

@rosesyrett rosesyrett merged commit 7f55f9a into DiamondLightSource:main May 3, 2023
@rosesyrett rosesyrett deleted the one-task-on-queue branch May 3, 2023 10:48
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.

2 participants