Repository navigation
Conversation
Analysis#start enqueues one InitializeAnalysis per job (e.g. lhs, then batch_run). With more than one analysis_wrappers worker, batch_run could initialize and enqueue RunAnalysis before lhs had made the data points, so the analysis completed with every point never run. A batch_run start now waits until every earlier job of its analysis is completed (timeout ANALYSIS_START_ORDER_TIMEOUT, default 3600 s, then it logs and goes on as before). Plain-Ruby spec for the wait. Claude-Session: https://claude.ai/code/session_01UUVWoXiezqFGv1aXdu6DCT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Analysis#startenqueues oneInitializeAnalysisper job on theanalysis_wrappersqueue — for an LHS analysissubmitted through
openstudio-analysisServerApi#run, firstlhs(creates the data points) and thenbatch_run(runs them). With a single
analysis_wrappersworker the FIFO queue keeps them in order. With more than one workerthey run concurrently:
batch_runcan finish its initialization and enqueueRunAnalysisbeforelhshas createdthe data points, and the analysis then completes with every data point left
na.Observed on a k8s deployment with 4
analysis_wrappersworkers:InitializeAnalysisforlhsandbatch_runof thesame analysis started at the same second;
batch_runfinished first, and the analysis completed with 2,000 of 2,000data points never run.
Why more than one worker: under load a single
lhsinitialization took 8–15 min (vs ~1 min idle), so analysisstarts are serial and become the throughput limit for large sweeps.
Change
ResqueJobs::StartOrder.wait— waits until a condition holds, with a timeout; clock and sleep injectable.InitializeAnalysis.perform— for abatch_run*job, waits until every earlier job of the same analysis(
jobs.where(:index.lt => job.index)) has statuscompleted, then continues as before. AfterANALYSIS_START_ORDER_TIMEOUTseconds (default 3600) it logs a warning and continues (the old behaviour).batch_runstart.Tests
server/spec/jobs/start_order_spec.rb(plain Ruby, no database): returns at once when done, waits until done,gives up after the timeout, applies only to
batch_run*. 4 examples, 0 failures locally.throughput test with 4
analysis_wrappersworkers is planned once an image with this change is deployed.https://claude.ai/code/session_01UUVWoXiezqFGv1aXdu6DCT