<commit_before>from celery import shared_task

from workspaces.occupeye.cache import OccupeyeCache
from workspaces.occupeye.endpoint import TestEndpoint


@shared_task
def feed_occupeye_cache(test=False, mini=False):
    print("Running OccupEye Caching Operation")
    print("[+] Feeding Cache")
    cache = OccupeyeCache(endpoint=TestEndpoint({})) if test else OccupeyeCache()
    cache.feed_cache(full=(not mini))


@shared_task
def day_cache():
    feed_occupeye_cache.s(mini=True)()


@shared_task
def night_cache():
    feed_occupeye_cache.s(mini=False)()<commit_msg>backend workspaces: add healthcheck to occupeye tasks<commit_after>from celery import shared_task
import requests
import os

from workspaces.occupeye.cache import OccupeyeCache
from workspaces.occupeye.endpoint import TestEndpoint


@shared_task
def feed_occupeye_cache(test=False, mini=False):
    print("Running OccupEye Caching Operation")
    print("[+] Feeding Cache")
    cache = OccupeyeCache(endpoint=TestEndpoint({})) if test else OccupeyeCache()
    cache.feed_cache(full=(not mini))


@shared_task
def day_cache():
    try:
        requests.get(os.environ.get("HEALTHCHECK_OCCUPEYE_DAY") + "/start", timeout=5)
    except requests.exceptions.RequestException:
        pass

    feed_occupeye_cache.s(mini=True)()

    try:
        requests.get(os.environ.get("HEALTHCHECK_OCCUPEYE_DAY"), timeout=5)
    except requests.exceptions.RequestException:
        pass


@shared_task
def night_cache():
    try:
        requests.get(os.environ.get("HEALTHCHECK_OCCUPEYE_NIGHT") + "/start", timeout=5)
    except requests.exceptions.RequestException:
        pass

    feed_occupeye_cache.s(mini=False)()

    try:
        requests.get(os.environ.get("HEALTHCHECK_OCCUPEYE_NIGHT"), timeout=5)
    except requests.exceptions.RequestException:
        pass
{'fraction_non_alphanumeric': 0.10448577680525165, 'fraction_numerical': 0.002188183807439825, 'mean_word_length': 4.806349206349206, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6418788', 'n_tokens_mistral': 626, 'n_tokens_neox': 591, 'n_words': 113}