def stats_uploader_daemon(self, stats): """ Starts the StatsUploader as a daemon process if it is already not running """ log.debug("Checking if the statsUploaderDaemon is already running") stats_pid = os.path.join("/tmp", self._user, ".pid_stats") stats_uploader_dir = os.path.join("/tmp", self._user) dirutil.safe_mkdir(stats_uploader_dir) if not os.path.exists(stats_pid): log.debug("Starting the daemon") stats_log_file = os.path.join("/tmp", self._user, "buildtime_uploader") log.debug("The logs are writen to %s" % stats_log_file) if spawn_daemon(pidfile=stats_pid, quiet=True): force_stats_upload = False if "--force_stats_upload" in sys.argv: force_stats_upload = True su = StatsUploader(STATS_COLLECTION_URL, STATS_COLLECTION_PORT, STATS_COLLECTION_ENDPOINT, self._max_delay, self._get_default_stats_file(), self._user, force_stats_upload) su.upload_sync(stats)
def __init__(self, host, port, endpoint, max_delay, stats_file, user): self._calls = [] RealStatsUploader.__init__(self,host, port, endpoint, max_delay, stats_file, user)
def __init__(self, host, port, endpoint, max_delay, stats_file, user): self._calls = [] RealStatsUploader.__init__(self, host, port, endpoint, max_delay, stats_file, user)