Skip to content

Commit

Permalink
Merge branch 'wip/gmt/12291-benchmark-setup-teardown' into 12291-benc…
Browse files Browse the repository at this point in the history
…h-new
  • Loading branch information
GregoryTravis committed Mar 6, 2025
2 parents 21b04bc + a2f2f87 commit a0b51ce
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 52 deletions.
17 changes: 9 additions & 8 deletions app/gui/src/dashboard/providers/SessionProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ export default function SessionProvider(props: SessionProviderProps) {
const queryClient = reactQuery.useQueryClient()
const toastAndLog = useToastAndLog()

const sessionQuery = createSessionQuery(authService)
const sessionQueryOptions = createSessionQuery(authService)

const session = reactQuery.useSuspenseQuery(sessionQuery)
const session = reactQuery.useSuspenseQuery(sessionQueryOptions)

const refreshUserSessionMutation = reactQuery.useMutation({
mutationKey: ['refreshUserSession', { expireAt: session.data?.expireAt }],
Expand All @@ -126,12 +126,12 @@ export default function SessionProvider(props: SessionProviderProps) {
if (data) {
httpClient?.setSessionToken(data.accessToken)
}
return queryClient.invalidateQueries({ queryKey: sessionQuery.queryKey })
return queryClient.invalidateQueries({ queryKey: sessionQueryOptions.queryKey })
},
onError: (error) => {
// Something went wrong with the refresh token, so we need to sign the user out.
toastAndLog('sessionExpiredError', error)
queryClient.setQueryData(sessionQuery.queryKey, null)
queryClient.setQueryData(sessionQueryOptions.queryKey, null)
return logoutMutation.mutateAsync()
},
})
Expand Down Expand Up @@ -162,6 +162,7 @@ export default function SessionProvider(props: SessionProviderProps) {
void queryClient.clearWithPersister()
},
onError: () => toast.error(getText('signOutError')),
meta: { invalidates: [sessionQueryOptions.queryKey], awaitInvalidates: true },
})

const signUp = useEventCallback(
Expand Down Expand Up @@ -209,7 +210,7 @@ export default function SessionProvider(props: SessionProviderProps) {
}

return queryClient
.invalidateQueries({ queryKey: sessionQuery.queryKey })
.invalidateQueries({ queryKey: sessionQueryOptions.queryKey })
.then(() => ({ challenge, user }) as const)
} else {
throw new Error(result.val.message)
Expand Down Expand Up @@ -282,7 +283,7 @@ export default function SessionProvider(props: SessionProviderProps) {
switch (event) {
case listen.AuthEvent.signIn:
case listen.AuthEvent.signOut: {
void queryClient.invalidateQueries({ queryKey: sessionQuery.queryKey })
void queryClient.invalidateQueries({ queryKey: sessionQueryOptions.queryKey })
break
}
case listen.AuthEvent.customOAuthState:
Expand All @@ -293,15 +294,15 @@ export default function SessionProvider(props: SessionProviderProps) {
// will not work.
// See https://github.com/aws-amplify/amplify-js/issues/3391#issuecomment-756473970
history.replaceState({}, '', mainPageUrl)
void queryClient.invalidateQueries({ queryKey: sessionQuery.queryKey })
void queryClient.invalidateQueries({ queryKey: sessionQueryOptions.queryKey })
break
}
default: {
throw new errorModule.UnreachableCaseError(event)
}
}
}),
[registerAuthEventListener, mainPageUrl, queryClient, sessionQuery.queryKey],
[registerAuthEventListener, mainPageUrl, queryClient, sessionQueryOptions.queryKey],
)

const organizationId = useEventCallback(() => authService.organizationId())
Expand Down
51 changes: 10 additions & 41 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ lazy val enso = (project in file("."))
`language-server-deps-wrapper`,
launcher,
`library-manager`,
`library-manager-test`,
`locking-test-helper`,
`logging-config`,
`logging-service`,
Expand Down Expand Up @@ -2499,7 +2498,7 @@ lazy val `language-server` = (project in file("engine/language-server"))
.dependsOn(filewatcher)
.dependsOn(testkit % Test)
.dependsOn(`logging-service-logback` % "test->test")
.dependsOn(`library-manager-test` % Test)
.dependsOn(`library-manager` % "test->test")
.dependsOn(`runtime-version-manager-test` % Test)
.dependsOn(`ydoc-polyfill`)

Expand Down Expand Up @@ -4478,7 +4477,7 @@ lazy val `edition-updater` = project
.dependsOn(editions)
.dependsOn(downloader)
.dependsOn(`distribution-manager`)
.dependsOn(`library-manager-test` % Test)
.dependsOn(`library-manager` % "test->test")

lazy val `edition-uploader` = project
.in(file("lib/scala/edition-uploader"))
Expand Down Expand Up @@ -4518,50 +4517,20 @@ lazy val `library-manager` = project
(`logging-utils` / Compile / exportedModule).value,
(`scala-libs-wrapper` / Compile / exportedModule).value,
(`scala-yaml` / Compile / exportedModule).value
)
),
commands += WithDebugCommand.withDebug,
Test / javaOptions ++= testLogProviderOptions,
Test / test := (Test / test).tag(simpleLibraryServerTag).value,
Test / fork := true
)
.dependsOn(`version-output`) // Note [Default Editions]
.dependsOn(editions)
.dependsOn(cli)
.dependsOn(`distribution-manager`)
.dependsOn(downloader)
.dependsOn(testkit % Test)

lazy val `library-manager-test` = project
.in(file("lib/scala/library-manager-test"))
.enablePlugins(JPMSPlugin)
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
scalaModuleDependencySetting,
compileOrder := CompileOrder.ScalaThenJava,
Test / fork := true,
commands += WithDebugCommand.withDebug,
Test / javaOptions ++= testLogProviderOptions,
Test / test := (Test / test).tag(simpleLibraryServerTag).value,
libraryDependencies ++= Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
),
Compile / internalModuleDependencies := Seq(
(`library-manager` / Compile / exportedModule).value,
(`cli` / Compile / exportedModule).value,
(`distribution-manager` / Compile / exportedModule).value,
(`library-manager` / Compile / exportedModule).value,
(`process-utils` / Compile / exportedModule).value,
(`pkg` / Compile / exportedModule).value,
(`semver` / Compile / exportedModule).value,
(`downloader` / Compile / exportedModule).value,
(`editions` / Compile / exportedModule).value,
(`version-output` / Compile / exportedModule).value,
(`testkit` / Compile / exportedModule).value
)
)
.dependsOn(`library-manager`)
.dependsOn(`process-utils`)
.dependsOn(`logging-utils`)
.dependsOn(testkit)
.dependsOn(`logging-service-logback` % Test)
.dependsOn(testkit % "test->test")
.dependsOn(`process-utils` % "test->compile")
.dependsOn(`logging-service-logback` % "test->test")

lazy val `connected-lock-manager` = project
.in(file("lib/scala/connected-lock-manager"))
Expand Down
1 change: 1 addition & 0 deletions build_tools/build/src/enso.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ impl BuiltEnso {
cloud_tests::env::test_controls::ENSO_RUN_REAL_CLOUD_TEST.name().to_string(),
"1".to_string(),
));
environment_overrides.push(("ENSO_LAUNCHER".to_string(), "native".to_string()));
};

let futures = std_tests.into_iter().map(|test_path| {
Expand Down
4 changes: 2 additions & 2 deletions distribution/lib/Standard/Test/0.0.0-dev/docs/api/Bench.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- type Bench
- All groups:(Standard.Base.Data.Vector.Vector Standard.Test.Bench.Bench)
- Group name:Standard.Base.Data.Text.Text configuration:Standard.Test.Bench.Bench_Options specs:(Standard.Base.Data.Vector.Vector Standard.Test.Bench.Bench)
- Spec name:Standard.Base.Data.Text.Text code:Standard.Base.Any.Any
- Spec name:Standard.Base.Data.Text.Text code:Standard.Base.Any.Any setup:(Standard.Base.Any.Any|Standard.Base.Nothing.Nothing) teardown:(Standard.Base.Any.Any|Standard.Base.Nothing.Nothing)
- build fn:Standard.Base.Any.Any -> Standard.Base.Any.Any
- estimated_runtime self -> Standard.Base.Any.Any
- fold self value:Standard.Base.Any.Any fn:Standard.Base.Any.Any -> Standard.Base.Any.Any
Expand All @@ -27,7 +27,7 @@
- validate self -> Standard.Base.Any.Any
- type Group_Builder
- Impl name:Standard.Base.Any.Any builder:Standard.Base.Any.Any
- specify self name:Standard.Base.Data.Text.Text ~benchmark:Standard.Base.Any.Any -> Standard.Base.Any.Any
- specify self name:Standard.Base.Data.Text.Text ~benchmark:Standard.Base.Any.Any ~setup:Standard.Base.Any.Any= ~teardown:Standard.Base.Any.Any= -> Standard.Base.Any.Any
- type Phase_Conf
- Impl iterations:Standard.Base.Data.Numbers.Integer seconds:Standard.Base.Data.Numbers.Integer
- to_text self -> Standard.Base.Any.Any
Expand Down
2 changes: 1 addition & 1 deletion test/Benchmarks/src/Main.enso
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ main filter=Nothing =
vec = specs.map filter_benchmarks . filter no_nothing
if vec.is_empty then Nothing else
Bench.Group n opts vec
Bench.Spec n _ ->
Bench.Spec n _ _ _ ->
if is_matching n then b else Nothing

all_benchmarks.map filter_benchmarks . filter no_nothing
Expand Down
2 changes: 2 additions & 0 deletions tools/ci/docker/engine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ARG PRINT_VERSION=0
ARG JAVA_OPTS="-XX:MaxRAMPercentage=90.0 -XX:InitialRAMPercentage=90.0"
ARG PROFILING_FILENAME
ARG PROFILING_TIME
ARG ENSO_LAUNCHER

RUN useradd -u 2000 -c 'Enso Developer' -U -m ensodev

Expand Down Expand Up @@ -65,6 +66,7 @@ ENV YDOC_PORT=${YDOC_PORT}
ENV LOG_LEVEL=${LOG_LEVEL}
ENV PRINT_VERSION=${PRINT_VERSION}
ENV JAVA_OPTS=${JAVA_OPTS}
ENV ENSO_LAUNCHER=${ENSO_LAUNCHER}

EXPOSE ${RPC_PORT}
EXPOSE ${DATA_PORT}
Expand Down

0 comments on commit a0b51ce

Please sign in to comment.