CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
63 lines
1.7 KiB
Python
Executable File
63 lines
1.7 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
"""A tool to delete permalinks and traces behind them.
|
|
|
|
To be used by the Perfetto team, who has write access to the GCS bucket.
|
|
"""
|
|
|
|
import json
|
|
import logging
|
|
import re
|
|
import subprocess
|
|
import sys
|
|
|
|
from typing import List
|
|
|
|
GCS_BUCKET = 'perfetto-ui-data'
|
|
GCS_HTTP = 'https://storage.googleapis.com/%s/' % GCS_BUCKET
|
|
|
|
|
|
def delete_gcs_obj(url: str, gcs_delete_list: List[str]):
|
|
if not url.startswith(GCS_HTTP):
|
|
logging.error('The URL %s should start with %s', url, GCS_HTTP)
|
|
return
|
|
gs_url = 'gs://%s/%s' % (GCS_BUCKET, url[len(GCS_HTTP):])
|
|
gcs_delete_list.append(gs_url)
|
|
|
|
|
|
def delete_permalink_uuid(uuid: str, gcs_delete_list: List[str]):
|
|
state_url = GCS_HTTP + uuid
|
|
delete_gcs_obj(state_url, gcs_delete_list)
|
|
state_json = subprocess.check_output(['curl', '-Ls', state_url])
|
|
state = json.loads(state_json)
|
|
trace_url = state['engine']['source']['url']
|
|
delete_gcs_obj(trace_url, gcs_delete_list)
|
|
|
|
|
|
def main():
|
|
gcs_delete_list = []
|
|
if sys.stdin.isatty():
|
|
logging.warn('This tool expects a list of uuids or https://ui.perfetto.dev/#!#?s=deadbeef')
|
|
|
|
for line in sys.stdin.readlines():
|
|
line = line.strip()
|
|
m = re.match(r'.*?\b([a-f0-9]{64})', line)
|
|
if not m:
|
|
logging.error('Could not find a 64 hex UUID from %s', line)
|
|
continue
|
|
uuid = m.group(1)
|
|
delete_permalink_uuid(uuid, gcs_delete_list)
|
|
|
|
if len(gcs_delete_list) == 0:
|
|
logging.info('No object to delete, quitting without taking any action')
|
|
return 0
|
|
|
|
print('Removing the following objects:')
|
|
for gs_uri in gcs_delete_list:
|
|
print(' ', gs_uri)
|
|
subprocess.check_call(['gsutil', '-m', 'rm', '-f', '-a'] + gcs_delete_list)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|