Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug cache #17377

Merged
merged 23 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Bazel distributed cache, can be temporarily disabled by passing the following
# flag: --noremote_accept_cached
build:darwin --remote_cache=https://bazel-cache.da-ext.net/macos/202308
build:linux --remote_cache=https://bazel-cache.da-ext.net/ubuntu/202308
build:darwin --remote_cache=https://bazel-cache.da-ext.net/202309/macos
build:linux --remote_cache=https://bazel-cache.da-ext.net/202309/ubuntu
# Don't push local build results to the remote cache.
build --remote_upload_local_results=false
# Do still push local build results to the local disk cache.
Expand Down
2 changes: 0 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ bazel build //... `
`-`-experimental_profile_include_target_label `
`-`-build_event_json_file build-events.json `
`-`-build_event_publish_all_actions `
`-`-experimental_execution_log_file ${ARTIFACT_DIRS}/logs/build_execution_windows$env:SYSTEM_JOBATTEMPT.log `
`-`-build_tag_filters=-canton-ee

bazel shutdown
Expand All @@ -83,5 +82,4 @@ if ($env:SKIP_TESTS -ceq "False") {
`-`-experimental_profile_include_target_label `
`-`-build_event_json_file test-events.json `
`-`-build_event_publish_all_actions `
`-`-experimental_execution_log_file ${ARTIFACT_DIRS}/logs/test_execution_windows_$env:SYSTEM_JOBATTEMPT.log `
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The binary execution log is basically useless: as far as I know nobody ever looks at it, and I don't seem to be able to build the parser for it. Trying to get the JSON execution log crashes the build on an OOM.

}
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $bazel build //... \
--experimental_profile_include_target_label \
--build_event_json_file build-events.json \
--build_event_publish_all_actions \
--experimental_execution_log_file "$ARTIFACT_DIRS/logs/build_execution${execution_log_postfix}.log"
--execution_log_json_file "$ARTIFACT_DIRS/logs/build_execution${execution_log_postfix}.json.gz"

# Set up a shared PostgreSQL instance.
export POSTGRESQL_ROOT_DIR="${TMPDIR:-/tmp}/daml/postgresql"
Expand Down Expand Up @@ -90,7 +90,7 @@ $bazel test //... \
--experimental_profile_include_target_label \
--build_event_json_file test-events.json \
--build_event_publish_all_actions \
--experimental_execution_log_file "$ARTIFACT_DIRS/logs/test_execution${execution_log_postfix}.log"
--execution_log_json_file "$ARTIFACT_DIRS/logs/test_execution${execution_log_postfix}.json.gz"

# Make sure that Bazel query works.
$bazel query 'deps(//...)' >/dev/null
Expand Down
15 changes: 1 addition & 14 deletions ci/build-unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ steps:
- bash: |
set -euo pipefail
p="_${{parameters.name}}"
a="_$(System.JobAttempt)"
a="_$(Build.BuildNumber)_$(System.JobAttempt)"
if [ "$p" == "_m1" ]; then
./build.sh $p $a || ./build.sh $p $a || ./build.sh $p $a || ./build.sh $p $a
else
Expand All @@ -74,19 +74,6 @@ steps:
platform: '${{parameters.name}}'
is_release: '${{parameters.is_release}}'

- bash: |
set -euo pipefail
cd '$(Build.StagingDirectory)/logs'
find . -type f | xargs gzip -9
cd -
cd bazel-testlogs
find . -type f | xargs gzip -9

displayName: compress logs
condition: and(succeededOrFailed(),
or(eq(${{parameters.is_release}}, 'false'),
ne('${{parameters.name}}', 'm1')))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON execution logs are created pre-gzipped by Bazel, so there's little benefit to re-gzipping them.

- task: PublishBuildArtifacts@1
condition: and(succeededOrFailed(),
or(eq(${{parameters.is_release}}, 'false'),
Expand Down
11 changes: 0 additions & 11 deletions ci/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,6 @@ steps:
platform: 'windows'
is_release: '${{parameters.is_release}}'

- bash: |
set -euo pipefail
cd '$(Build.StagingDirectory)/logs'
find . -type f | xargs gzip -9
cd -
cd bazel-testlogs
find . -type f | xargs gzip -9

displayName: compress logs
condition: succeededOrFailed()

- task: PublishBuildArtifacts@1
condition: failed()
displayName: 'Publish the bazel test logs'
Expand Down
9 changes: 0 additions & 9 deletions ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,6 @@ jobs:
is_release: variables.is_release
is_split_release: $(is_split_release)
- template: upload-bazel-metrics.yml
- bash: |
set -euo pipefail
cd '$(Build.StagingDirectory)/logs'
gzip -9 *
- task: PublishBuildArtifacts@1
condition: succeededOrFailed()
inputs:
pathtoPublish: '$(Build.StagingDirectory)/logs'
artifactName: 'Bazel Logs'
- template: tell-slack-failed.yml
parameters:
trigger_sha: '$(trigger_sha)'
Expand Down
10 changes: 3 additions & 7 deletions ci/configure-bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ if [ ! -z "${BAZEL_CONFIG_DIR:-}" ]; then
cd "$BAZEL_CONFIG_DIR"
fi

CACHE_URL="https://storage.googleapis.com/daml-bazel-cache"

if is_windows; then
echo "build --config windows" > .bazelrc.local
Expand All @@ -71,12 +70,9 @@ if is_windows; then
# three characters.
echo "Working directory: $PWD"
SUFFIX="$(echo $PWD $RULES_HASKELL_REV | openssl dgst -md5 -r)"
SUFFIX="${SUFFIX:0:12}"
echo "Platform suffix: $SUFFIX"
# We include an extra version at the end that we can bump manually.
CACHE_SUFFIX="$SUFFIX-v14"
CACHE_URL="$CACHE_URL/$CACHE_SUFFIX"
echo "build:windows-ci --remote_cache=https://bazel-cache.da-ext.net/$CACHE_SUFFIX" >> .bazelrc.local
CACHE_URL="https://storage.googleapis.com/daml-bazel-cache/202309/win/${SUFFIX:0:4}"
echo "CACHE_URL=$CACHE_URL"
echo "build:windows-ci --remote_cache=$CACHE_URL" >> .bazelrc.local
fi

# sets up write access to the shared remote cache if the branch is not a fork
Expand Down
4 changes: 2 additions & 2 deletions compatibility/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Bazel distributed cache, can be temporarily disabled by passing the following
# flag: --noremote_accept_cached
build:darwin --remote_cache=https://bazel-cache.da-ext.net/macos/202308
build:linux --remote_cache=https://bazel-cache.da-ext.net/ubuntu/202308
build:darwin --remote_cache=https://bazel-cache.da-ext.net/202309/macos
build:linux --remote_cache=https://bazel-cache.da-ext.net/202309/ubuntu
# Don't push local build results to the remote cache.
build --remote_upload_local_results=false
# Do still push local build results to the local disk cache.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ decodeVersion mbPkgId minorText = do

decodeInternedDottedName :: LF1.InternedDottedName -> Decode ([T.Text], Either String [UnmangledIdentifier])
decodeInternedDottedName (LF1.InternedDottedName ids) = do
(mangled, unmangledOrErr) <- unzip <$> mapM lookupString (V.toList ids)
(mangled, unmangledOrErr) <- mapAndUnzipM lookupString (V.toList ids)
pure (mangled, sequence unmangledOrErr)

-- The package id is optional since we also call this function from decodeScenarioModule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ generateSrcFromLf env = noLoc mod
classReexportMap = MS.fromList $ do
synDef@LF.DefTypeSyn{..} <- NM.toList . LF.moduleSynonyms $ envMod env
Just fields <- [getTypeClassFields synType]
let methods = catMaybes (getClassMethodName . fst <$> fields)
let methods = mapMaybe (getClassMethodName . fst) fields
LF.TypeSynName [name] <- [synName]
Just (pkgId, depDef) <- [envLookupDepClass synName env]
guard (safeToReexport env synDef depDef)
Expand Down
2 changes: 1 addition & 1 deletion daml-assistant/src/DA/Daml/Assistant/Install.hs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ projectInstall env projectPath = do
-- | Determine whether the assistant should be installed.
shouldInstallAssistant :: InstallEnv -> SdkVersion -> Bool
shouldInstallAssistant InstallEnv{..} versionToInstall =
let isNewer = maybe True (< versionToInstall) (unwrapDamlAssistantSdkVersion <$> assistantVersion)
let isNewer = maybe True ((< versionToInstall) . unwrapDamlAssistantSdkVersion) assistantVersion
in unActivateInstall (iActivate options)
|| determineAuto (isNewer || missingAssistant || installingFromOutside)
(unwrapInstallAssistant (iAssistant options))
Expand Down
6 changes: 3 additions & 3 deletions infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ terraform {
}
google = {
source = "hashicorp/google"
version = "4.43.0"
version = "4.46.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = "4.43.0"
version = "4.46.0"
}
azurerm = {
source = "hashicorp/azurerm"
version = "3.31.0"
version = "3.35.0"
}
random = {
source = "hashicorp/random"
Expand Down
3 changes: 2 additions & 1 deletion language-support/ts/codegen/src/TsCodeGenMain.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import Data.Aeson.Encode.Pretty
import Control.Exception
import Control.Lens.MonoTraversal (monoTraverse)
import Control.Lens.Traversal (Traversal')
import Control.Monad
import Control.Monad.Extra
import DA.Daml.LF.Ast
import DA.Daml.LF.Ast.Optics
Expand Down Expand Up @@ -173,7 +174,7 @@ daml2js Daml2jsParams {..} = do
createDirectoryIfMissing True packageSrcDir
-- Write .ts files for the package and harvest references to
-- foreign packages as we do.
(nonEmptyModNames, dependenciesSets) <- unzip <$> mapM (writeModuleTs packageSrcDir scope) (NM.toList (packageModules pkg))
(nonEmptyModNames, dependenciesSets) <- Control.Monad.mapAndUnzipM (writeModuleTs packageSrcDir scope) (NM.toList (packageModules pkg))
writeIndexTs pkgId packageSrcDir (catMaybes nonEmptyModNames)
let dependencies = Set.toList (Set.unions dependenciesSets)
-- Now write package metadata.
Expand Down
4 changes: 2 additions & 2 deletions nix/nixpkgs/default.src.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3a86856a13c88c8c64ea32082a851fefc79aa700",
"sha256": "04dd4g24061p8sw922zjickahqwn3wa9l3j5qllfzp5n6dy9is16"
"rev": "9a82a9b5248919805a2400266ebd881d5783df2a",
"sha256": "142x1zq3cjadgmvfv0paydlq268pfinllqpq2vl0vxwdiq2nr9iz"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the heart of this change: it looks like Bazel 5.2.0 is simply broken, so I'm bumping to 5.3.2.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}