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

multiple __init__ , version 1.16 #2053

Open
AIApprentice101 opened this issue Mar 5, 2024 · 1 comment
Open

multiple __init__ , version 1.16 #2053

AIApprentice101 opened this issue Mar 5, 2024 · 1 comment

Comments

@AIApprentice101
Copy link

Hi,

After upgrading to version 1.16, I notice the init is called multiple times. For example, here's the log

SampleWorker.__init__:  845e506f091b47a5ae50584a45c2ec4f
([], '845e506f091b47a5ae50584a45c2ec4f')
{'connection': Redis<ConnectionPool<Connection<host=0.0.0.0,port=6379,db=1>>>, 'job_class': None, 'queue_class': None, 'prepare_for_work': False, 'serializer': None}
SampleWorker.__init__:  9016f7d92d5c4ad488bb6079fdf2fe00
([], '9016f7d92d5c4ad488bb6079fdf2fe00')
{'connection': Redis<ConnectionPool<Connection<host=0.0.0.0,port=6379,db=1>>>, 'job_class': None, 'queue_class': None, 'prepare_for_work': False, 'serializer': None}
/home/rq/app/.local/lib/python3.10/site-packages/rq/worker.py:208: Warning: CLIENT SETNAME command not supported, setting ip_address to unknown
  warnings.warn('CLIENT SETNAME command not supported, setting ip_address to unknown', Warning)
SampleWorker.__init__:  5b6b1db040294e70963d5449f3461d76
([Queue('qa_queue')],)
{'name': None, 'connection': Redis<ConnectionPool<Connection<host=0.0.0.0,port=6379,db=1>>>, 'default_worker_ttl': 420, 'default_result_ttl': 500, 'maintenance_interval': 600, 'job_monitoring_interval': 30, 'job_class': <class 'rq.job.Job'>, 'queue_class': <class 'rq.queue.Queue'>, 'exception_handlers': None, 'disable_default_exception_handler': False, 'log_job_description': True, 'serializer': 'rq.serializers.JSONSerializer'}
05:29:28 Worker rq:worker:5b6b1db040294e70963d5449f3461d76 started with PID 13999, version 1.16.0

in 1.15, the log looks like

/home/rq/app/.local/lib/python3.10/site-packages/rq/worker.py:206: Warning: CLIENT SETNAME command not supported, setting ip_address to unknown
  warnings.warn('CLIENT SETNAME command not supported, setting ip_address to unknown', Warning)
SampleWorker__init__:  5912f916aa5c4f639662519094c14488
([Queue('qa_queue')],)
{'name': None, 'connection': Redis<ConnectionPool<Connection<host=0.0.0.0,port=6379,db=1>>>, 'default_worker_ttl': 420, 'default_result_ttl': 500, 'maintenance_interval': 600, 'job_monitoring_interval': 30, 'job_class': <class 'rq.job.Job'>, 'queue_class': <class 'rq.queue.Queue'>, 'exception_handlers': None, 'disable_default_exception_handler': False, 'log_job_description': True, 'serializer': 'rq.serializers.JSONSerializer'}
05:34:18 Worker rq:worker:5912f916aa5c4f639662519094c14488 started with PID 14196, version 1.15.0

My code is very simple

class SampleWorker(SimpleWorker):
    def __init__(self, *args, **kwargs):
        super(SimpleWorker, self).__init__(*args, **kwargs)
        print("SampleWorker.__init__: ", self.name)
        print(args)
        print(kwargs)
@selwin
Copy link
Collaborator

selwin commented Apr 12, 2024

Hmm, I'm not sure why this is the case. Mind opening a PR for this?

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