Skip to content

Add working example of environment based time zones#73

Open
emmuhamm wants to merge 12 commits into
developfrom
emmuhamm/timezones
Open

Add working example of environment based time zones#73
emmuhamm wants to merge 12 commits into
developfrom
emmuhamm/timezones

Conversation

@emmuhamm
Copy link
Copy Markdown
Collaborator

@emmuhamm emmuhamm commented May 29, 2026

Description

Fix #70

Add better timezone handling. This is going to be optionally done by an environment variable, which overrides the log_format.ini settings.

Add better theme handling. This is also going to optionally done by an environment variable, which overrides the log_format.ini settings.

For full explanations, please see the docs in this PR, and also the testing notes

Testing notes

Tested on latest nightly (doesnt matter which)

Run
export DUNEDAQ_TIMEZONE="Europe/London"
export DUNEDAQ_LOGGING_THEME="dark"

and
daqpytools-logging-demonstrator -r

See how the colors and the timezones has changed. Play around with various timezones and themes.

When finish, run
export DUNEDAQ_TIMEZONE=""
export DUNEDAQ_LOGGING_THEME=""
And see how they revert back to their default behaviour

TODO:

  • Figure out why it breaks integ test if different timezone is chosen (likely outside scope of this PR)

Type of change

  • New feature or enhancement (non-breaking change which adds functionality)

Testing checklist

  • Unit tests pass (e.g. dbt-build --unittest)
  • Minimal system quicktest passes (pytest -s minimal_system_quick_test.py)
  • Full set of integration tests pass (dunedaq_integtest_bundle.sh)
  • Python tests pass if applicable (e.g. python -m pytest)
  • Pre-commit hooks run successfully if applicable (e.g. pre-commit run --all-files)

Comments here on the testing

Further checks

  • Code is commented where needed, particularly in hard-to-understand areas
  • Code style is correct (dbt-build --lint, and/or see https://dune-daq-sw.readthedocs.io/en/latest/packages/styleguide/)
  • If applicable, new tests have been added or an issue has been opened to tackle that in the future.
    (Indicate issue here: # (issue))

@emmuhamm emmuhamm self-assigned this May 29, 2026
@emmuhamm emmuhamm marked this pull request as draft May 29, 2026 14:00
@emmuhamm
Copy link
Copy Markdown
Collaborator Author

There appears to be a very stupid bug somewhere in the integ test..

Note in the following screenshots, when it is in UTC everything works well. But when its in some other time zone (eg bst) then it fails????

Obviously outside the purview of daqpytools, but it should at least still be investigated.

Screenshot 2026-05-29 at 15 50 05 Screenshot 2026-05-29 at 15 50 02 Screenshot 2026-05-29 at 15 49 55

@emmuhamm
Copy link
Copy Markdown
Collaborator Author

How to view timezones

In [40]: import pytz
In [41]: pytz.all_timezones

@emmuhamm emmuhamm force-pushed the emmuhamm/timezones branch from 67b4c5c to 9861dac Compare June 4, 2026 14:19
@emmuhamm emmuhamm marked this pull request as ready for review June 4, 2026 15:08
The docs are assembled from multiple sources at build time:

- `docs/` contains user-facing content
- `docs/` contains user-facing content. **Note that this is also used in the dunedaq readthedocs.**
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed a bit of clarity I can stick in here while im updating the docs anyway

@emmuhamm emmuhamm requested a review from PawelPlesniak June 4, 2026 15:09
@emmuhamm emmuhamm added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 4, 2026
@emmuhamm
Copy link
Copy Markdown
Collaborator Author

emmuhamm commented Jun 4, 2026

@PawelPlesniak review pls :)

When this is all good and merged, I'll let kurt know about this

`daqpytools` has the power for you to configure your current instance of the loggings! This allows each user to change the timezone and the color themes to suit them as the logs come out.

The way this is configured is by setting environment variables. By default, these are _unset_ in the terminal, which daqpytools will read and resolve to a default value. These default values can be found in `logging/log_format.ini`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest having a line stating something along the lines of

If a non-default time zone/theme is preferred, it is recommended to set the env vars DUNEDAQ_TIMEZONE and DUNEDAQ_LOGGING_THEME in your ~/.bashrc

Also non-review note, reading the black theme in a black terminal is impossible XD

Copy link
Copy Markdown
Collaborator

@PawelPlesniak PawelPlesniak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment, but other than that, nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Time zone defined in env variables

3 participants