Trying to pass argument to job queue
- Dominant language
- Python
- Stars
- 12.3k
- Forks
- 999
- PR merge metrics
- No merged PRs in 30d
Description
I'm using the following example with a simple modification:
```
import Queue
import time
import threading
import schedule
def job(msg):
print(msg)
def worker_main():
while 1:
job_func = jobqueue.get()
job_func()
jobqueue.task_done()
jobqueue = Queue.Queue()
msg = 'I'm working'
schedule.every(10).seconds.do(jobqueue.put, job, msg)
worker_thread = threading.Thread(target=worker_main)
worker_thread.start()
while 1:
schedule.run_pending()
time.sleep(1)
```
But it always returns a TypeError: job() missing 1 required positional argument: 'msg', can you point me on what i'm missing?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the shown schedule.every(...).do(jobqueue.put, job, msg) call and the worker_main queue retrieval, then trace how arguments are passed into Queue.put and job. Done means the scheduled job can receive msg without the TypeError and the example continues to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100