<commit_before>#! /usr/bin/python

from __future__ import division
from __future__ import print_function

import argparse
import time

from build import Build
from list_builds import list_daily_builds
from get_build import ensure_build_file

from constants import (
  android_device_id,
  datetime_format,
  seconds_between_polls,
)


def test_build(build):
  build_file = ensure_build_file(build)
  deploy_build(build_file, android_device_id)
  results_file = run_benchmarks(build)
  upload_results(results_file)

def get_command_line_args():
  now = time.strftime(datetime_format)
  parser = argparse.ArgumentParser()
  parser.add_argument('--from-datetime', type=str, default='', help='The earliest datetime for pulling Android builds. Defaults to now: %s' % now)
  args = parser.parse_args()
  if not args.from_datetime:
    args.from_datetime = now
  return args

def main():
  args = get_command_line_args()
  last_tested_datetime = args.from_datetime
  while True:
    next_poll_time = time.time() + seconds_between_polls
    untested_builds = [build for build in list_daily_builds() if build.datetime > last_tested_datetime]
    count = 0
    for build in untested_builds:
      count += 1
      print('Testing build %s of %s:\n%s' % (count, len(untested_builds), build))
      test_build(build)
    sleep_seconds = int(next_poll_time - time.time())
    if sleep_seconds > 0:
      print('Sleeping for %s seconds (%s minutes)' % (sleep_seconds, sleep_seconds / 60))
      time.sleep(sleep_seconds)

if __name__ == '__main__':
  main()<commit_msg>Add chromium src parameter<commit_after>#! /usr/bin/python

from __future__ import division
from __future__ import print_function

import argparse
import time

from build import Build
from list_builds import list_daily_builds
from get_build import ensure_build_file

from constants import (
  android_device_id,
  datetime_format,
  seconds_between_polls,
)


def test_build(build, chromium_src):
  build_file = ensure_build_file(build)
  deploy_build(build_file, android_device_id)
  results_file = run_benchmarks(chromium_src, build)
  upload_results(chromium_src, results_file)

def get_command_line_args():
  now = time.strftime(datetime_format)
  parser = argparse.ArgumentParser()
  parser.add_argument('--from-datetime', type=str, help='The earliest datetime for pulling Android builds. Defaults to now: %s' % now)
  parser.add_argument('--chromium-src', type=str, help='The path to the Chromium src directory.')
  args = parser.parse_args()
  if not args.from_datetime:
    args.from_datetime = now
  if not args.chromium_src:
    print('--chromium-src missing')
    parser.print_help()
    sys.exit(1)
  return args

def main():
  args = get_command_line_args()
  last_tested_datetime = args.from_datetime
  while True:
    next_poll_time = time.time() + seconds_between_polls
    untested_builds = [build for build in list_daily_builds() if build.datetime > last_tested_datetime]
    for i, build in enumerate(untested_builds):
      print('Testing build %s of %s:\n%s' % (i + 1, len(untested_builds), build))
      test_build(build, chromium_src)
    sleep_seconds = int(next_poll_time - time.time())
    if sleep_seconds > 0:
      print('Sleeping for %s seconds (%s minutes)' % (sleep_seconds, sleep_seconds / 60))
      time.sleep(sleep_seconds)

if __name__ == '__main__':
  main()
{'fraction_non_alphanumeric': 0.09462686567164179, 'fraction_numerical': 0.0029850746268656717, 'mean_word_length': 4.747855917667239, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1483649', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1072, 'n_words': 275}