Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • MC Job Options MC Job Options
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Jira
    • Jira
  • Merge requests 7
    • Merge requests 7
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Issue
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • atlas-physics
  • pmg
  • MC Job OptionsMC Job Options
  • Merge requests
  • !1783

Fix bug in locale setting that breaks logParser running in CI

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Spyros Argyropoulos requested to merge fixLocale into master Apr 20, 2022
  • Overview 0
  • Commits 1
  • Pipelines 1
  • Changes 1

Description of bug

After !1764 (merged) all logParser jobs have been broken, check e.g. https://gitlab.cern.ch/atlas-physics/pmg/mcjoboptions/-/jobs/21222934 or see #167 (closed)

This is because "en_us" is not available in the docker image that we use. I tried to make this more flexible although I am not sure this will work on every system. If it breaks again I would suggest that we revert completely !1764 (merged), for now this fix should work in the CI, lxplus (and I've also tested on my mac).

Changes introduced

Take the language from the output of the LC_CTYPE command and if LC_CTYPE is not set, assume that "C" locale exists and set LC_CTYPE to C.UTF-8 (which exists in the docker image)

Tests

In the docker image

root@5d8f62124105:/mcjoboptions# python scripts/logParser.py -i 100xxx/100000/log.generate >&/dev/null ; echo $?
0

while before the fix it gave

root@5d8f62124105:/mcjoboptions# python scripts/logParser.py -i 100xxx/100000/log.generate
Traceback (most recent call last):
  File "scripts/logParser.py", line 8, in <module>
    locale.setlocale(locale.LC_CTYPE, f'{lang}.UTF-8')
  File "/usr/local/lib/python3.6/locale.py", line 598, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

Issues resolved

Closes #167 (closed)

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: fixLocale