Skip to content

fix: User retirement 404 for state RETIRING_FORUMS#33025

Merged
cmltaWt0 merged 1 commit intoopenedx:open-release/palm.masterfrom
DmytroAlipov:fix-user-retirement-palm
Oct 27, 2023
Merged

fix: User retirement 404 for state RETIRING_FORUMS#33025
cmltaWt0 merged 1 commit intoopenedx:open-release/palm.masterfrom
DmytroAlipov:fix-user-retirement-palm

Conversation

@DmytroAlipov
Copy link
Contributor

This is a backport from the master branch

Description

We ran into a problem when running the retire_users.sh command. The user must first delete their account from the platform. After that, the /edx/app/retirement_service/retire_users.sh command is launched. However, for one step, an error appears

sudo -sHu edx_retirement_worker
edx_retirement_worker@lms-palm:/home/company$ cd
edx_retirement_worker@lms-palm:~$ /edx/app/retirement_service/retire_users.sh
=== [Tue Aug  1 07:19:04 UTC 2023] /edx/app/retirement_service/retire_users.sh: Started
Writing logs to: /edx/var/log/retirement_service/edx.log
Deleting user: test_user_5...
b'Learner Retirement: Starting learner retirement for test_user_5 using config file /edx/app/retirement_service/config.yml'
b'Learner Retirement: Starting state RETIRING_FORUMS'
ERROR:tubular.edx_api:API Error: 404 Client Error: Not Found for url: https://lms-palm-dev.raccoongang.com/api/discussion/v1/accounts/retire_forum/ with status code: 404
INFO:tubular.edx_api:No information about learner retirement
b'Learner Retirement: State RETIRING_FORUMS completed in 0.36619019508361816 seconds'
b'Learner Retirement: Progressing to state FORUMS_COMPLETE'
b'Learner Retirement: Starting state RETIRING_ENROLLMENTS'
b'Learner Retirement: State RETIRING_ENROLLMENTS completed in 3.4557716846466064 seconds'
b'Learner Retirement: Progressing to state ENROLLMENTS_COMPLETE'
b'Learner Retirement: Starting state RETIRING_LMS_MISC'
b'Learner Retirement: State RETIRING_LMS_MISC completed in 0.11767053604125977 seconds'
b'Learner Retirement: Progressing to state LMS_MISC_COMPLETE'
b'Learner Retirement: Starting state RETIRING_LMS'
b'Learner Retirement: State RETIRING_LMS completed in 0.18668651580810547 seconds'
b'Learner Retirement: Progressing to state LMS_COMPLETE'
b'Learner Retirement: Retirement complete for learner test_user_5'
edx_retirement_worker@lms-palm:~$

At the same time, all user actions for the forum remain, since this retirement stage is not completed.
A problem was detected with the WALL of this endpoint.
URL looks like:
https://lms-palm.com/api/discussion/v1/accounts/retire_forum/
However, this URL is expected on the platform:
https://lms-palm.com/api/discussion/v1/accounts/retire_forum

The URL is created in LmsApi, and the append_slash argument is responsible for adding a slash at the end of the URL. This addition of a slash is carried out for all retirement steps.

After fixing, the entire flow passes without errors:

=== [Wed Aug 16 10:18:31 UTC 2023] /edx/app/retirement_service/retire_users.sh: Started
Writing logs to: /edx/var/log/retirement_service/edx.log
Deleting user: test_user_5...
b'Learner Retirement: Starting learner retirement for test_user_5 using config file /edx/app/retirement_service/config.yml'
b'Learner Retirement: Starting state RETIRING_FORUMS'
b'Learner Retirement: State RETIRING_FORUMS completed in 0.40157532691955566 seconds'
b'Learner Retirement: Progressing to state FORUMS_COMPLETE'
b'Learner Retirement: Starting state RETIRING_ENROLLMENTS'
b'Learner Retirement: State RETIRING_ENROLLMENTS completed in 0.5397000312805176 seconds'
b'Learner Retirement: Progressing to state ENROLLMENTS_COMPLETE'
b'Learner Retirement: Starting state RETIRING_LMS_MISC'
b'Learner Retirement: State RETIRING_LMS_MISC completed in 0.30715203285217285 seconds'
b'Learner Retirement: Progressing to state LMS_MISC_COMPLETE'
b'Learner Retirement: Starting state RETIRING_LMS'
b'Learner Retirement: State RETIRING_LMS completed in 0.16425585746765137 seconds'
b'Learner Retirement: Progressing to state LMS_COMPLETE'
b'Learner Retirement: Retirement complete for learner test_user_5'

User data is deleted in the Discussion:
screen_53

Note:

We do not have all stages of retirement. Only such:

{
    "client_id": "our_client_id",
    "client_secret": "our_client_secret",
    "base_urls": {
        "lms": "https://lms-palm.com/",
        "ecommerce": "https://ecommerce-palm.com/",
        "credentials": "https://credentials-palm.com/",
    },
    "retirement_pipeline": [
        ["RETIRING_FORUMS", "FORUMS_COMPLETE", "LMS", "retirement_retire_forum"],
        ["RETIRING_ENROLLMENTS", "ENROLLMENTS_COMPLETE", "LMS", "retirement_unenroll"],
        ["RETIRING_LMS_MISC", "LMS_MISC_COMPLETE", "LMS", "retirement_lms_retire_misc"],
        ["RETIRING_LMS", "LMS_COMPLETE", "LMS", "retirement_lms_retire"],
    ],
}

Might have similar problems for other stages.

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

Thanks for the pull request, @DmytroAlipov! 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.

@mphilbrick211
Copy link

Hi @openedx/edx-infinity! Is something you could please review/merge for us? Thanks!

@DmytroAlipov
Copy link
Contributor Author

@mphilbrick211 friendly ping. PR has already been merged into the master

@mphilbrick211
Copy link

Hi @openedx/edx-infinity! Would someone be able to get this merged for us? Thanks!

@mphilbrick211
Copy link

Hi @asadazam93! Just checking to see if you're able to get this reviewed / merged for us? Thanks!

@cmltaWt0
Copy link
Contributor

@DmytroAlipov the proposed backport differs from the original PR.
Could you update the backport?

@DmytroAlipov DmytroAlipov force-pushed the fix-user-retirement-palm branch from 19b5d63 to 9259411 Compare October 26, 2023 06:28
@DmytroAlipov
Copy link
Contributor Author

@cmltaWt0 done

@cmltaWt0 cmltaWt0 self-requested a review October 27, 2023 07:35
@cmltaWt0
Copy link
Contributor

Looks good for me 👍

@cmltaWt0 cmltaWt0 merged commit 96ec8d0 into openedx:open-release/palm.master Oct 27, 2023
@openedx-webhooks
Copy link

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

@DmytroAlipov DmytroAlipov deleted the fix-user-retirement-palm branch October 27, 2023 08:28
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.

4 participants