<commit_before>import gevent
import json
import os

from tendrl.commons.event import Event
from tendrl.commons.message import Message, ExceptionMessage
from tendrl.commons.utils import cmd_utils
from tendrl.commons import sds_sync
from tendrl.commons.utils import log_utils as logger
from tendrl.node_agent.node_sync import disk_sync


class CephIntegrtaionsSyncThread(sds_sync.StateSyncThread):
    def _run(self):
        logger.log(
            "debug",
            NS.get("publisher_id", None),
            {"message": "%s running" % self.__class__.__name__}
        )
        if NS.tendrl_context.integration_id is not None:
            while not self._complete.is_set():
                # sync of OSD journal details every 30 sec is fine
                # as this data doesnt change very frequently in cluster
                gevent.sleep(30)
                try:
                    # Sync the OSD journal details
                    logger.log(
                        "info",
                        NS.get("publisher_id", None),
                        {"message": "ceph_integrations_sync, osd journal details"}
                    )
                    journal_details = {}
                    osd_path = "/var/lib/ceph/osd"
                    osd_list = os.listdir("/var/lib/ceph/osd")

                    if len(osd_list) > 0:
                        for item in os.listdir(osd_path):
                            journal_path = "%s/%s/journal" % (osd_path, item)
                            out, err, rc = cmd_utils.Command(
                                "lsblk -o PKNAME,ROTA -n %s" % journal_path<commit_msg>Update __init__.py<commit_after>import gevent
import json
import os

from tendrl.commons.event import Event
from tendrl.commons.message import Message, ExceptionMessage
from tendrl.commons.utils import cmd_utils
from tendrl.commons import sds_sync
from tendrl.commons.utils import log_utils as logger
from tendrl.node_agent.node_sync import disk_sync


class CephIntegrtaionsSyncThread(sds_sync.StateSyncThread):
    def _run(self):
        logger.log(
            "debug",
            NS.get("publisher_id", None),
            {"message": "%s running" % self.__class__.__name__}
        )
        if NS.tendrl_context.integration_id is not None:
            while not self._complete.is_set():
                # sync of OSD journal details every 30 sec is fine
                # as this data doesnt change very frequently in cluster
                gevent.sleep(30)
                try:
                    # Sync the OSD journal details
                    logger.log(
                        "debug",
                        NS.get("publisher_id", None),
                        {"message": "ceph_integrations_sync, osd journal details"}
                    )
                    journal_details = {}
                    osd_path = "/var/lib/ceph/osd"
                    osd_list = os.listdir("/var/lib/ceph/osd")

                    if len(osd_list) > 0:
                        for item in os.listdir(osd_path):
                            journal_path = "%s/%s/journal" % (osd_path, item)
                            out, err, rc = cmd_utils.Command(
                                "lsblk -o PKNAME,ROTA -n %s" % journal_path
{'fraction_non_alphanumeric': 0.08190184049079755, 'fraction_numerical': 0.003067484662576687, 'mean_word_length': 1.5656963021243115, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6531867', 'n_tokens_mistral': 907, 'n_tokens_neox': 858, 'n_words': 228}