ScheduledTask Plugin throws TypeError: 'NoneType' object is not callable

This issue has been tracked since 2023-01-25.

Please verify that this bug has NOT been raised before.

  • I checked and didn't find a similar issue

Describe the bug*

The ScheduledTasksPlugin throws the mentioned error massage. The reason is the member_func. If I remove this from the SCHEDULED_TASKS the error is gone. There is a difference between calling the global functions and the function in the class. the global functions work fine. I had a look in the mentioned django source but i do not have enough insight into this.

Steps to Reproduce

Eneble the ScheduledTasksPlugin from the admin interface
Watch the log

Expected behaviour

function member_func should be called.

Deployment Method

  • Docker
  • Bare metal

Version Information

InvenTree Version [0.10.0 dev]

Development Version
Commit Hash c20b327
Commit Date 2023-01-25

Relevant log output

17:17:55 [Q] INFO Process-1:4 processing [jersey-ceiling-mike-mississippi]
Hello
World
17:17:55 [Q] INFO Processed [stream-august-florida-twelve]
17:17:55 [Q] INFO Processed [jersey-ceiling-mike-mississippi]
17:17:55 [Q] ERROR Failed [october-nineteen-winter-maine] - 'NoneType' object is not callable : Traceback (most recent call last):
  File "/home/konrad/.local/lib/python3.10/site-packages/django_q/cluster.py", line 432, in worker
    res = f(*task["args"], **task["kwargs"])
TypeError: 'NoneType' object is not callable

17:19:55 [Q] INFO Process-1:1 processing [october-nineteen-winter-maine]
17:19:55 [Q] ERROR Failed [october-nineteen-winter-maine] - 'NoneType' object is not callable : Traceback (most recent call last):
  File "/home/konrad/.local/lib/python3.10/site-packages/django_q/cluster.py", line 432, in worker
    res = f(*task["args"], **task["kwargs"])
TypeError: 'NoneType' object is not callable

17:19:55 [Q] INFO Enqueued 38698
SchrodingersGat wrote this answer on 2023-01-30

@SergeoLacruz can you share a screenshot of the "scheduled tasks" in the admin page?

e.g.

image

SergeoLacruz wrote this answer on 2023-01-30

This is the overview
tasks

SchrodingersGat wrote this answer on 2023-01-30

Right, this looks like a regression introduced in #4243

@matmair can you have a look at this in the context of your recent PR?

Remember that scheduled tasks cannot be the actual method itself - they have to be dot-notation method names

matmair wrote this answer on 2023-01-30

@SergeoLacruz could you try to delete all tasks (in admin) and restart the server? I am interested if the error reappears. Would you be able to supply the function (I believe it is member_func) that is causing the problem?

SchrodingersGat wrote this answer on 2023-02-05

Hey @SergeoLacruz any updates on this one?

SergeoLacruz wrote this answer on 2023-02-05

I did not see the question, sorry.
Yes the error reappears.
I selected BACKGROUND TASKS -> Scheduled tasks in the admin interface and deleted all.
Restarted server and worker
Same problem.
The function is in the ~/src/InvenTree/plugin/samples/integration/scheduled_task.py
I just activate the sample without any modifications.

SchrodingersGat wrote this answer on 2023-02-05

@SergeoLacruz yep, I found the same error in the sample plugin too :)

SergeoLacruz wrote this answer on 2023-02-05

Hmmmmm,
The error message is gone. But the expected output of member_func does still not appear.
Instead I get in the log:

21:47:05 [Q] INFO Process-1:1 processing [potato-asparagus-quiet-nitrogen]
Plugin registry has no record of plugin 'schedule'
21:47:05 [Q] INFO Processed [potato-asparagus-quiet-nitrogen]
21:48:35 [Q] INFO Enqueued 45179

Just activate the ScheduledTasksPlugin

SchrodingersGat wrote this answer on 2023-02-05

And the ScheduledTasksPlugin is definitely enabled? I can confirm on my test instance that the plugin member function is working as expected

SergeoLacruz wrote this answer on 2023-02-05

After a fresh reboot this morning everything is working fine :-) Thanks for the support.

More Details About Repo
Owner Name inventree
Repo Name InvenTree
Full Name inventree/InvenTree
Language Python
Created Date 2017-03-23
Updated Date 2023-03-31
Star Count 2586
Watcher Count 61
Fork Count 411
Issue Count 141

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date