Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion sbin/grid_janitor.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
Expand All @@ -20,12 +20,12 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Check warning on line 23 in sbin/grid_janitor.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)

Check warning on line 23 in sbin/grid_janitor.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

line too long (81 > 80 characters)
#
# -- END_HEADER ---
#

"""Daemon to take care of various recurring tasks like clean up, cache updates

Check warning on line 28 in sbin/grid_janitor.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

First line should end with a period (not 's')

Check warning on line 28 in sbin/grid_janitor.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

1 blank line required between summary line and description (found 0)

Check warning on line 28 in sbin/grid_janitor.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

First line should end with a period (not 's')

Check warning on line 28 in sbin/grid_janitor.py

View workflow job for this annotation

GitHub Actions / Style check python and annotate

1 blank line required between summary line and description (found 0)
and pruning of pending requests.
"""

Expand Down Expand Up @@ -90,12 +90,18 @@
print("Starting janitor daemon - Ctrl-C to quit")
logger.info("(%s) Starting Janitor daemon" % main_pid)

last_failed = False
logger.debug("(%s) Starting main loop" % main_pid)
print("%s: Start main loop" % os.getpid())
while not check_stop():
try:
now = time.time()
if handle_janitor_tasks(configuration, now) <= 0:
if last_failed:
# Throttle on general exception in main loop
interruptible_sleep(configuration, LONG_THROTTLE_SECS,
(check_run, check_stop))
last_failed = False
elif handle_janitor_tasks(configuration, now) <= 0:
interruptible_sleep(configuration, LONG_THROTTLE_SECS,
(check_run, check_stop))
else:
Expand All @@ -108,6 +114,7 @@
# so we make sure to propagate to monitor child
print("Interrupt requested - shutdown")
except Exception as exc:
last_failed = True
logger.error(
"(%s) Caught unexpected exception: %s" % (os.getpid(), exc)
)
Expand Down
Loading