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

adding post-abort start and active check endpoints #200

Merged
merged 4 commits into from
Nov 6, 2024
Merged

Conversation

amitschang
Copy link
Member

@amitschang amitschang commented Oct 28, 2024

Resolves #198

Does so by adding a start endpoint which is basically just an update setting enable_control and enable_commit to true. It also adds an "active" flag, exposed both in healthz and state, which indicates if those activities are being done.

Copy link

codecov bot commented Oct 28, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
evolver/app/main.py 87.50% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@@ -71,6 +71,10 @@ def schema(self):
"controllers": [{"kind": str(type(a)), "config": a.Config.model_json_schema()} for a in self.controllers],
}

@property
def active(self):
return self.enable_control and self.enable_commit
Copy link
Member

Choose a reason for hiding this comment

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

I'm just wondering how this might intuitively get interpreted by someone manually controlling the hardware, i.e., not using control but committing commands?

"active" sounds to me like they should be able to but the above implies that you shouldn't/can't. We could have a "running" status flag, however at that point, you literally just have these two flags. Perhaps it's best to nuke this state reduction and just natively report both enable_control and enable_commit in the healthz resp?

Copy link
Member Author

Choose a reason for hiding this comment

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

Really lack of commit is what should make it inactive, but no control would generally mean nothing to commit.

But also I wonder if maybe these needn't be separate. Perhaps I can just make enable_control mean both execute control and commit - the separation is probably not too useful...

Copy link
Member

Choose a reason for hiding this comment

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

Really lack of commit is what should make it inactive, but no control would generally mean nothing to commit.

Exactly.

But also I wonder if maybe these needn't be separate. Perhaps I can just make enable_control mean both execute control and commit - the separation is probably not too useful...

Do you mean separate at all or just as reported from healthz?

With the way we have the configuration setup, I def think it's needed to have both. One deactivates hardware control (enable_commit) and the other starts the controller(s)/experiment running (enable_control). Removing enable_control would require someone who wants to pause an experiment (control) and manually interact with the hardware to have to stop the running experiment by creating a new config with the control section omitted. Seems burdensome to me, no?

Copy link
Member

Choose a reason for hiding this comment

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

Really lack of commit is what should make it inactive, but no control would generally mean nothing to >commit.

Exactly.

Actually, I'm not sure if that's entirely accurate as enable_commit is only checked in evolver.device.Evolver.loop_once and not at any communication layer. So a user could programmatically control the hardware still from the SDK (but not the app).

@amitschang
Copy link
Member Author

I've gotten rid of enable_commit as a separate lever, it doesn't seem so useful since if we run the control code we pretty much just expect commits as a side-effect, and if we commit we ought to have made proposals.

Also just FYI, if there is control done via web API calls, this would operate independent of loop anyhow. Abort relates just to activity of the in-process loop (in addition of course to stopping devices). If that ought to change, we can do so separate from this PR

@amitschang amitschang requested a review from jamienoss November 6, 2024 15:50
@amitschang amitschang merged commit 67b1924 into main Nov 6, 2024
8 checks passed
@amitschang amitschang deleted the gh-198-restart branch November 6, 2024 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a start endpoint to start/restart control after having aborted
2 participants