diff options
Diffstat (limited to 'collectors/python.d.plugin/python.d.plugin.in')
-rw-r--r-- | collectors/python.d.plugin/python.d.plugin.in | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/collectors/python.d.plugin/python.d.plugin.in b/collectors/python.d.plugin/python.d.plugin.in index dc6c5be9f..f1429b6fa 100644 --- a/collectors/python.d.plugin/python.d.plugin.in +++ b/collectors/python.d.plugin/python.d.plugin.in @@ -1,5 +1,9 @@ #!/usr/bin/env bash -'''':; exec "$(command -v python || command -v python3 || command -v python2 || +'''':; +if [[ "$OSTYPE" == "darwin"* ]]; then + export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES +fi +exec "$(command -v python || command -v python3 || command -v python2 || echo "ERROR python IS NOT AVAILABLE IN THIS SYSTEM")" "$0" "$@" # ''' # -*- coding: utf-8 -*- @@ -131,6 +135,12 @@ JOB_BASE_CONF = { } +def heartbeat(): + if IS_ATTY: + return + safe_print('\n') + + class HeartBeat(threading.Thread): def __init__(self, every): threading.Thread.__init__(self) @@ -140,9 +150,7 @@ class HeartBeat(threading.Thread): def run(self): while True: time.sleep(self.every) - if IS_ATTY: - continue - safe_print('\n') + heartbeat() def load_module(name): @@ -201,6 +209,8 @@ class ModuleChecker(multiprocessing.Process): task = self.task_queue.get() if task is END_TASK_MARKER: + # TODO: find better solution, understand why heartbeat thread doesn't work + heartbeat() self.task_queue.task_done() self.result_queue.put(END_TASK_MARKER) return False @@ -645,6 +655,8 @@ class Plugin: job.post_check(int(self.min_update_every)) self.checked_jobs[job.module_name].append(check_name) + JobRunner(job).start() + return stop_retrying |