Skip to content

Commit

Permalink
crontab exorcism (#3483)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dbutenhof authored Jul 8, 2023
1 parent ec6f42b commit aaf890c
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 191 deletions.
8 changes: 3 additions & 5 deletions lib/pbench/cli/server/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,9 @@ def run_gunicorn(server_config: PbenchServerConfig, logger: Logger) -> int:
notifier.notify(f"STATUS=Error initializing database: {exc}")
return 1

# Multiple cron jobs will attempt to file reports with the Elasticsearch
# instance when they start and finish, causing them to all to try to
# initialize the templates in the Indexing sub-system. To avoid race
# conditions that can create stack traces, we initialize the indexing sub-
# system before we start the cron jobs.
# The server and indexer both attempt to initialize the Elasticsearch
# instance, which can cause a race and messy logging. To avoid that,
# initialize the indexing sub-system here.
notifier.notify("STATUS=Initializing Elasticsearch")
logger.info("Performing Elasticsearch indexing setup")
try:
Expand Down
1 change: 0 additions & 1 deletion server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ install-dirs:
${INSTALL} ${INSTALLOPTS} ${DESTDIR}
${INSTALL} ${INSTALLOPTS} ${BINDIR}
${INSTALL} ${INSTALLOPTS} ${LIBDIR}
${INSTALL} ${INSTALLOPTS} ${LIBDIR}/crontab
${INSTALL} ${INSTALLOPTS} ${LIBDIR}/pbench
${INSTALL} ${INSTALLOPTS} ${LIBDIR}/pbench/cli

Expand Down
162 changes: 0 additions & 162 deletions server/bin/pbench-create-crontab

This file was deleted.

22 changes: 0 additions & 22 deletions server/lib/config/pbench-server-default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ workers = 3
# Set the gunicorn worker timeout. Setting it to 0 has the effect of infinite timeouts
worker_timeout = 9000

# Default roles this pbench server takes on, see crontab roles below.
roles = pbench-results

# Optional server environment definition
#environment = staging

Expand Down Expand Up @@ -119,22 +116,3 @@ logging_level = INFO
#logger_port = 514
# "log_dir" is only considered when "logger_type" is set to "file".
#log_dir =

###########################################################################
# crontab roles
[pbench-results]
user = %(default-user)s
mailfrom = %(user)s@localhost
tasks = pbench-index, pbench-re-index

###########################################################################
# crontab tasks

[pbench-index]
crontab = * * * * * flock -n %(lock-dir)s/pbench-index.lock %(script-dir)s/pbench-index

[pbench-re-index]
crontab = * * * * * flock -n %(lock-dir)s/pbench-re-index.lock %(script-dir)s/pbench-index --re-index

[pbench-index-tool-data]
crontab = * * * * * flock -n %(lock-dir)s/pbench-index-tool-data.lock %(script-dir)s/pbench-index --tool-data
2 changes: 1 addition & 1 deletion server/lib/systemd/pbench-index.timer
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Description=Pbench Server indexer timer
After=pbench-server.service
Requires=pbench-index.service
BindsTo=pbench-server.service

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

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

0 comments on commit aaf890c

Please sign in to comment.