On Fri, Nov 4, 2016 at 4:08 AM, Scott Moser <email address hidden> wrote:
> Are hyou sure it wouldn't fix it?
> changing os.environ should change the environment of the process that is
> running, which (I'd think) would have the same result. Unless python is
> doing all those stats before we could set it (it may well do some).
>
updating os.environ will help in that cloud-init drives lots of python
logging with timestamps. However, there are other modules which may run as
forked processes under our unit which will NOT have it; and it's literally
any program making the glibc call.
>
> I couldn't reproduce any difference with set or unset with a simple
> program like this:
> import os, time
> if 'TZ' not in os.environ:
> os.environ['TZ'] = ":/etc/localtime"
> print(time.strftime("%a, %d %b %Y %T %z"))
>
> And then running with:
> env -i TZ strace python program.py
>
>
> I'm not opposed to this, and dont want to discount the performance
> improvement, but if we can do it in a single place, i'd rather that then in
> multiple systemd files which would only benefit systemd.
>
cloud-init can write a single EnvironmentFile= and we can specify that in
each Unit file
showed this here and Steve and Martin were interested in having that maybe
set as systemd default.
however, for cloud-init which may run in *other* distro environments with
systemd, we really should bring our own.
On Fri, Nov 4, 2016 at 4:08 AM, Scott Moser <email address hidden> wrote:
> Are hyou sure it wouldn't fix it?
> changing os.environ should change the environment of the process that is
> running, which (I'd think) would have the same result. Unless python is
> doing all those stats before we could set it (it may well do some).
>
updating os.environ will help in that cloud-init drives lots of python
logging with timestamps. However, there are other modules which may run as
forked processes under our unit which will NOT have it; and it's literally
any program making the glibc call.
> strftime( "%a, %d %b %Y %T %z"))
> I couldn't reproduce any difference with set or unset with a simple
> program like this:
> import os, time
> if 'TZ' not in os.environ:
> os.environ['TZ'] = ":/etc/localtime"
> print(time.
>
> And then running with:
> env -i TZ strace python program.py
>
(foudres) ~ % env -i strace /usr/bin/python3 -c 'import os; from datetime now())' 2>&1 | egrep *etc/localtime| zoneinfo) " etc/localtime" , {st_mode= S_IFREG| 0644, st_size=2221, ...}) = 0 etc/localtime" , {st_mode= S_IFREG| 0644, st_size=2221, ...}) = 0
import datetime; print(datetime.
"(stat.
stat("/
stat("/
(foudres) ~ % strace /usr/bin/python3 -c 'import os; from datetime import now())' 2>&1 | egrep *etc/localtime| zoneinfo) " usr/share/ zoneinfo/ America/ Chicago" , O_RDONLY|O_CLOEXEC) = 3
datetime; print(datetime.
"(stat.
open("/
>
> I'm not opposed to this, and dont want to discount the performance
> improvement, but if we can do it in a single place, i'd rather that then in
> multiple systemd files which would only benefit systemd.
>
cloud-init can write a single EnvironmentFile= and we can specify that in
each Unit file
showed this here and Steve and Martin were interested in having that maybe
set as systemd default.
however, for cloud-init which may run in *other* distro environments with
systemd, we really should bring our own.
> /code.launchpad .net/~raharper/ cloud-init/ +git/ +merge/ 307722 cloud-init: systemd_ export_ tz.
>
> --
> https:/
> cloud-init/
> You are the owner of ~raharper/
>