Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: FC-0012 - add atlas pull behind a flag #33502

Merged

Conversation

shadinaif
Copy link
Contributor

@shadinaif shadinaif commented Oct 16, 2023

(atlas pull) will be performed only if OPENEDX_ATLAS_PULL environment variable is set

Tests:

  • in devstack, lms-shell: OPENEDX_ATLAS_PULL=yes make pull_translations is working fine
  • in devstack, lms-shell: OPENEDX_ATLAS_PULL=yes make pull_translations is deleting old translations and pulling the latest translations

Note:

I had to run the following command in the container before the test

git config --global --add safe.directory /edx/app/edxapp/edx-platform

References

This pull request is part of the FC-0012 project which is sparked by the Translation Infrastructure update OEP-58.

Check the links above for full information about the overall project.

Internalization is being rearchitected in Open edX Python, XBlock, Micro-frontend, and other projects. There are a number of immediately visible changes:

  • Remove source and language translations from the repositories, hence no .json, .po or .mo files will be committed into the repos.
  • Add standardized make extract_translations in all repositories
  • Push user-facing messages strings into openedx/openedx-translations.
  • Integrate root repositories with openedx/openedx-atlas to pull translations on build/deploy time

Breaking Changes

One of the primary goals of the project is to avoid breaking changes. If you noticed any suspicious code, please raise your concern. But before that, please know the strategy we're following to avoid breaking changes

For XBlocks:

  • The standard translation path must be conf/locale. Therefore, we are creating a link from conf/locale to translations so Atlas can find the path without disrupting the current way of having translations locally within the XBlocks
  • openedx-translations will have a related PR that adds the XBlock to the pipeline. This will not affect the current way of managing/updating translations
  • At the end of the project, a clear change log will be added and all translations will be handled by Atlas. Thus, the local translation will be removed from the repo within the version bump
  • A notification for the community will be published to ensure that everyone knows why translations directories are removed from all repos

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 16, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented Oct 16, 2023

Thanks for the pull request, @shadinaif! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

Makefile Outdated Show resolved Hide resolved
Copy link
Member

@OmarIthawi OmarIthawi left a comment

Choose a reason for hiding this comment

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

@OmarIthawi , do we need all steps when pulling using Atlas? or we should keep only generate?

@shadinaif I'm not sure, but it's probably a good idea to keep backward compatibility of the workflow.

I've added a suggestion to do that, please let me know what do you think.

Makefile Show resolved Hide resolved
@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58.atlas-pull branch from a337379 to 76550c2 Compare October 16, 2023 11:07
Copy link
Member

@OmarIthawi OmarIthawi left a comment

Choose a reason for hiding this comment

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

Looks great now. Thanks @shadinaif!

@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58.atlas-pull branch from 76550c2 to 9e7d444 Compare November 15, 2023 07:46
@shadinaif shadinaif marked this pull request as ready for review November 15, 2023 07:46
@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58.atlas-pull branch from 9e7d444 to addfd6e Compare November 19, 2023 07:05
Makefile Show resolved Hide resolved
@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58.atlas-pull branch from addfd6e to e00d1c3 Compare November 19, 2023 11:13
@OmarIthawi
Copy link
Member

OmarIthawi commented Nov 19, 2023

@shadinaif please add the keyword OEP-58 somewhere in the description so this pull request appears in GitHub search.

@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58.atlas-pull branch 2 times, most recently from 1c33ed5 to b6ce92b Compare November 21, 2023 08:01
Makefile Show resolved Hide resolved
Copy link
Member

@OmarIthawi OmarIthawi left a comment

Choose a reason for hiding this comment

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

It looks good! @shadinaif I've added few notes regarding the segmented dummy.

Please let me know if you have any questions.

Makefile Show resolved Hide resolved
Makefile Show resolved Hide resolved
Makefile Show resolved Hide resolved
@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58.atlas-pull branch from b6ce92b to f32ecd4 Compare November 26, 2023 07:35
@shadinaif shadinaif requested a review from OmarIthawi November 26, 2023 07:35
@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58.atlas-pull branch 2 times, most recently from 9d67cb7 to 09cc6be Compare November 26, 2023 07:41
@shadinaif
Copy link
Contributor Author

Hi @OmarIthawi , please check this out, I believe this is the best way to keep maximum compatibility without TODOs

@OmarIthawi
Copy link
Member

OmarIthawi commented Dec 8, 2023

@shadinaif I've tested it locally and found this strange error:

Error details
INFO:i18n.execute:Executing in . ...
INFO:i18n.execute:django-admin makemessages -l en -v1 --ignore="*/migrations/*" --ignore="*/envs/*" --ignore="node_modules/*" --ignore="conf/*" --ignore="docs/*" --ignore="*/fonts/*" --ignore="*/img/*" --ignore="*/images/*" --ignore="*/sass/*" --ignore="*/css/*" --ignore="common/test/*" --ignore="test_root/*" --ignore="*/terrain/*" --ignore="*/spec/*" --ignore="*/tests/*" --ignore="*/djangoapps/*/features/*" --ignore="lms/static/js/i18n/*" --ignore="cms/static/js/i18n/*" --ignore="src/acid-xblock/*" --ignore="src/code-block-timer/*" --ignore="src/codejail/*" --ignore="src/django-wiki/*" --ignore="src/done-xblock/*" --ignore="src/parse-rest/*" --ignore="src/geoip2/*" --ignore="src/pystache-custom/*" --ignore="src/rate-xblock/*" --ignore="src/xblock-google-drive/*" -d django
processing locale en
INFO:i18n.execute:Executing in . ...
INFO:i18n.execute:django-admin makemessages -l en -v1 --ignore="*/migrations/*" --ignore="*/envs/*" --ignore="node_modules/*" --ignore="conf/*" --ignore="docs/*" --ignore="*/fonts/*" --ignore="*/img/*" --ignore="*/images/*" --ignore="*/sass/*" --ignore="*/css/*" --ignore="common/test/*" --ignore="test_root/*" --ignore="*/terrain/*" --ignore="*/spec/*" --ignore="*/tests/*" --ignore="*/djangoapps/*/features/*" --ignore="lms/static/js/i18n/*" --ignore="cms/static/js/i18n/*" --ignore="src/acid-xblock/*" --ignore="src/code-block-timer/*" --ignore="src/codejail/*" --ignore="src/django-wiki/*" --ignore="src/done-xblock/*" --ignore="src/parse-rest/*" --ignore="src/geoip2/*" --ignore="src/pystache-custom/*" --ignore="src/rate-xblock/*" --ignore="src/xblock-google-drive/*" -d djangojs -e js,jsx
./cms/static/js/views/course_outline.js:335: warning: unterminated string
./cms/static/js/views/utils/tagging_drawer_utils.js:56: warning: RegExp literal terminated too early
./common/static/common/js/vendor/common.min.js:2: warning: unterminated string
./common/static/js/src/ReactRenderer.jsx:32: warning: unterminated string
./common/static/js/vendor/tinymce/js/tinymce/plugins/codesample/plugin.js:825: warning: unterminated string
./common/static/js/vendor/tinymce/js/tinymce/plugins/codesample/plugin.js:1244: warning: unterminated string
./common/static/js/vendor/tinymce/js/tinymce/tinymce.full.min.js:122: warning: unterminated string
./lms/djangoapps/instructor/static/instructor/ProblemBrowser/data/api/client.js:44: warning: RegExp literal terminated too early
./lms/static/js/demographics_collection/DemographicsCollectionModal.jsx:107: warning: unterminated string
./lms/templates/courseware/progress_graph.js:17: warning: unterminated string
CommandError: errors happened while running msguniq
/edx/app/edxapp/edx-platform/conf/locale/djangojs.pot:2148: context separator <EOT> within string
/edx/app/edxapp/edx-platform/conf/locale/djangojs.pot:2149: context separator <EOT> within string
msguniq: found 2 fatal errors
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/bin/i18n_tool", line 8, in <module>
    sys.exit(main())
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/i18n/main.py", line 60, in main
    return module.main()
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/i18n/__init__.py", line 50, in __call__
    return self.run(args)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/i18n/extract.py", line 134, in run
    execute(make_djangojs_cmd, working_directory=configuration.root_dir, stderr=stderr)
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.8/site-packages/i18n/execute.py", line 21, in execute
    sp.check_call(command, cwd=working_directory, stderr=stderr, shell=True)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'django-admin makemessages -l en -v1 --ignore="*/migrations/*" --ignore="*/envs/*" --ignore="node_modules/*" --ignore="conf/*" --ignore="docs/*" --ignore="*/fonts/*" --ignore="*/img/*" --ignore="*/images/*" --ignore="*/sass/*" --ignore="*/css/*" --ignore="common/test/*" --ignore="test_root/*" --ignore="*/terrain/*" --ignore="*/spec/*" --ignore="*/tests/*" --ignore="*/djangoapps/*/features/*" --ignore="lms/static/js/i18n/*" --ignore="cms/static/js/i18n/*" --ignore="src/acid-xblock/*" --ignore="src/code-block-timer/*" --ignore="src/codejail/*" --ignore="src/django-wiki/*" --ignore="src/done-xblock/*" --ignore="src/parse-rest/*" --ignore="src/geoip2/*" --ignore="src/pystache-custom/*" --ignore="src/rate-xblock/*" --ignore="src/xblock-google-drive/*" -d djangojs -e js,jsx' returned non-zero exit status 1.
make[1]: *** [Makefile:46: extract_translations] Error 1
make[1]: Leaving directory '/edx/app/edxapp/edx-platform'
make: *** [Makefile:64: pull_translations] Error 2
17:17:38 omar@antilop:edx-platform $ 

This error is intermittent and don't occur all the time. So, I'm proposing a change to this pull request which I've tested:

Please check it out and let me know if the 79e6c71 commit looks good to you. Of course the other tests PR should be discarded.

Makefile Outdated
Comment on lines 66 to 68
# Calling extract_translations in way compatibile with openedx-translations workflow which
# ensures having only two translation files in conf/locale/en/LC_MESSAGES directory (django.po and djangojs.po)
$(MAKE) IS_OPENEDX_TRANSLATIONS_WORKFLOW=yes extract_translations
Copy link
Member

Choose a reason for hiding this comment

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

usemanage.py lms compilemessages instead.

Makefile Show resolved Hide resolved
@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58.atlas-pull branch 2 times, most recently from 1c7828b to 7a2516b Compare December 14, 2023 10:58
@shadinaif shadinaif requested a review from OmarIthawi December 14, 2023 11:04
@OmarIthawi OmarIthawi force-pushed the shadinaif/FC-0012-OEP-58.atlas-pull branch from 7a2516b to 9affcd5 Compare December 15, 2023 07:40
@OmarIthawi OmarIthawi force-pushed the shadinaif/FC-0012-OEP-58.atlas-pull branch from 9affcd5 to 7a2516b Compare December 15, 2023 07:42
Copy link
Member

@OmarIthawi OmarIthawi left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks @shadinaif!!

Do you think we need to add the git config --global --add safe.directory /edx/app/edxapp/edx-platform in the Dockerfile to save some steps for the engineers using devstack?

@OmarIthawi
Copy link
Member

cc: @feanil this is ready to go.

@OmarIthawi OmarIthawi force-pushed the shadinaif/FC-0012-OEP-58.atlas-pull branch from 7a2516b to 0130d4a Compare December 15, 2023 16:54
Copy link
Contributor

@feanil feanil left a comment

Choose a reason for hiding this comment

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

Generally looks good to me, What's the reason for the git safe.directory setting? Is it because the user that's pulling the translations in docker different from the user that checked out the repo? Also I don't see any dockerfile related changes here, should there be some?

@OmarIthawi
Copy link
Member

Generally looks good to me, What's the reason for the git safe.directory setting?
Is it because the user that's pulling the translations in docker different from the user that checked out the repo? Also I don't see any dockerfile related changes here, should there be some?

@shadinaif would you mind checking Feanil's questions?

@OmarIthawi
Copy link
Member

@shadinaif please add the git config --global --add safe.directory /edx/app/edxapp/edx-platform to the Dockerfile after you've answered Feanil's questions.

(atlas pull) will be performed only if OPENEDX_ATLAS_PULL environment variable is set

Refs: FC-0012 OEP-58
@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58.atlas-pull branch from 0130d4a to a6b180c Compare January 4, 2024 15:48
@shadinaif
Copy link
Contributor Author

Hi @feanil. when using devstack; the command make lms-shell enters the shell as root, not as app. Knowing that app the user owns edx-platform directory. I've added a git command in the Dockerfile. I've added it globally in base stage. Please let me know if there is a reason to avoid that and move it to development stage. The git issue shouldn't happen in production because the admin will enter the shell with correct user anyway

cc:/ @OmarIthawi

@OmarIthawi
Copy link
Member

I think this issue is fine within the context of this image. Sometimes the check valid, but it's used in another context that makes it redaudant.

Thanks @shadinaif for the update. I think this pull request is ready to be merged.

cc: @feanil.

@OmarIthawi
Copy link
Member

@feanil @brian-smith-tcril @mphilbrick211 would you mind merging this pull request? It's fairly backward compatible and I'd like to rebase the other pull request:

@feanil feanil merged commit 02f8731 into openedx:master Jan 11, 2024
64 checks passed
@openedx-webhooks
Copy link

@shadinaif 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@shadinaif shadinaif deleted the shadinaif/FC-0012-OEP-58.atlas-pull branch January 11, 2024 15:45
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants