<commit_before>#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
import sys

dir = os.path.split(os.path.split(os.path.realpath(__file__))[0])[0]
sys.path.append(dir)

import json
import requests
from datetime import datetime
from utilities.prompt_format import item

#
# Scope variables.
#
NOW = datetime.now().isoformat(str('T'))
NODE_ID = os.getenv('NODE_ID', None)
NODE_WATCH_ADDR = os.getenv('NODE_WATCH_ADDR', 'http://localhost:9000')

def SendStatus(status=None, id=NODE_ID, time=NOW):
  '''Sending status to the node watching service.'''

  if status == 'error':
    message = 'Failed to collect data.'

  if status == 'ok':
    message = 'Data collection successful.'

  payload = {
    'id': id,
    'status': status,
    'time': time,
    'message': message
  }

  print '%s Sending notification to Node Watch.' % item('prompt_ping')
  r = requests.post(NODE_WATCH_ADDR, data=payload)
  if r.json()['success'] == False:
    print r.json()<commit_msg>adding the docker send variable<commit_after>#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
import sys

dir = os.path.split(os.path.split(os.path.realpath(__file__))[0])[0]
sys.path.append(dir)

import json
import requests
from datetime import datetime
from utilities.prompt_format import item

#
# Scope variables.
#
NOW = datetime.now().isoformat(str('T'))
NODE_ID = os.getenv('NODE_ID', None)
NODE_WATCH_ADDR = os.getenv('NODE_WATCH_PORT_27017_TCP_ADDR', 'http://localhost:9000')

def SendStatus(status=None, id=NODE_ID, time=NOW):
  '''Sending status to the node watching service.'''

  if status == 'error':
    message = 'Failed to collect data.'

  if status == 'ok':
    message = 'Data collection successful.'

  payload = {
    'id': id,
    'status': status,
    'time': time,
    'message': message
  }

  print '%s Sending notification to Node Watch.' % item('prompt_ping')
  r = requests.post(NODE_WATCH_ADDR, data=payload)
  if r.json()['success'] == False:
    print r.json()
{'fraction_non_alphanumeric': 0.1560428352881183, 'fraction_numerical': 0.009688934217236104, 'mean_word_length': 4.204244031830239, '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': '4475073', 'n_tokens_mistral': 686, 'n_tokens_neox': 659, 'n_words': 169}