<commit_before>import os
import sys
import logging
import datetime
from dateutil import parser
import socket
import logging
import pytz


log = logging.getLogger(__name__)


IS_EC2_INSTANCE = -1

def is_ec2_instance():
    """Try fetching instance metadata at 'curl http://169.254.169.254/latest/meta-data/'
    to see if host is on an ec2 instance"""

    # Note: this code assumes that docker containers running on ec2 instances
    # inherit instances metadata, which they do as of 2016-08-25

    global IS_EC2_INSTANCE

    if IS_EC2_INSTANCE != -1:
        # Returned the cached value
        log.debug("IS_EC2_INSTANCE=%s" % IS_EC2_INSTANCE)
        return IS_EC2_INSTANCE

    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.settimeout(0.2)
    try:
        s.connect(("169.254.169.254", 80))
        IS_EC2_INSTANCE = 1
        return True
    except socket.timeout:
        IS_EC2_INSTANCE = 0
        return False
    except socket.error:
        IS_EC2_INSTANCE = 0
        return False
<commit_msg>Remove bothering debug log from is_ec2_instance()<commit_after>import os
import sys
import logging
import datetime
from dateutil import parser
import socket
import logging
import pytz


log = logging.getLogger(__name__)


IS_EC2_INSTANCE = -1

def is_ec2_instance():
    """Try fetching instance metadata at 'curl http://169.254.169.254/latest/meta-data/'
    to see if host is on an ec2 instance"""

    # Note: this code assumes that docker containers running on ec2 instances
    # inherit instances metadata, which they do as of 2016-08-25

    global IS_EC2_INSTANCE

    if IS_EC2_INSTANCE != -1:
        # Returned the cached value
        return IS_EC2_INSTANCE

    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.settimeout(0.2)
    try:
        s.connect(("169.254.169.254", 80))
        IS_EC2_INSTANCE = 1
        return True
    except socket.timeout:
        IS_EC2_INSTANCE = 0
        return False
    except socket.error:
        IS_EC2_INSTANCE = 0
        return False

{'fraction_non_alphanumeric': 0.07509881422924901, 'fraction_numerical': 0.051877470355731224, 'mean_word_length': 2.849809885931559, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '893218', 'n_tokens_mistral': 688, 'n_tokens_neox': 631, 'n_words': 195}