openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.3 KiB

5 years ago
#!/usr/bin/env python3
import tempfile
import shutil
import subprocess
from common.basedir import BASEDIR
5 years ago
from azure.storage.blob import BlockBlobService
from selfdrive.test.test_car_models import routes as test_car_models_routes, non_public_routes
from selfdrive.test.process_replay.test_processes import segments as replay_segments
from xx.chffr.lib import azureutil
from xx.chffr.lib.storage import upload_dir_serial, download_dir_tpe
5 years ago
from xx.chffr.lib.storage import _DATA_ACCOUNT_PRODUCTION, _DATA_ACCOUNT_CI, _DATA_BUCKET_PRODUCTION, _DATA_BUCKET_CI
SOURCES = [
(_DATA_ACCOUNT_PRODUCTION, _DATA_BUCKET_PRODUCTION),
(_DATA_ACCOUNT_PRODUCTION, "preserve"),
]
DEST_KEY = azureutil.get_user_token(_DATA_ACCOUNT_CI, "openpilotci")
SOURCE_KEYS = [azureutil.get_user_token(account, bucket) for account, bucket in SOURCES]
SERVICE = BlockBlobService(_DATA_ACCOUNT_CI, sas_token=DEST_KEY)
5 years ago
def sync_to_ci_public(route):
print(f"Uploading {route}")
5 years ago
key_prefix = route.replace('|', '/')
if next(azureutil.list_all_blobs(SERVICE, "openpilotci", prefix=key_prefix), None) is not None:
print("Already synced")
return True
for (source_account, source_bucket), source_key in zip(SOURCES, SOURCE_KEYS):
print(f"Trying {source_account}/{source_bucket}")
cmd = [
f"{BASEDIR}/external/bin/azcopy",
"copy",
"https://{}.blob.core.windows.net/{}/{}?{}".format(source_account, source_bucket, key_prefix, source_key),
"https://{}.blob.core.windows.net/{}?{}".format(_DATA_ACCOUNT_CI, "openpilotci", DEST_KEY),
"--recursive=true",
"--overwrite=false",
]
try:
result = subprocess.call(cmd, stdout=subprocess.DEVNULL)
if result == 0:
print("Success")
return True
except subprocess.CalledProcessError:
print("Failed")
5 years ago
return False
5 years ago
if __name__ == "__main__":
failed_routes = []
5 years ago
# sync process replay routes
for s in replay_segments:
route_name, _ = s.rsplit('--', 1)
if not sync_to_ci_public(route_name):
failed_routes.append(route_name)
5 years ago
# sync test_car_models routes
for r in list(test_car_models_routes.keys()):
if r not in non_public_routes:
if not sync_to_ci_public(r):
failed_routes.append(r)
5 years ago
if len(failed_routes):
print("failed routes:")
print(failed_routes)