From caf1a5281f9e974ba73ceded3a782db3d0142c5f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 26 Apr 2019 18:22:55 +0200 Subject: Merging upstream version 1.14.0. Signed-off-by: Daniel Baumann --- collectors/python.d.plugin/python.d.plugin.in | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'collectors/python.d.plugin/python.d.plugin.in') 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 -- cgit v1.2.3