Skip to content

Commit aaf890c

Browse files
authored
crontab exorcism (#3483)
PBENCH-1206 When use of crontab was removed in favor of a timed systemd service, some loose ends were overlooked. Also, the BindsTo directive was put in the wrong section of the timer service file, leading to (apparently innocuous) warnings on startup. This does some cleanup.
1 parent ec6f42b commit aaf890c

File tree

5 files changed

+4
-191
lines changed

5 files changed

+4
-191
lines changed

lib/pbench/cli/server/shell.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,9 @@ def run_gunicorn(server_config: PbenchServerConfig, logger: Logger) -> int:
138138
notifier.notify(f"STATUS=Error initializing database: {exc}")
139139
return 1
140140

141-
# Multiple cron jobs will attempt to file reports with the Elasticsearch
142-
# instance when they start and finish, causing them to all to try to
143-
# initialize the templates in the Indexing sub-system. To avoid race
144-
# conditions that can create stack traces, we initialize the indexing sub-
145-
# system before we start the cron jobs.
141+
# The server and indexer both attempt to initialize the Elasticsearch
142+
# instance, which can cause a race and messy logging. To avoid that,
143+
# initialize the indexing sub-system here.
146144
notifier.notify("STATUS=Initializing Elasticsearch")
147145
logger.info("Performing Elasticsearch indexing setup")
148146
try:

server/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ install-dirs:
4040
${INSTALL} ${INSTALLOPTS} ${DESTDIR}
4141
${INSTALL} ${INSTALLOPTS} ${BINDIR}
4242
${INSTALL} ${INSTALLOPTS} ${LIBDIR}
43-
${INSTALL} ${INSTALLOPTS} ${LIBDIR}/crontab
4443
${INSTALL} ${INSTALLOPTS} ${LIBDIR}/pbench
4544
${INSTALL} ${INSTALLOPTS} ${LIBDIR}/pbench/cli
4645

server/bin/pbench-create-crontab

Lines changed: 0 additions & 162 deletions
This file was deleted.

server/lib/config/pbench-server-default.cfg

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ workers = 3
6868
# Set the gunicorn worker timeout. Setting it to 0 has the effect of infinite timeouts
6969
worker_timeout = 9000
7070

71-
# Default roles this pbench server takes on, see crontab roles below.
72-
roles = pbench-results
73-
7471
# Optional server environment definition
7572
#environment = staging
7673

@@ -119,22 +116,3 @@ logging_level = INFO
119116
#logger_port = 514
120117
# "log_dir" is only considered when "logger_type" is set to "file".
121118
#log_dir =
122-
123-
###########################################################################
124-
# crontab roles
125-
[pbench-results]
126-
user = %(default-user)s
127-
mailfrom = %(user)s@localhost
128-
tasks = pbench-index, pbench-re-index
129-
130-
###########################################################################
131-
# crontab tasks
132-
133-
[pbench-index]
134-
crontab = * * * * * flock -n %(lock-dir)s/pbench-index.lock %(script-dir)s/pbench-index
135-
136-
[pbench-re-index]
137-
crontab = * * * * * flock -n %(lock-dir)s/pbench-re-index.lock %(script-dir)s/pbench-index --re-index
138-
139-
[pbench-index-tool-data]
140-
crontab = * * * * * flock -n %(lock-dir)s/pbench-index-tool-data.lock %(script-dir)s/pbench-index --tool-data

server/lib/systemd/pbench-index.timer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Description=Pbench Server indexer timer
33
After=pbench-server.service
44
Requires=pbench-index.service
5+
BindsTo=pbench-server.service
56

67
[Timer]
78
Unit=pbench-index.service
@@ -10,4 +11,3 @@ OnCalendar=*-*-* *:*:15
1011

1112
[Install]
1213
WantedBy=timers.target
13-
BindsTo=pbench-server.service

0 commit comments

Comments
 (0)