Specifier resolution: %i and %I difference?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite
2












I'm trying to run celery as a service as described in the docs.



The documentation uses %n%I specifiers for the log files:



celery.service:



ExecStart= [...] --logfile=$CELERYD_LOG_FILE


celery.service.d/celery.conf



Environment="CELERYD_LOG_FILE=/var/log/celery/%n%I.log"


When doing this, I can see in the service status that %n is resolved at start time and %I remains at this stage:



systemctl status celery.service
[...]
--logfile=/var/log/celery/worker%I.log


And I get those log files:



/var/log/celery/worker.log
/var/log/celery/worker-1.log
/var/log/celery/worker-2.log


If I use %i, however, the whole thing resolves at start time



celery.service.d/celery.conf



Environment="CELERYD_LOG_FILE=/var/log/celery/%n%i.log"


produces this:



systemctl status celery.service
[...]
--logfile=/var/log/celery/celery.service.log


And I get only one log file:



/var/log/celery/celery.service.log


This is troubling.



From systemd documentation, the only difference should be about escaping:



  • "%i" | Instance name | For instantiated units: this is the string between the "@" character and the suffix of the unit name.

  • "%I" | Unescaped instance name | Same as "%i", but with escaping undone

Is there something I'm missing, here?



Also, I noticed that if I set the log path directly in the .service file, only the %n%i form is accepted.



ExecStart= [...] --logfile=/var/log/celery/%n%i.log


will do, and results in



/var/log/celery/celery.service.log


while



ExecStart= [...] --logfile=/var/log/celery/%n%I.log


triggers an error:



celery.service failed to run 'start' task: Operation not supported
Failed to start Celery worker.


How come?



I'm using systemd 215-17 on Debian Jessie.



Edit 1:



It seems %I is not understood by systemd at all. What we see when using %I is specific to Celery. (See Celery docs). So %i is managed by systemd while %I is ignored and passed transparently by systemd, then managed by Celery.



This explains a lot but leaves a few questions open:



  • Why doesn't systemd understand %I here?

  • Conversely, what if I wanted to pass Celery a %i?

  • Why does it differ if I pass the option directly in the .service file rather than in the .conf file?

I went through systemd changelog and didn't find anything about %I being more recent than the version I am using.



Edit 2:



I saw this error message while running systemctl status celery.service:



[/etc/systemd/system/celery.service.d/celery.conf:18] Failed to resolve specifiers, ignoring: "CELERYD_LOG_FILE=/var/log/celery/%n%I.log"


I can't reproduce it, though. I can't tell why it happened once and and not every time.










share|improve this question























  • The celery doc you refer to is not using a service template, or the unit file would be named celery@.service (which you can try). You should probably replace every % with %% so systemd does no processing of the specifiers, since your celery application seems to be wanting to do it.
    – meuh
    Oct 9 '17 at 17:50














up vote
4
down vote

favorite
2












I'm trying to run celery as a service as described in the docs.



The documentation uses %n%I specifiers for the log files:



celery.service:



ExecStart= [...] --logfile=$CELERYD_LOG_FILE


celery.service.d/celery.conf



Environment="CELERYD_LOG_FILE=/var/log/celery/%n%I.log"


When doing this, I can see in the service status that %n is resolved at start time and %I remains at this stage:



systemctl status celery.service
[...]
--logfile=/var/log/celery/worker%I.log


And I get those log files:



/var/log/celery/worker.log
/var/log/celery/worker-1.log
/var/log/celery/worker-2.log


If I use %i, however, the whole thing resolves at start time



celery.service.d/celery.conf



Environment="CELERYD_LOG_FILE=/var/log/celery/%n%i.log"


produces this:



systemctl status celery.service
[...]
--logfile=/var/log/celery/celery.service.log


And I get only one log file:



/var/log/celery/celery.service.log


This is troubling.



From systemd documentation, the only difference should be about escaping:



  • "%i" | Instance name | For instantiated units: this is the string between the "@" character and the suffix of the unit name.

  • "%I" | Unescaped instance name | Same as "%i", but with escaping undone

Is there something I'm missing, here?



Also, I noticed that if I set the log path directly in the .service file, only the %n%i form is accepted.



ExecStart= [...] --logfile=/var/log/celery/%n%i.log


will do, and results in



/var/log/celery/celery.service.log


while



ExecStart= [...] --logfile=/var/log/celery/%n%I.log


triggers an error:



celery.service failed to run 'start' task: Operation not supported
Failed to start Celery worker.


How come?



I'm using systemd 215-17 on Debian Jessie.



Edit 1:



It seems %I is not understood by systemd at all. What we see when using %I is specific to Celery. (See Celery docs). So %i is managed by systemd while %I is ignored and passed transparently by systemd, then managed by Celery.



This explains a lot but leaves a few questions open:



  • Why doesn't systemd understand %I here?

  • Conversely, what if I wanted to pass Celery a %i?

  • Why does it differ if I pass the option directly in the .service file rather than in the .conf file?

I went through systemd changelog and didn't find anything about %I being more recent than the version I am using.



Edit 2:



I saw this error message while running systemctl status celery.service:



[/etc/systemd/system/celery.service.d/celery.conf:18] Failed to resolve specifiers, ignoring: "CELERYD_LOG_FILE=/var/log/celery/%n%I.log"


I can't reproduce it, though. I can't tell why it happened once and and not every time.










share|improve this question























  • The celery doc you refer to is not using a service template, or the unit file would be named celery@.service (which you can try). You should probably replace every % with %% so systemd does no processing of the specifiers, since your celery application seems to be wanting to do it.
    – meuh
    Oct 9 '17 at 17:50












up vote
4
down vote

favorite
2









up vote
4
down vote

favorite
2






2





I'm trying to run celery as a service as described in the docs.



The documentation uses %n%I specifiers for the log files:



celery.service:



ExecStart= [...] --logfile=$CELERYD_LOG_FILE


celery.service.d/celery.conf



Environment="CELERYD_LOG_FILE=/var/log/celery/%n%I.log"


When doing this, I can see in the service status that %n is resolved at start time and %I remains at this stage:



systemctl status celery.service
[...]
--logfile=/var/log/celery/worker%I.log


And I get those log files:



/var/log/celery/worker.log
/var/log/celery/worker-1.log
/var/log/celery/worker-2.log


If I use %i, however, the whole thing resolves at start time



celery.service.d/celery.conf



Environment="CELERYD_LOG_FILE=/var/log/celery/%n%i.log"


produces this:



systemctl status celery.service
[...]
--logfile=/var/log/celery/celery.service.log


And I get only one log file:



/var/log/celery/celery.service.log


This is troubling.



From systemd documentation, the only difference should be about escaping:



  • "%i" | Instance name | For instantiated units: this is the string between the "@" character and the suffix of the unit name.

  • "%I" | Unescaped instance name | Same as "%i", but with escaping undone

Is there something I'm missing, here?



Also, I noticed that if I set the log path directly in the .service file, only the %n%i form is accepted.



ExecStart= [...] --logfile=/var/log/celery/%n%i.log


will do, and results in



/var/log/celery/celery.service.log


while



ExecStart= [...] --logfile=/var/log/celery/%n%I.log


triggers an error:



celery.service failed to run 'start' task: Operation not supported
Failed to start Celery worker.


How come?



I'm using systemd 215-17 on Debian Jessie.



Edit 1:



It seems %I is not understood by systemd at all. What we see when using %I is specific to Celery. (See Celery docs). So %i is managed by systemd while %I is ignored and passed transparently by systemd, then managed by Celery.



This explains a lot but leaves a few questions open:



  • Why doesn't systemd understand %I here?

  • Conversely, what if I wanted to pass Celery a %i?

  • Why does it differ if I pass the option directly in the .service file rather than in the .conf file?

I went through systemd changelog and didn't find anything about %I being more recent than the version I am using.



Edit 2:



I saw this error message while running systemctl status celery.service:



[/etc/systemd/system/celery.service.d/celery.conf:18] Failed to resolve specifiers, ignoring: "CELERYD_LOG_FILE=/var/log/celery/%n%I.log"


I can't reproduce it, though. I can't tell why it happened once and and not every time.










share|improve this question















I'm trying to run celery as a service as described in the docs.



The documentation uses %n%I specifiers for the log files:



celery.service:



ExecStart= [...] --logfile=$CELERYD_LOG_FILE


celery.service.d/celery.conf



Environment="CELERYD_LOG_FILE=/var/log/celery/%n%I.log"


When doing this, I can see in the service status that %n is resolved at start time and %I remains at this stage:



systemctl status celery.service
[...]
--logfile=/var/log/celery/worker%I.log


And I get those log files:



/var/log/celery/worker.log
/var/log/celery/worker-1.log
/var/log/celery/worker-2.log


If I use %i, however, the whole thing resolves at start time



celery.service.d/celery.conf



Environment="CELERYD_LOG_FILE=/var/log/celery/%n%i.log"


produces this:



systemctl status celery.service
[...]
--logfile=/var/log/celery/celery.service.log


And I get only one log file:



/var/log/celery/celery.service.log


This is troubling.



From systemd documentation, the only difference should be about escaping:



  • "%i" | Instance name | For instantiated units: this is the string between the "@" character and the suffix of the unit name.

  • "%I" | Unescaped instance name | Same as "%i", but with escaping undone

Is there something I'm missing, here?



Also, I noticed that if I set the log path directly in the .service file, only the %n%i form is accepted.



ExecStart= [...] --logfile=/var/log/celery/%n%i.log


will do, and results in



/var/log/celery/celery.service.log


while



ExecStart= [...] --logfile=/var/log/celery/%n%I.log


triggers an error:



celery.service failed to run 'start' task: Operation not supported
Failed to start Celery worker.


How come?



I'm using systemd 215-17 on Debian Jessie.



Edit 1:



It seems %I is not understood by systemd at all. What we see when using %I is specific to Celery. (See Celery docs). So %i is managed by systemd while %I is ignored and passed transparently by systemd, then managed by Celery.



This explains a lot but leaves a few questions open:



  • Why doesn't systemd understand %I here?

  • Conversely, what if I wanted to pass Celery a %i?

  • Why does it differ if I pass the option directly in the .service file rather than in the .conf file?

I went through systemd changelog and didn't find anything about %I being more recent than the version I am using.



Edit 2:



I saw this error message while running systemctl status celery.service:



[/etc/systemd/system/celery.service.d/celery.conf:18] Failed to resolve specifiers, ignoring: "CELERYD_LOG_FILE=/var/log/celery/%n%I.log"


I can't reproduce it, though. I can't tell why it happened once and and not every time.







systemd






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 21 '17 at 21:00

























asked Oct 9 '17 at 10:29









Jérôme

7912728




7912728











  • The celery doc you refer to is not using a service template, or the unit file would be named celery@.service (which you can try). You should probably replace every % with %% so systemd does no processing of the specifiers, since your celery application seems to be wanting to do it.
    – meuh
    Oct 9 '17 at 17:50
















  • The celery doc you refer to is not using a service template, or the unit file would be named celery@.service (which you can try). You should probably replace every % with %% so systemd does no processing of the specifiers, since your celery application seems to be wanting to do it.
    – meuh
    Oct 9 '17 at 17:50















The celery doc you refer to is not using a service template, or the unit file would be named celery@.service (which you can try). You should probably replace every % with %% so systemd does no processing of the specifiers, since your celery application seems to be wanting to do it.
– meuh
Oct 9 '17 at 17:50




The celery doc you refer to is not using a service template, or the unit file would be named celery@.service (which you can try). You should probably replace every % with %% so systemd does no processing of the specifiers, since your celery application seems to be wanting to do it.
– meuh
Oct 9 '17 at 17:50















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f396978%2fspecifier-resolution-i-and-i-difference%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f396978%2fspecifier-resolution-i-and-i-difference%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay