Feeds
Limit Application Memory Usage with systemd
I saw this question on KDE forum about how to limit memory usage of a specific application in KDE, using systemd specifically. I did some research on that.
Resource control in systemdman systemd.resource-control lists plenty of options that we can set to a cgroup. E.g., to limit the memory usage of a service, we can add:
MemoryAccounting=yes MemoryHigh=2Gunder the [Service] section of its .service file.
The difference between this and ulimit is that ulimit is per process, while systemd resource control is per cgroup. I.e., the MemoryHigh is accounted to the sum of both the service process, and all sub-processes it spawns, and even detached processes, i.e., daemons.
(That's actually the main point of cgroup: a process tree that a process can't escape via double-forking / daemonizing.)
Apps as systemd servicesKDE Plasma launches apps as systemd services. (See this doc and this blog for more details.)
We can find the name of the systemd service of an app like this:
$ systemd-cgls|grep konsole │ │ │ ├─app-org.kde.konsole@0d82cb37fcd64fe4a8b7cf925d86842f.service │ │ │ │ ├─35275 /usr/bin/konsole │ │ │ │ └─35471 grep --color=auto konsoleBut the problem is:
- The part of the name after @ is a random string, changes every time the app is launched.
- The service is generated dynamically:
So if we want to limit the memory usage of Konsole, there's no persistent .service file on disk that we can edit.
Luckily, systemd allows us to create drop-in files to partially modify a service. Also, systemd considers app-org.kde.konsole@0d82cb37fcd64fe4a8b7cf925d86842f.service to be instances of a template named app-org.kde.konsole@.service. (This is how things like getty@tty3.service work.) So we can create a drop-in file named ~/.config/systemd/user/app-org.kde.konsole@.service.d/override.conf with the content:
[Service] MemoryAccounting=yes MemoryHigh=2Gand it will apply to all instances of app-org.kde.konsole@.service, even if there's no service file with that name.
(The file doesn't have to be named "override.conf". Any name with .conf works.)
Then we need to reload the systemd user manager: systemctl --user daemon-reload.
Now we can launch Konsole, and check if the memory limit works:
$ systemctl --user show 'app-org.kde.konsole@*.service'|grep MemoryHigh= EffectiveMemoryHigh=2147483648 MemoryHigh=2147483648 StartupMemoryHigh=infinityNote: as explained above, the limit applies to the sum of Konsole and all processes it spawns. E.g., if we run kwrite in Konsole, the memory usage of kwrite will be accounted to the limit of Konsole, and the limit we set to KWrite won't apply.
Set defaults for all appsWe can put defaults in ~/.config/systemd/user/app-.service.d/override.conf, and it will match all services whose name starts with app-.
Alternatively, if we run systemd-cgls, we can see that all apps are under a node named app.slice. So we can also put defaults in ~/.config/systemd/user/app.slice.d/override.conf, and all apps will inherit the settings. However, this is different from the previous method, as user services are also under app.slice by default, so they will also inherit the settings.
Drupal Starshot blog: Presenting the Drupal CMS v1 content strategy
Since Drupal CMS aims to enable marketers to build and launch websites quickly, Drupal CMS must offer out-of-the-box content types that are common across our target markets.
This underlying content structure is the content model. Leading up to DrupalCon Barcelona, the Starshot leadership team highlighted the need to create an initial content strategy for Drupal CMS. Through collaboration with the Drupal CMS UX steering committee, we have developed a content model for the initial release.
These content types will be presented during site setup, and will also be available to add later on. As with much of Drupal CMS, the content types are powered by ‘recipes’, which will provide some additional functionality beyond the content types themselves, such as listing pages, menu links and even default content, where appropriate.
Content types for v1All Drupal CMS sites will include a Basic page content type by default, to ensure users are able to create content even if they don't select any of the optional types. In addition to Basic page, the following content types will be available in the initial release:
- Event
- News article
- Blog
- Project
- Case study
- Person profile
For more detailed information about the content types and the process we followed to develop them, please see the full content strategy page.
Cristina Chumillas, the Drupal CMS UX lead, and I would like to thank everyone who contributed to developing this strategy and the accompanying documentation: Megh Plunkett, Emma Horrell, Niklas Missel, Lewis Nyman, Laurens Van Damme and Kat Shaw.
Incorporating SEO into the strategySince we're targeting marketers, we are making search engine optimization a top priority. Drupal CMS will provide an optional recipe for 'SEO tools'. By default, sites will have basic SEO functionality in place, such as default path alias patterns, hreflang metadata, and the ability to manage redirects.
The SEO tools recipe provides additional functionality such as meta tags, XML sitemap, and real-time SEO analysis of content. For meta tag optimization, this recipe also adds three new fields to each content type: SEO title, SEO description and SEO image. Currently these fields are in a collapsed fieldset on the node form, and are optional. If content is not provided, the meta tags will fall back to use the node title, description and featured image.
Drupal CMS content beyond v1Once the initial content types are available, we will work on expanding the content model in the second phase for later releases of Drupal CMS. Adding to the content model iteratively allows us to gather user feedback, make improvements, and adjust accordingly. We have some ideas for which additional content types to include later, and will have a better understanding of what content types are most desired once people begin building Drupal CMS sites.
If you have feedback on this proposed content strategy, or questions about it, please add it to this issue. We are planning to test this with users from the Drupal CMS target personas, and will provide more information when the testing is confirmed.
Static builds of KDE Frameworks and KDE applications
Being able to build our libraries and applications statically has been on the wishlist since a long time, and recently we made some progress in that direction again. Similar to the the recent Android integration improvements this is also a direct result of Akademy.
Reviving the CIWe had CI for static builds during the 5 era, but we lost quite a bit of coverage there during the transition to 6. However, what we had were only static builds of KDE libraries against a shared build of Qt. That finds some but by far not all issues related to static builds.
The new setup now actually has a static Qt6 to build against, which forces us to also sort out plugin integration correctly. While it is a bit more work to get back to the desired level of CI coverage that way, we will get to a much better result.
Static initialization and CMakeA common problem in static builds is initialization code that is run on shared library loading, as that simply doesn’t exist in static builds, and unless you know what you are doing that will usually be silently dropped from the final executable.
This has previously resulted in various workarounds, such as explicit initialization API (e.g. Q_INIT_RESOURCE), which is easy to miss. With Qt 6 having switched to CMake there’s a new option now though, so-called object libraries. Those are used as implementation details to inject the initialization code from static libraries into the final executable.
From a consumer point of view you get the same behavior as with shared libraries: you link against it and initialization just works. Behind the scenes this adds quite a bit of complexity to the build system though, which then sometimes leaks through into our build system code as well.
The probably most common case is qt6_add_resources. Qt resources need initialization code, so the target they are added to gets another dependency attached to it, an object library containing the initialization.
If that target is a library the additional object libraries need to be installed and exported via CMake as well, to make those available to consumer code (ECM support for this).
add_library(MyLib) qt6_add_resources(MyLib OUTPUT_TARGETS _out_targets ...) install(TARGETS MyLib ${_out_targets} EXPORT MyLibTargets ...)The OUTPUT_TARGETS part is the new thing to add here (example). Another such case are custom shaders (via qt6_add_shaders), and of course QML modules (more on those below).
Installing QML modulesQML modules created with ecm_add_qml_module also produce object library targets, but since that macro works on a higher level we can handle more of that automatically (ECM MR).
ecm_add_qml_module(mymodule URI "org.kde.mymodule" ... INSTALLED_PLUGIN_TARGET KF6::mymodule) ... ecm_finalize_qml_module(mymodule EXPORT KF6MyModuleTargets)The EXPORT argument to ecm_finalize_qml_module is the new part here. This takes care both of installing object libraries as well as exporting the QML module itself in the installed CMake configuration file. The latter is needed for statically linking QML modules into the application (see below).
When using ALIAS targets (common in KDE Frameworks, much less common outside of that) we also might need the INSTALLED_PLUGIN_TARGET argument for ecm_add_qml_module(), to make sure the module target name matches the installed alias. That’s not new, but has little practical impact outside of static linking so we have been a bit sloppy there (simple example, complex example).
Importing QML modulesLinking QML modules into the final application binary got a lot easier with Qt 6, thanks to qmlimportscanner.
add_executable(myapp) ecm_add_qml_module(myapp ...) ... if (NOT QT6_IS_SHARED_LIBS_BUILD) qt6_import_qml_plugins(myapp) endif()That’s it, no more Q_IMPORT_PLUGIN macros or manually listing modules to link. There’s less tolerance for mistakes in the CMake and QML module metadata now though, anything incomplete or missing there will give you linker failures or module loading errors at runtime (see also ECM support for additional import search paths).
OutlookSince Akademy almost 50 merge requests have been submitted related to this, most of which have already been integrated. With all that it’s possible now to build and run Alligator against a static Qt. Alligator was the first milestone we had picked for this during Akademy, due to being sufficiently complex to prove the viability of all this while not having dependencies that could be adding significant additional challenges on their own (such as the multimedia stack).
However, this work has been mostly done on desktop Linux, and while that allowed for rapid progress it’s the platform this is least interesting for. We yet have to reproduce this on Android, where it probably should bring the most immediate benefit, and of course this removes a big obstacle for potential support of iOS (as Qt can only be linked statically there).
Programiz: Python match…case Statement
Matt Layman: Epic Debugging, Hilarious Outcome - Building SaaS #205
Matt Layman: Epic Debugging, Hilarious Outcome - Building SaaS #205
Reproducible Builds (diffoscope): diffoscope 281 released
The diffoscope maintainers are pleased to announce the release of diffoscope version 281. This version includes the following changes:
[ Chris Lamb ] * Don't try and test with systemd-ukify within Debian stable. [ Jelle van der Waa ] * Add support for UKI files.You find out more by visiting the project homepage.
FSF Blogs: Winamp failed to confuse people about software freedom
Winamp failed to confuse people about software freedom
mark.ie: My LocalGov Drupal contributions for week-ending October 18th, 2024
This week was powered by the letter M and the noun "meetings".
Tag1 Consulting: Migrating Your Data from D7 to D10: Applying Drupal recipes to add media types
We executed the last field-related migrations in the previous article, but we are not done with field configuration yet! Back in article 17, we used the Migrate Skip Fields module to prevent the automatic migration from importing image and YouTube fields. Today, we will use Drupal recipes to create media types and manually add media reference fields where needed.
Read more mauricio Thu, 10/17/2024 - 06:00Real Python: Quiz: Single and Double Underscores in Python Names
In this quiz, you’ll test your understanding of Single and Double Underscores in Python Names.
By working through this quiz, you’ll revisit Python naming conventions that rely on using underscores (_), how to differentiate public and non-public names by using a single leading underscore, how to use double leading underscores to leverage name mangling in Python classes, and other common uses of underscores in Python names.
[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]
Talk Python to Me: #481: Python Opinions and Zeitgeist with Hynek
Julien Tayon: 3D ploter in python-tk with matplotlib.
The challenge seemed pretty easy, to assemble an easy demo with simple example :
- One example on how to use text entry in matplotlib that doubles with a 2D plotter,
- and the one from matplotlib on how to draw a 3D surface with a colorbar
- and the one for projecting the contour of the function on the axis
Without the colorbar I would have just been slightly annoyed by the slowness of the reaction of matplotlib as a GUI, but the colorbar posed a new challenge because it would either stack for each drawing or make plt.clf/ax.cla erase too much (see this great resource on when to use cla/clf in matplotlib).
So ... I tried python-tk with matplotlib knowing all too well that you can embed natively matplotlib in tkinter interface.
And since it was working I kept it.
Here is a screenshot of the interface : WARNING this code should not be let in inventive hands (such as bored teenagers) because there is an evil eval; it requires to be in care of consenting adults.
Some highlights of the code :
- bidir python-tk requires setting the Popen PIPEs to non blocking and using select.select on the output
- matplotlib is unusable in non blocking mode : once matplotlib has the focus you need to destroy it to plot another function
- from np import * is evil, but it let you have access to all array oriented math function (sin, cos, exp, ...)
joshics.in: Unlocking the Future of Edtech with Drupal
Education and technology are no longer separate entities; they've woven into a single, dynamic tapestry known as Edtech. At the heart of this digital revolution lies Drupal—a CMS that goes beyond traditional boundaries, offering a powerful platform for innovation in education.
Seamless Integration with Learning Tools
Drupal isn’t just about managing content. It facilitates seamless integration with popular LMS platforms like Moodle. Consider the ICE-SA portal, which we integrated with Moodle to provide a seamless learning experience for civil engineers. This integration enabled learners to access a wide range of engineering resources and online courses from a single platform, enhancing their learning efficiency and satisfaction.
Scalable Solutions for Growing InstitutionsEducational institutions often face the challenge of scaling their digital platforms to keep pace with growing student numbers. Drupal provides a scalable foundation that evolves alongside the institution. Education Above All needed to revamp their 'resources' website to accommodate a significant increase in user traffic. With Drupal, we ensured the site could handle the growth while maintaining a high level of performance, allowing more educators and learners to benefit from their valuable resources.
Customisable Learning ExperiencesEvery educational organisation has its distinct identity and goals. Drupal’s flexible architecture empowers institutions to tailor their learning portals to meet these unique needs. Take the SABEeX Drupal 10 website, for instance. By integrating SCORM features, the platform offered a more dynamic and interactive learning experience. This allowed learners to engage with customised content and track their progress effectively, transforming the traditional learning journey into a personalised adventure.
Security FirstIn an era where data breaches are all too common, protecting sensitive educational data is paramount. Drupal’s enterprise-level security measures offer robust protection, ensuring peace of mind.
Community Support and CollaborationThe Drupal community is a treasure trove of insights and collaborative potential, especially for those in education. By joining this vast community, developers and educators can share innovations and tools that enhance educational experiences globally. A recent collaboration between several European universities using Drupal led to the development of an open-source tool that revolutionised resource sharing across institutions.
Are you ready to rethink your Edtech strategy with Drupal? Whether you're looking to dive deeper into custom solutions or curious about real-world transformations, Drupal offers the tools to elevate educational experiences. Share your story of innovation or explore how you can harness the power of Drupal
EdTech Drupal Planet Add new commentOliver Davies' daily list: 16 years on Drupal.org
As of today, my user profile on Drupal.org says I've been on it for 16 years.
Originally self-learning HTML and CSS to build a website for a Tae Kwon-Do School I used to train at, I later started to learn PHP and MySQL before trying Drupal after it was suggested to me in a response to a question on a forum (which was also built with Drupal).
Since then, I've done great things with Drupal and met many great people at different events.
I've even started to interview some of them on my podcast.
Here's to the next 16 years, and I'm very excited so see where Drupal and PHP go.