-
Notifications
You must be signed in to change notification settings - Fork 218
[rqd] Add systemd-run launch mode #1758
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
base: master
Are you sure you want to change the base?
Conversation
Introduce a new `runSystemd` method to handle frame executions using `systemd-run` under Linux. This adds features like journaling and configurable properties for better resource management. Updated logic to utilize `runSystemd` instead of `runLinux`.
Add a comment to note the need for better handling of unset environment variables or failure to connect to the systemd-daemon.
Introduce a new `RQD_USE_SYSTEMD_RUN` configuration flag to toggle between `runSystemd` and `runLinux` methods for execution on Linux systems.
Add `cysystemd` version 2.0.1 to dependencies in `pyproject.toml`. Update `rqcore.py` to utilize `cysystemd.reader` for systemd journal reading, enhancing support for systemd functionality in RQD.
…d adjust systemd unit name format
Add a fallback mechanism to disable `RQD_USE_SYSTEMD_RUN` when `cysystemd` is not installed. Adjust imports dynamically to handle conditional usage of `cysystemd.reader`.
Add `import-outside-toplevel` to the pylint disable comments for `runSystemd` to address updated pylint rules.
Update `cysystemd` dependency to include a Python version constraint (`>=3.8`) in `pyproject.toml`.
…directory Add a temporary fix to delete `/usr/local/lib64/pkgconfig` to address an issue with the 2024 image in the testing pipeline.
…11 directory Extend the existing workaround for the 2024 image by adding steps to delete `/usr/local/lib64/python3.11`.
Simplify `cysystemd` dependency in `pyproject.toml` by removing the Python version constraint.
Move `cysystemd` to a dedicated `[systemd]` dependency group for better organization.
…nfig path substitution Extend the previous workaround by removing `pkgconfig/python*.pc` and updating `_sysconfigdata__linux_x86_64-linux-gnu.py` to address path issues in the 2024 image.
Improve the regular expression in the sed command to better handle path substitution for the Python environment fix.
…` in example config.
rqd/rqd/rqcore.py
Outdated
# TODO: Better handling if env vars are not set or not able to connect to the systemd-daemon | ||
self.frameEnv['DBUS_SESSION_BUS_ADDRESS'] = os.environ['DBUS_SESSION_BUS_ADDRESS'] | ||
systemdUnitName = f"rqd-{frameInfo.frameId}.service" |
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.
Please handle the case where the env is not set.
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.
Have added a check in rqconstants.py
similar to checking for the python module and made the fetch safer, using .get()
rqd/rqd/rqcore.py
Outdated
self.rqCore.updateRssThread.start() | ||
|
||
returncode = frameInfo.forkedCommand.wait() | ||
readerThread.join() |
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.
If an exception happens between the reader thread and here, you might have a thread leaked. Using a try/finally might add extra protection.
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.
Good point, will implement that.
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.
Has been added now
This looks like a good candidate to get your foot wet on rust/rqd. |
Have already been looking into a good library for interacting with journald, but still haven't found one I was satisfied with. |
Please document this feature before merging it in. |
Link the Issue(s) this Pull Request is related to.
#1757 and #1735
Summarize your change.
This adds the ability to run processes using systemd-run which starts them in it's own cgroup. Logs from the process is read from journald instead of piping the output.
This should still be considered an experimental feature.