Skip to content

Conversation

@andrii-hantkovskyi
Copy link
Contributor

@andrii-hantkovskyi andrii-hantkovskyi commented May 15, 2025

Summary

This PR introduces a simple REST API for managing import_from_modulestore tasks and refactors the associated Celery task to use UserTask and UserTaskStatus for standardized tracking.

Technical Details

  • A new API endpoint was added to create and retrieve import_from_modulestore import tasks.
  • Updated the background import task to use the UserTask framework for consistent task status reporting.

Testing Instructions

  1. Trigger Import via API:
    Send a POST request to the new endpoint:

    POST /api/import_from_modulestore/v0/imports/
    Content-Type: application/json
    
    {
      "source_key": "<source_course_key>",
      "target": "<target_library_key>",
      "composition_level": "<composition_level>",
      "usage_keys_string": "<comma_separated_usage_keys>",
      "override": "<override>"
    }
    • You should receive a JSON response containing the UserTask ID.
  2. Check Task Status:

    • Use the provided task id to fetch status from /api/import_from_modulestore/v0/imports/<task_id>/
    • Alternatively, go to Django Admin > Import_From_Modulestore > Imports from modulestore and verify the task is listed with appropriate status updates.
  3. Verify Celery Task Execution:

    • Confirm the Celery worker logs show the task import_to_library_task being triggered.
  4. Edge Cases:

    • Try sending invalid data (e.g., missing or incorrect course IDs).
    • Confirm the API returns proper validation errors (HTTP 400) with descriptive messages.

@openedx-webhooks
Copy link

openedx-webhooks commented May 15, 2025

Thanks for the pull request, @andrii-hantkovskyi!

This repository is currently maintained by @openedx/wg-maintenance-edx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label May 15, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in Contributions May 15, 2025
@andrii-hantkovskyi andrii-hantkovskyi self-assigned this May 15, 2025
@andrii-hantkovskyi andrii-hantkovskyi marked this pull request as ready for review May 15, 2025 18:06
@andrii-hantkovskyi
Copy link
Contributor Author

@ormsbee @kdmccormick hello, when you have a moment, could you please take a look at this PR?

@mphilbrick211 mphilbrick211 moved this from Needs Triage to Ready for Review in Contributions May 15, 2025
@kdmccormick kdmccormick added the create-sandbox open-craft-grove should create a sandbox environment from this PR label May 16, 2025
@open-craft-grove
Copy link

Sandbox deployment successful 🚀
🎓 LMS
📝 Studio
ℹ️ Grove Config, Tutor Config, Tutor Requirements

@andrii-hantkovskyi
Copy link
Contributor Author

Superseded by #36873

@github-project-automation github-project-automation bot moved this from Ready for Review to Done in Contributions Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

create-sandbox open-craft-grove should create a sandbox environment from this PR 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