Closed karpitsky closed 5 years ago
I think I've found a solution for my case. My config has QUEUES = ("default",)
, so when I run a scheduler mrq-worker --scheduler
it also runs a worker for the default queue. If this worker gets a job it will fail with the error KeyError 'scheduler'
, see the value of self.config
below. I've removed the "default" queue from my config and it works.
self.config
on the line 510 for the worker
{
'scheduler_interval': 60,
'add_network_latency': '0',
'no_import_patch': False,
'worker_class': 'mrq.worker.Worker',
'greenlets': 100,
'redis_max_connections': 1000,
'tasks': {},
'trace_greenlets': False,
'default_job_cancel_ttl': 86400,
'report_interval': 10,
'redis_timeout': 30,
'log_handler': 'mrq.logger.MongoHandler',
'log_level': 'DEBUG',
'mongodb_jobs': 'mongodb://127.0.0.1:30000/mrq?ssl=true&ssl_ca_certs=/opt/ssl/cacert.pem',
'print_mongodb': False,
'redis': 'redis://127.0.0.1:6379/2',
'max_memory': 0,
'version': False,
'redis_prefix': 'mrq',
'config': None,
'profile': False,
'scheduled_tasks': {},
'scheduler_tasks': [***],
'log_handlers': {},
'default_job_ttl': 15552000,
'max_jobs': 0,
'use_large_job_ids': True,
'default_job_timeout': 86400,
'project_dir': '/usr/src/app',
'report_file': '',
'processes': 1,
'trace_memory_type': '',
'name': None,
'trace_io': True,
'default_job_retry_delay': 3,
'default_job_abort_ttl': 86400,
'default_job_max_retries': 3,
'trace_memory_output_dir': 'memory_traces',
'quiet': False,
'mongodb_logs': '1',
'trace_memory': False,
'dequeue_strategy': 'sequential',
'paused_queues_refresh_interval': 10,
'log_format': '%(asctime)s [%(levelname)s] %(message)s',
'queues': ('default',),
'default_job_result_ttl': 604800
}
self.config
on the line 510 for the scheduler
{
'ensure_indexes': False,
'add_network_latency': '0',
'no_import_patch': False,
'worker_class': 'mrq.worker.Worker',
'scheduler_interval': 60,
'greenlets': 100,
'redis_max_connections': 1000,
'worker_id': '',
'trace_greenlets': False,
'default_job_cancel_ttl': 86400,
'dequeue_strategy': 'sequential',
'admin_ip': '127.0.0.1',
'scheduled_tasks': {},
'redis_timeout': 30,
'log_handler': 'mrq.logger.MongoHandler',
'log_level': 'DEBUG',
'tasks': {},
'mongodb_jobs': 'mongodb://127.0.0.1:30000/mrq?ssl=true&ssl_ca_certs=/opt/ssl/cacert.pem',
'worker_profile': '',
'print_mongodb': False,
'redis': 'redis://127.0.0.1:6379/2',
'max_memory': 0,
'subqueues_refresh_interval': 60,
'version': False,
'redis_prefix': 'mrq',
'scheduler_tasks': [***],
'config': None,
'profile': False,
'report_interval': 10,
'max_jobs': 0,
'task_blacklist': '',
'admin_port': 0,
'max_latency': 1.0,
'log_handlers': {},
'default_job_ttl': 15552000,
'agent_id': '',
'scheduler': True,
'use_large_job_ids': True,
'default_job_timeout': 86400,
'project_dir': '/usr/src/app',
'worker_group': '',
'report_file': '',
'processes': 1,
'trace_memory_type': '',
'name': None,
'trace_io': True,
'default_job_retry_delay': 3,
'default_job_abort_ttl': 86400,
'default_job_max_retries': 3,
'trace_memory_output_dir': 'memory_traces',
'local_ip': '***',
'quiet': False,
'mongodb_logs': '1',
'external_ip': None,
'trace_memory': False,
'max_time': 0.0,
'paused_queues_refresh_interval': 10,
'log_format': '%(asctime)s [%(levelname)s] %(message)s',
'queues': ('default',),
'default_job_result_ttl': 604800,
'task_whitelist': ''
}
Hi @karpitsky !
Thanks for the report. I can't reproduce the behaviour with the latest master.
I don't see how "scheduler"
wouldn't be in self.config
. It should at least be False
because it's in the config in all cases for mrq-worker
:
https://github.com/pricingassistant/mrq/blob/master/mrq/config.py#L365
Are you modifying the worker config somewhere maybe?
thanks!
Hi @sylvinus
Thanks for your time! I didn't see the error after changing QUEUES = ("default",)
to QUEUES = []
I used the config as is, without modifying.
As I don't see the error anymore I close this ticket.
Hello,
I've got the following error message:
# mrq-worker --scheduler
Do you have an idea how to fix it?