Cronjob for hourly email reminder in mozilla reps.

RESOLVED FIXED

Status

Infrastructure & Operations
WebOps: Other
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: tasos, Assigned: cturra)

Tracking

Details

(Whiteboard: [push interrupt])

(Reporter)

Description

5 years ago
Hi,

Could you please add a cronjob which runs every hour of every day, to the development server reps-dev.allizom.org?

The command to send the email reminder is:
./manage.py cron poll_vote_reminder

Thanks!
(Assignee)

Comment 1

5 years ago
added cron to reps-dev, which runs every hour on the 12th minute. i manually ran this command and received the below traceback - what is this command trying to connect to while getting this socket timeout?


[root@engagementadm.private.phx1 ~]# /usr/bin/flock -w 10 /var/lock/reps-dev-vote /data/engagement-dev/src/reps-dev.allizom.org/remo/manage.py cron poll_vote_reminder
Traceback (most recent call last):
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/manage.py", line 27, in <module>
    manage.main()
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/src/funfactory/funfactory/manage.py", line 143, in main
    execute_manager(current_settings)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/django/core/management/__init__.py", line 459, in execute_manager
    utility.execute()
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/src/django-cronjobs/cronjobs/management/commands/cron.py", line 64, in handle
    registered[script](*args)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/remo/voting/cron.py", line 40, in poll_vote_reminder
    template_reminder, ctx_data)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/celery/app/task/__init__.py", line 353, in delay
    return self.apply_async(args, kwargs)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/celery/app/task/__init__.py", line 449, in apply_async
    publish = publisher or self.app.amqp.publisher_pool.acquire(block=True)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/kombu/connection.py", line 657, in acquire
    R = self.prepare(R)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/kombu/pools.py", line 54, in prepare
    p = p()
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/kombu/pools.py", line 45, in <lambda>
    return lambda: self.create_producer()
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/celery/app/amqp.py", line 265, in create_producer
    pub = self.app.amqp.TaskPublisher(conn, auto_declare=False)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/celery/app/amqp.py", line 328, in TaskPublisher
    return TaskPublisher(*args, **self.app.merge(defaults, kwargs))
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/celery/app/amqp.py", line 158, in __init__
    super(TaskPublisher, self).__init__(*args, **kwargs)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/kombu/compat.py", line 61, in __init__
    super(Publisher, self).__init__(connection, self.exchange, **kwargs)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/kombu/messaging.py", line 79, in __init__
    self.revive(self.channel)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/kombu/messaging.py", line 168, in revive
    channel = channel.default_channel
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/kombu/connection.py", line 581, in default_channel
    self.connection
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/kombu/connection.py", line 574, in connection
    self._connection = self._establish_connection()
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/kombu/connection.py", line 533, in _establish_connection
    conn = self.transport.establish_connection()
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/kombu/transport/amqplib.py", line 279, in establish_connection
    connect_timeout=conninfo.connect_timeout)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/kombu/transport/amqplib.py", line 89, in __init__
    super(Connection, self).__init__(*args, **kwargs)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/amqplib/client_0_8/connection.py", line 129, in __init__
    self.transport = create_transport(host, connect_timeout, ssl)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/amqplib/client_0_8/transport.py", line 281, in create_transport
    return TCPTransport(host, connect_timeout)
  File "/data/engagement-dev/src/reps-dev.allizom.org/remo/vendor/lib/python/amqplib/client_0_8/transport.py", line 85, in __init__
    raise socket.error, msg
socket.timeout: timed out
Assignee: server-ops-webops → cturra
Status: NEW → ASSIGNED
Flags: needinfo?(tasos)
Whiteboard: [push interrupt]
In order the cronjob to work, celery requires to connect to a message queue broker.
We have used rabbitmq for development.

An example of django-celery settings can be found here:
https://github.com/mozilla/remo/blob/master/remo/settings/local.py-dist#L65
Flags: needinfo?(tasos)
(Assignee)

Updated

5 years ago
Depends on: 879405
(Assignee)

Comment 3

5 years ago
thnx for the clarification :nemo. this will require an update to the engagements clusters ACLS, which i have submitted bug 879405 for. once that bug is complete, this should all be sorted.
(Assignee)

Comment 4

5 years ago
with the ACLs added, the script tests out successfully. 

[root@engagementadm.private.phx1 ~]# /usr/bin/flock -w 10 /var/lock/reps-dev-vote /data/engagement-dev/src/reps-dev.allizom.org/remo/manage.py cron poll_vote_reminder

[root@engagementadm.private.phx1 ~]# echo $?
0
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Component: Server Operations: Web Operations → WebOps: Other
Product: mozilla.org → Infrastructure & Operations
You need to log in before you can comment on or make changes to this bug.