submit_awcy.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env python
  2. from __future__ import print_function
  3. import requests
  4. import argparse
  5. import os
  6. import subprocess
  7. import sys
  8. if 'DAALA_ROOT' not in os.environ:
  9. print("Please specify the DAALA_ROOT environment variable to use this tool.")
  10. sys.exit(1)
  11. key = None
  12. with open('secret_key','r') as keyfile:
  13. key = keyfile.read().strip()
  14. if key is None:
  15. print("Could not open secret_key")
  16. sys.exit(1)
  17. daala_root = os.environ['DAALA_ROOT']
  18. os.chdir(daala_root)
  19. branch = subprocess.check_output('git symbolic-ref -q --short HEAD',shell=True).strip()
  20. parser = argparse.ArgumentParser(description='Submit test to arewecompressedyet.com')
  21. parser.add_argument('-prefix',default=branch)
  22. args = parser.parse_args()
  23. commit = subprocess.check_output('git rev-parse HEAD',shell=True).strip()
  24. short = subprocess.check_output('git rev-parse --short HEAD',shell=True).strip()
  25. date = subprocess.check_output(['git','show','-s','--format=%ci',commit]).strip()
  26. date_short = date.split()[0]
  27. user = args.prefix
  28. run_id = user+'-'+date_short+'-'+short
  29. print('Creating run '+run_id)
  30. r = requests.post("https://arewecompressedyet.com/submit/job", {'run_id': run_id, 'commit': commit, 'key': key})
  31. print(r)