diff --git a/scripts/structures_pruning/README.md b/scripts/structures_pruning/README.md new file mode 100644 index 000000000000..aec97fed7486 --- /dev/null +++ b/scripts/structures_pruning/README.md @@ -0,0 +1,46 @@ +# Structures Pruning Scripts + +This directory contains the MongoDB structures pruning script that was +migrated from the [tubular](https://github.com/openedx/tubular) +repository. + +This can be useful to keep the MongoDB `modulestore.structures` +collection size in check. This script could be called from any +automation/CD framework. + +# Quick start + +> [!NOTE] +> See [How to Use the Structures Pruning Script](https://docs.openedx.org/en/latest/site_ops/how-tos/use-the-structures-pruning-script.html) for a complete guide to running this in production. + +Some quick steps for setting this up to run. A shallow clone of +openedx-platform is recommended because the repository is very large. + +```bash +git clone --depth=1 https://github.com/openedx/openedx-platform.git +cd openedx-platform +virtualenv venv +source venv/bin/activate +pip install -r ./scripts/structures_pruning/requirements/base.txt +``` + +Then you can use python to run the scripts, and view the integrated +help. + +```bash +python scripts/structures_pruning/structures.py --help +``` + +# Development + +For development, you can also install the testing requirements: + +```bash +pip install -r scripts/structures_pruning/requirements/testing.txt +``` + +Run the test cases using pytest: + +```bash +pytest scripts/structures_pruning +``` diff --git a/scripts/structures_pruning/README.rst b/scripts/structures_pruning/README.rst deleted file mode 100644 index 9939a09747e1..000000000000 --- a/scripts/structures_pruning/README.rst +++ /dev/null @@ -1,73 +0,0 @@ -Structures Pruning Scripts -========================== - -`This `_ directory contains mongo db structures pruning script that is migrated from the -`tubular `_ repository. - - -This script could be called from any automation/CD framework. - -How to run the scripts -====================== - -Download the Scripts --------------------- - -To download the scripts, you can perform a partial clone of the edx-platform repository to obtain only the required scripts. The following steps demonstrate how to achieve this. Alternatively, you may choose other utilities or libraries for the partial clone. - -.. code-block:: bash - - repo_url=git@github.com:openedx/edx-platform.git - branch=master - directory=scripts/structures_pruning - - git clone --branch $branch --single-branch --depth=1 --filter=tree:0 $repo_url - cd edx-platform - git sparse-checkout init --cone - git sparse-checkout set $directory - -Create Python Virtual Environment ---------------------------------- - -Create a Python virtual environment using Python 3.12: - -.. code-block:: bash - - python3.12 -m venv ../venv - source ../venv/bin/activate - -Install Pip Packages --------------------- - -Install the required pip packages using the provided requirements file: - -.. code-block:: bash - - pip install -r scripts/structures_pruning/requirements/base.txt - - -Execute Script --------------- - -You can simply execute Python scripts with python command - -.. code-block:: bash - - python scripts/structures_pruning/structures.py prune plan_file.json - -Feel free to customize these steps according to your specific environment and requirements. - -Run Test Cases -============== - -Before running test cases, install the testing requirements: - -.. code-block:: bash - - pip install -r scripts/structures_pruning/requirements/testing.txt - -Run the test cases using pytest: - -.. code-block:: bash - - pytest scripts/structures_pruning