Skip to content

Commit

Permalink
Add code I forgot to push to #4422 (#4426)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmetzman authored Nov 22, 2024
1 parent 0a41390 commit 9dfcae6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/clusterfuzz/_internal/fuzzing/corpus_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,12 +659,11 @@ def get_proto_corpus(bucket_name,
urls = (f'{storage.GS_PREFIX}/{bucket_name}/{url}'
for url in storage.list_blobs(gcs_url))

if max_download_urls is not None:
urls = itertools.islice(urls, max_download_urls)
# TODO(metzman): Stop limiting URLs when pruning works on oss-fuzz
# again.
corpus_urls = dict(
storage.sign_urls_for_existing_files(urls, include_delete_urls))
if max_download_urls is not None:
urls = itertools.islice(urls, max_download_urls)
corpus_urls = dict(storage.sign_urls_for_existing_files(urls, include_delete_urls))

upload_urls = storage.get_arbitrary_signed_upload_urls(
gcs_url, num_uploads=max_upload_urls)
Expand Down
6 changes: 3 additions & 3 deletions src/clusterfuzz/_internal/google_cloud_utils/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1341,9 +1341,9 @@ def delete_signed_urls(urls):


def _sign_urls_for_existing_file(
corpus_element_url: str,
include_delete_urls: bool,
url_and_include_delete_urls: Tuple[str, bool],
minutes: int = SIGNED_URL_EXPIRATION_MINUTES) -> Tuple[str, str]:
corpus_element_url, include_delete_urls = url_and_include_delete_urls
download_url = get_signed_download_url(corpus_element_url, minutes)
if include_delete_urls:
delete_url = sign_delete_url(corpus_element_url, minutes)
Expand All @@ -1362,7 +1362,7 @@ def sign_urls_for_existing_files(urls,
logs.info('Signing URLs for existing files.')
args = ((url, include_delete_urls) for url in urls)
with concurrency.make_pool(cpu_bound=True, max_pool_size=2) as pool:
result = pool.map(_mappable_sign_urls_for_existing_file, args)
result = pool.map(_sign_urls_for_existing_file, args)
logs.info('Done signing URLs for existing files.')
return result

Expand Down

0 comments on commit 9dfcae6

Please sign in to comment.