Skip to content

Commit

Permalink
SPMI: Optimize collection download, increase diffs timeout (#91637)
Browse files Browse the repository at this point in the history
With the latest collections we are frequently hitting timeouts during
linux asmdiffs runs. This PR applies two changes to improve the
situation:
- Optimize the download/extraction of collections by extracting directly
  to the target location. The Helix machines actually seem to spend many
  times longer to extract and copy the collections than they do
  downloading them.
- Increase the timeout of superpmi-diffs by one hour.
  • Loading branch information
jakobbotsch authored Sep 6, 2023
1 parent 04bd438 commit a60aab1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
4 changes: 2 additions & 2 deletions eng/pipelines/coreclr/templates/run-superpmi-diffs-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ parameters:
osSubgroup: '' # optional -- operating system subgroup
continueOnError: 'false' # optional -- determines whether to continue the build if the step errors
dependsOn: '' # optional -- dependencies of the job
timeoutInMinutes: 120 # optional -- timeout for the job
timeoutInMinutes: 180 # optional -- timeout for the job
enableTelemetry: false # optional -- enable for telemetry
liveLibrariesBuildConfig: '' # optional -- live-live libraries configuration to use for the run
helixQueues: '' # required -- Helix queues
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
helixType: 'build/tests/'
helixQueues: ${{ join(',', parameters.helixQueues) }}
creator: dotnet-bot
WorkItemTimeout: 2:00 # 2 hours
WorkItemTimeout: 3:00 # 3 hours
WorkItemDirectory: '$(WorkItemDirectory)'
CorrelationPayloadDirectory: '$(CorrelationPayloadDirectory)'
helixProjectArguments: '$(Build.SourcesDirectory)/src/coreclr/scripts/superpmi-diffs.proj'
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/coreclr/templates/superpmi-diffs-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ parameters:
osSubgroup: '' # optional -- operating system subgroup
condition: true
pool: ''
timeoutInMinutes: 180 # build timeout
timeoutInMinutes: 240 # build timeout
variables: {}
helixQueues: ''
dependOnEvaluatePaths: false
Expand Down
32 changes: 15 additions & 17 deletions src/coreclr/scripts/jitutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,25 +756,23 @@ def download_files(paths, target_dir, verbose=True, fail_if_not_found=True, is_a
logging.info("Uncompress %s", download_path)

if item_path.lower().endswith(".zip"):
with zipfile.ZipFile(download_path, "r") as file_handle:
file_handle.extractall(temp_location)
with zipfile.ZipFile(download_path, "r") as zip:
zip.extractall(target_dir)
archive_names = zip.namelist()
else:
with tarfile.open(download_path, "r") as file_handle:
file_handle.extractall(temp_location)

# Copy everything that was extracted to the target directory.
copy_directory(temp_location, target_dir, verbose_copy=verbose,
match_func=lambda path: not path.endswith(".zip") and not path.endswith(".tar.gz"))

# The caller wants to know where all the files ended up, so compute that.
for dirpath, _, files in os.walk(temp_location, topdown=True):
for file_name in files:
if not file_name.endswith(".zip") and not file_name.endswith(".tar.gz"):
full_file_path = os.path.join(dirpath, file_name)
target_path = full_file_path.replace(temp_location, target_dir)
local_paths.append(target_path)
with tarfile.open(download_path, "r") as tar:
tar.extractall(target_dir)
archive_names = tar.getnames()

for archive_name in archive_names:
if archive_name.endswith("/"):
# Directory
continue

target_path = os.path.join(target_dir, archive_name.replace("/", os.path.sep))
local_paths.append(target_path)
else:
# Not a zip file; download directory to target directory
# Not an archive
download_path = os.path.join(target_dir, item_name)
if is_item_url:
ok = download_one_url(item_path, download_path, fail_if_not_found=fail_if_not_found, is_azure_storage=is_azure_storage, display_progress=display_progress)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/scripts/superpmi-diffs.proj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

<PropertyGroup>
<WorkItemCommand>$(Python) $(ProductDirectory)/superpmi_diffs.py -type $(SuperPmiDiffType) -base_jit_directory $(ProductDirectory)/base -diff_jit_directory $(ProductDirectory)/diff $(SuperPmiBaseJitOptionsArg) $(SuperPmiDiffJitOptionsArg) -log_directory $(SuperpmiLogsLocation)</WorkItemCommand>
<WorkItemTimeout>2:00</WorkItemTimeout>
<WorkItemTimeout>3:00</WorkItemTimeout>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit a60aab1

Please sign in to comment.