From 1458dbdb1b5aa10c3b59a1de9d5d64a99a44fc2d Mon Sep 17 00:00:00 2001 From: Gyanendra Mishra Date: Mon, 9 Oct 2023 19:42:41 +0100 Subject: [PATCH] fix parallelism set through frontend --- .../server/api_container/server/api_container_service.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/server/api_container/server/api_container_service.go b/core/server/api_container/server/api_container_service.go index 93a588e165..851fcdef04 100644 --- a/core/server/api_container/server/api_container_service.go +++ b/core/server/api_container/server/api_container_service.go @@ -69,6 +69,7 @@ const ( isScript = true isNotScript = false isNotRemote = false + defaultParallelism = 4 ) // Guaranteed (by a unit test) to be a 1:1 mapping between API port protos and port spec protos @@ -112,7 +113,7 @@ func NewApiContainerService( PackageId: startosis_constants.PackageIdPlaceholderForStandaloneScript, SerializedScript: "", SerializedParams: "", - Parallelism: 0, + Parallelism: defaultParallelism, RelativePathToMainFile: startosis_constants.PlaceHolderMainFileForPlaceStandAloneScript, MainFunctionName: "", ExperimentalFeatures: []kurtosis_core_rpc_api_bindings.KurtosisFeatureFlag{}, @@ -128,6 +129,9 @@ func (apicService *ApiContainerService) RunStarlarkScript(args *kurtosis_core_rp serializedStarlarkScript := args.GetSerializedScript() serializedParams := args.GetSerializedParams() parallelism := int(args.GetParallelism()) + if parallelism == 0 { + parallelism = defaultParallelism + } dryRun := shared_utils.GetOrDefaultBool(args.DryRun, defaultStartosisDryRun) mainFuncName := args.GetMainFunctionName() experimentalFeatures := args.GetExperimentalFeatures() @@ -223,6 +227,9 @@ func (apicService *ApiContainerService) InspectFilesArtifactContents(_ context.C func (apicService *ApiContainerService) RunStarlarkPackage(args *kurtosis_core_rpc_api_bindings.RunStarlarkPackageArgs, stream kurtosis_core_rpc_api_bindings.ApiContainerService_RunStarlarkPackageServer) error { packageId := args.GetPackageId() parallelism := int(args.GetParallelism()) + if parallelism == 0 { + parallelism = defaultParallelism + } dryRun := shared_utils.GetOrDefaultBool(args.DryRun, defaultStartosisDryRun) serializedParams := args.GetSerializedParams() relativePathToMainFile := args.GetRelativePathToMainFile()