From 8c524c1d4a5f8558b999ce35d7f4bf9f1aad0113 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Mon, 24 Jul 2023 17:25:33 -0700 Subject: [PATCH 1/3] Handle new method for passing Worker arguments. --- .../Kolibri/TaskworkerWorkerService.java | 6 ------ src/taskworker.py | 11 +++++++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/python-for-android/dists/kolibri/src/main/java/org/learningequality/Kolibri/TaskworkerWorkerService.java b/python-for-android/dists/kolibri/src/main/java/org/learningequality/Kolibri/TaskworkerWorkerService.java index 599ad417..d5cd3489 100644 --- a/python-for-android/dists/kolibri/src/main/java/org/learningequality/Kolibri/TaskworkerWorkerService.java +++ b/python-for-android/dists/kolibri/src/main/java/org/learningequality/Kolibri/TaskworkerWorkerService.java @@ -32,10 +32,4 @@ public void onCreate() { new File(context.getApplicationInfo().nativeLibraryDir) ); } - @Override - public void onDestroy() { - super.onDestroy(); - // When the service exits, call System.exit to teardown the process. - System.exit(0); - } } diff --git a/src/taskworker.py b/src/taskworker.py index 2f978525..1aef7e0a 100644 --- a/src/taskworker.py +++ b/src/taskworker.py @@ -1,16 +1,19 @@ import logging -from os import environ import initialization # noqa: F401 keep this first, to ensure we're set up for other imports from kolibri.main import initialize -logging.info("Starting Kolibri task worker") +import __main__ -initialize(skip_update=True) +job_id = __main__.PYTHON_WORKER_ARGUMENT + +logging.info("Starting Kolibri task worker, for job {}".format(job_id)) -job_id = environ.get("PYTHON_WORKER_ARGUMENT", "") +initialize(skip_update=True) # Import this after we have initialized Kolibri from kolibri.core.tasks.worker import execute_job # noqa: E402 execute_job(job_id) + +logging.info("Ending Kolibri task worker, for job {}".format(job_id)) From efd16fa5dbf93f828513a0309f00d1af1b1ec0ab Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Mon, 24 Jul 2023 17:26:32 -0700 Subject: [PATCH 2/3] Update P4A. --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 135fa73b..269568ec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ cython virtualenv -git+https://github.com/learningequality/python-for-android@5621e3f7223fe73fdc3522874affa66a0c482f5e#egg=python-for-android +git+https://github.com/learningequality/python-for-android@6afd747999d5252839e79f498bd237743a1ca98b#egg=python-for-android From f73619afd53a4844509400c895f9295c4c83812e Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 20 Jul 2023 14:15:41 -0600 Subject: [PATCH 3/3] Pin cython to 0.29 series Cython just released a new 3.0 major version, and it seems to break the `autoclass` function from pyjnius. Stick with the old version until that's ironed out. Fixes: #164 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 269568ec..8ff666cd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -cython +cython~=0.29 virtualenv git+https://github.com/learningequality/python-for-android@6afd747999d5252839e79f498bd237743a1ca98b#egg=python-for-android