diff --git a/README.rst b/README.rst index 41f41b379..1630be7da 100644 --- a/README.rst +++ b/README.rst @@ -58,6 +58,10 @@ Usage tutor [dev|local] do load-xapi-test-data +#. (Optional) Sink course data from the LMS to clickhouse (see `https://github.com/openedx/openedx-event-sink-clickhouse` for more information):: + + tutor [dev|local] do dump-courses-to-clickhouse --options "--force" + Superset Assets --------------- diff --git a/tutoraspects/commands_v0.py b/tutoraspects/commands_v0.py index 529997d39..42e592df1 100644 --- a/tutoraspects/commands_v0.py +++ b/tutoraspects/commands_v0.py @@ -92,4 +92,24 @@ def alembic(context, command) -> None: runner.run_job("aspects", command) -COMMANDS = (load_xapi_test_data, dbt, alembic) +@click.option("--options", default="") +@click.pass_obj +def dump_courses_to_clickhouse(context, options) -> None: + """ + Job that proxies the dump_courses_to_clickhouse commands. + """ + config = tutor_config.load(context.root) + runner = context.job_runner(config) + + command = f""" + ./manage.py cms dump_courses_to_clickhouse {options} + """ + runner.run_job("cms", command) + + +COMMANDS = ( + load_xapi_test_data, + dbt, + alembic, + dump_courses_to_clickhouse, +) diff --git a/tutoraspects/commands_v1.py b/tutoraspects/commands_v1.py index d98c6c973..16ae65897 100644 --- a/tutoraspects/commands_v1.py +++ b/tutoraspects/commands_v1.py @@ -94,8 +94,19 @@ def alembic(command: string) -> list[tuple[str, str]]: ] +# Ex: "tutor local do dump_courses_to_clickhouse " +@click.command(context_settings={"ignore_unknown_options": True}) +@click.option("--options", default="", type=click.UNPROCESSED) +def dump_courses_to_clickhouse(options) -> list[tuple[str, str]]: + """ + Job that proxies the dump_courses_to_clickhouse commands. + """ + return [("cms", f"./manage.py cms dump_courses_to_clickhouse {options}")] + + COMMANDS = ( load_xapi_test_data, dbt, alembic, + dump_courses_to_clickhouse, ) diff --git a/tutoraspects/plugin.py b/tutoraspects/plugin.py index ab99b2616..c3fd7da99 100644 --- a/tutoraspects/plugin.py +++ b/tutoraspects/plugin.py @@ -323,11 +323,11 @@ # and then add it to the MY_INIT_TASKS list. Each task is in the format: # ("", ("", "", "