-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add a non-interactive function to use softioc in deamon mode #156
Conversation
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.
The wait_for_quit
stuff looks straightforward enough (I've suggested a couple of minor code cleanups) ... but I don't see any mechanism for actually quitting (other than a signal).
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.
Thank you for the suggested code. It's a useful feature that we've previously done without due to never actually running as a daemon process in any of our deployments. It will be useful to have this option going forward.
I've made some code change suggestions. There's also a couple of odds and ends that need cleaning up:
- Please add an entry to the "Unreleased" section of the CHANGELOG.rst file, following the pattern (and rather picky syntax) of previous entries.
- Please add to the documentation. This should probably go directly below the section for
interactive_ioc
, i.e. define it at about line 123 of the filedocs/reference/api.rst
. Docs can be built usingpipenv run docs
, and viewed atbuild/html/index.html
- I would normally ask for a test or two to be written, but I think testing this will be tricky. I may add some tests at a later time.
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.
Apologies for the delay in reviewing this. It's looking good, just a couple of minor cleanup requests.
When we merge this we will also want to clean up the commit history - you are welcome to do this as part of these last cleanups (i.e squash into a single commit) or we'll do it as part of the merge.
modified: softioc/asyncio_dispatcher.py modified: softioc/cothread_dispatcher.py modified: softioc/softioc.py
Update cothread_dispatcher.py Update asyncio_dispatcher.py Co-authored-by: Alexander Wells <79699091+AlexanderWells-diamond@users.noreply.github.com>
This ensures we only set INVALID_ALARM+UDF_ALARM when there is no value, but otherwise both the severity and the status are set to NO_ALARM
Previously we did this as we wanted to spot the case where no value was provided, either during record creation or by a set() call at some later time, so that we could mark the record as being in an invalid state. Now that we store the severity and status alongside the value, we don't need to handle this special case.
Added documentation for the non_interactive_ioc function. Co-authored-by: Alexander Wells <79699091+AlexanderWells-diamond@users.noreply.github.com> Update asyncio_dispatcher.py Update softioc.py Optimizing the wait_for_quit() function Modify signal declaration
Hello, @AlexanderWells-diamond I've made the requested changes and also reduced the number of commits. Is there anything else I can do ? |
I have squashed this work into a single commit, fixed a couple of trivial whitespace issues, and pushed to master. This is now accepted (the "conflicts" are just my whitespace fixes), so will close this PR as completed. Thank you for this. |
I propose this modification, following the initial request #155
Reminder of the initial proposal:
I propose adding the non_interactive_ioc function to allow the use of softioc in daemon mode. This mode can, for example, be used with systemd. It is compatible with asyncio and cothread.
To ensure that information is correctly logged in the journal, it is recommended to execute the Python script with the
-u
option or to set the environment variablePYTHONUNBUFFERED=TRUE
.Here is an example of a service:
And an example of a script: