Specifier resolution: %i and %I difference?
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
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
add a comment |Â
up vote
4
down vote
favorite
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
The celery doc you refer to is not using a service template, or the unit file would be namedcelery@.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
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
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
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
systemd
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 namedcelery@.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
add a comment |Â
The celery doc you refer to is not using a service template, or the unit file would be namedcelery@.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
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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