Jira (PUP-1353) configurable nice value (explicitly on service and exec calls)

2 views
Skip to first unread message

Sergio Ballestrero (JIRA)

unread,
Mar 29, 2015, 3:58:11 AM3/29/15
to puppe...@googlegroups.com
Sergio Ballestrero commented on New Feature PUP-1353
 
Re: configurable nice value (explicitly on service and exec calls)

We're having the same issue, running puppet apply from cron in nice.
An incorrect nice level on services is the most critical issue, since they remain running, while transient execs are not so much of an issue - actually in most cases it's even desirable that they run at the same nice level.

A comprehensive solution would be nice to have, but for the moment we have a workaround for services, overriding the redhat provider.
We simply read the nice level of the puppet proces from /proc/self/stat, and run nice -n (-level) /sbin/service ....
Diff below for puppet 3.3.2, maybe it can help others having the same problem.

Cheers,
Sergio

--- /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/redhat.rb    2013-11-07 22:42:05.000000000 +0100
+++ puppet/modules/service/lib/puppet/provider/service/redhat.rb    2015-03-26 07:18:58.506055549 +0100
@@ -51,11 +51,15 @@
   end
 
   def restartcmd
-    (@resource[:hasrestart] == :true) && [command(:service), @resource[:name], "restart"]
+    ## sash: renice to 0
+    nice=-(File.read("/proc/self/stat").split()[18].to_i)
+    (@resource[:hasrestart] == :true) && ["/bin/nice","-n","#{nice}",command(:service), @resource[:name], "restart"]
   end
 
   def startcmd
-    [command(:service), @resource[:name], "start"]
+    ## sash: renice to 0 
+    nice=-(File.read("/proc/self/stat").split()[18].to_i)
+    ["/bin/nice","-n","#{nice}",command(:service), @resource[:name], "start"]
   end
 
   def stopcmd

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.3.15#6346-sha1:dbc023d)
Atlassian logo

Nicholas Fagerlund (JIRA)

unread,
May 15, 2017, 4:05:03 PM5/15/17
to puppe...@googlegroups.com
Nicholas Fagerlund updated an issue
 
Puppet / New Feature PUP-1353
Change By: Nicholas Fagerlund
Labels: redmine  triage  triaged
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Nicholas Fagerlund (JIRA)

unread,
May 15, 2017, 4:05:03 PM5/15/17
to puppe...@googlegroups.com

Moses Mendoza (JIRA)

unread,
May 18, 2017, 1:46:02 PM5/18/17
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Oct 29, 2019, 11:20:04 PM10/29/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Team: Coremunity
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Josh Cooper (Jira)

unread,
Jun 5, 2020, 6:28:03 PM6/5/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Epic Link: PUP-7267
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages