-
Notifications
You must be signed in to change notification settings - Fork 6
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
Improvements to session.status #371
Conversation
Just a warning that during PR revisions I will be force-pushing this branch to change my commit message typo "have-baked" to the intended "half-baked" :P |
Comment from @jlashner -- maybe session.degraded instead of using session.data['degraded'], as some agents might be storing a non-dict in session.data, which would break session.data.get. However: don't do that ... can we find all agents that mis-use session.data? |
de16c07
to
92839c7
Compare
Latest commit changes to using I suppose this needs something in the docs, too; perhaps someone can suggest exactly where that would best be added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me!
Latest commit changes to using
session.degraded
instead ofsession.data['degraded']
.I suppose this needs something in the docs, too; perhaps someone can suggest exactly where that would best be added.
How about an example for how to check for degraded status on "Clients and Control Programs" page?
https://ocs.readthedocs.io/en/main/developer/clients.html#examples
Thanks. Added an example to the docs. Will rebase when docs build is fixed on main. |
Docs build now fixed on |
This means that set_status('running') won't return until the status has actually been updated to 'running'.
This removes the need to set_status('running') "manually" at the start of every op.
Mostly "running" but also some "starting"
6e69d90
to
fb11e5a
Compare
Description
Primary changes:
session.op_code
enum has a new value "DEGRADED" (8), which is returned in the case that an operation is "running" but hassession.data['degraded']
exists and is Truesession.status
will automatically be put in state "running" just before launching the agent operation codesession.set_status
from a "blocking" operation (i.e. from a worker thread), the code now blocks while waiting for the status to change (the change is made in the reactor thread). This means that one can reasonably expect thatset_status('running')
does not return untilsession.status == 'running'
. (This is less useful, given the point above ...session.publish_status
has been removed. Previously, this was called wheneversession.add_message
was called, and caused the encoded session to be pushed to{agent_address}.feed
. I am pretty sure that no one uses this feed. TheRegistry
uses the heartbeat to get op_code.As a result, also:
The side-effects of this should be minimal. Agents that call
session.set_status('running')
, even though it's already running, will not get an error or anything. Agents that don't implement session.data['degraded'] don't need to worry about activating the DEGRADED op code.Motivation and Context
Addresses #357 and #367.
How Has This Been Tested?
Tested extensively with FakeDataAgent. Before removing interfaces, I checked that there are no users in ocs, socs, ocs-web.
Types of changes
Checklist: