Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

worker job id #13

Closed
jdupl123 opened this issue Jul 13, 2018 · 2 comments
Closed

worker job id #13

jdupl123 opened this issue Jul 13, 2018 · 2 comments

Comments

@jdupl123
Copy link

I run the folowing example

from faktory import Worker
import logging
import time


def your_function(x, y):
    time.sleep(15)
    return x + y


w = Worker(queues=['default'], concurrency=1)
w.register('test', your_function)
print(w.get_worker_id())
logging.basicConfig(level=logging.DEBUG)
w.run()  # runs until control-c or worker shutdown from Faktory web UI

worker id prints as 32860cb098ae4e13ab8a7f44af498bf1
but heartbeat shows
DEBUG:faktory.worker:Sending heartbeat for worker 9e9775cb1abc47b7b6c6bc1ec6689610

looking in the web interface it seem that the debug message contains the correct id.

@cdrx
Copy link
Owner

cdrx commented Jul 30, 2018

w.worker_id will give you the worker's actual id

get_worker_id() is poorly named, it should be called something like generate_random_worker_id()

@cdrx cdrx closed this as completed Jul 30, 2018
@jdupl123
Copy link
Author

thanks for reply 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants