Skip to content

Commit

Permalink
feat: Drop the use of the Tubular repository
Browse files Browse the repository at this point in the history
The Tubular repository has been deplrecated and the relevant
scripts have been moved to the edx-platform codebase.

Drop the custom image build and rely on the openedx image.

Fixes: #32
  • Loading branch information
Maari Tamm committed Mar 28, 2024
1 parent ee18c31 commit 8ed57d0
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 49 deletions.
9 changes: 6 additions & 3 deletions tutorretirement/patches/k8s-jobs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ spec:
spec:
containers:
- name: retirement
image: {{ RETIREMENT_DOCKER_IMAGE }}
image: {{ DOCKER_IMAGE_OPENEDX }}
command:
- 'bash'
- '-e'
- 'run_retirement_pipeline.sh'
- '/openedx/edx-platform/scripts/user_retirement/run_retirement_pipeline.sh'
- '{{ RETIREMENT_COOL_OFF_DAYS }}'
volumeMounts:
- name: pipeline-config
mountPath: '/tubular/pipeline_config/config.yml'
mountPath: '/openedx/edx-platform/scripts/user_retirement/config.yml'
subPath: config.yml
- name: pipeline-run
mountPath: '/openedx/edx-platform/scripts/user_retirement/run_retirement_pipeline.sh'
subPath: run_retirement_pipeline.sh
volumes:
- name: pipeline-config
configMap:
Expand Down
3 changes: 2 additions & 1 deletion tutorretirement/patches/kustomization-configmapgenerator
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- name: retirement-pipeline-configmap
files:
- plugins/retirement/build/retirement/pipeline_config/config.yml
- plugins/retirement/apps/retirement/config.yml
- plugins/retirement/apps/retirement/run_retirement_pipeline.sh
7 changes: 3 additions & 4 deletions tutorretirement/patches/local-docker-compose-jobs-services
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
############# Retirement worker service
retirement-job:
image: {{ RETIREMENT_DOCKER_IMAGE }}
image: {{ DOCKER_IMAGE_OPENEDX }}
volumes:
- ../plugins/retirement/build/retirement/pipeline_config:/tubular/pipeline_config
depends_on:
- lms
- ../plugins/retirement/apps/retirement:/openedx/edx-platform/scripts/user_retirement

20 changes: 2 additions & 18 deletions tutorretirement/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,14 @@
},
"defaults": {
"VERSION": __version__,
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}retirement:{{ RETIREMENT_VERSION }}", # noqa: E501
"EDX_OAUTH2_CLIENT_ID": "retirement_service_worker",
"COOL_OFF_DAYS": 30,
"TUBULAR_VERSION": "{{ OPENEDX_COMMON_VERSION }}",
"K8S_CRONJOB_HISTORYLIMIT_FAILURE": 1,
"K8S_CRONJOB_HISTORYLIMIT_SUCCESS": 3,
"K8S_CRONJOB_SCHEDULE": "0 0 * * *",
},
}

hooks.Filters.IMAGES_BUILD.add_item((
"retirement",
("plugins", "retirement", "build", "retirement"),
"{{ RETIREMENT_DOCKER_IMAGE }}",
(),
))
hooks.Filters.IMAGES_PULL.add_item((
"retirement",
"{{ RETIREMENT_DOCKER_IMAGE }}",
))
hooks.Filters.IMAGES_PUSH.add_item((
"retirement",
"{{ RETIREMENT_DOCKER_IMAGE }}",
))


@local_command_group.command(help="Run the retirement pipeline")
@click.pass_obj
Expand All @@ -51,7 +34,8 @@ def retire_users(context):
cool_off_days = config["RETIREMENT_COOL_OFF_DAYS"]
job_runner.run_task(
service="retirement",
command=f"bash -e run_retirement_pipeline.sh {cool_off_days}"
command="bash -e /openedx/edx-platform/scripts/user_retirement"
f"/run_retirement_pipeline.sh {cool_off_days}"
)


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cool_off_days=$1
python /openedx/edx-platform/scripts/user_retirement/get_learners_to_retire.py --config_file=./openedx/edx-platform/scripts/user_retirement/config.yml --output_dir=learners_to_retire --cool_off_days="$cool_off_days"
for filename in learners_to_retire/*;do
if test ! -f "$filename";then
echo "No users to retire"
continue
else
IFS="=" read -r name username <"$filename"
echo "Retiring $username"
python /openedx/edx-platform/scripts/user_retirement/retire_one_learner.py --config_file=./openedx/edx-platform/scripts/user_retirement/config.yml --username="$username"
fi
done
11 changes: 0 additions & 11 deletions tutorretirement/templates/retirement/build/retirement/Dockerfile

This file was deleted.

This file was deleted.

0 comments on commit 8ed57d0

Please sign in to comment.