<commit_before>#!/usr/bin/python
import os
credentials_file = os.path.join(os.path.dirname(__file__), "credentials.oracle")
if os.path.isfile(credentials_file):
    import database
    db = database.weather_database()
    db.upload()
else:
    print "credentials file not found"<commit_msg>add code to prevent concurrency<commit_after>#!/usr/bin/python
import os, fcntl
credentials_file = os.path.join(os.path.dirname(__file__), "credentials.oracle")
if os.path.isfile(credentials_file):
    lock_file = "/var/lock/oracle.lock"
    f = open(lock_file, 'w')
    try:
        fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
        print "no other uploads in progress, proceeding..."
        import database
        db = database.weather_database()
        db.upload()
    except IOError:
        print "another upload is running exiting now"
    finally:
        f.close()
        os.remove(lock_file)
else:
    print "credentials file not found"
{'fraction_non_alphanumeric': 0.11664899257688228, 'fraction_numerical': 0.0, 'mean_word_length': 3.3502304147465436, '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': '5482311', 'n_tokens_mistral': 314, 'n_tokens_neox': 303, 'n_words': 70}