Repository navigation
Conversation
…ows (apache#9304) The unfinished-details collectors of collectJobs and collectWorkflows selected every workflow in a non-terminal status. A workflow whose approval job is never approved stays on_hold forever, so it was collected again on every run and the raw tables kept growing. Select only workflows created within the last 30 days.
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.
Summary
The "unfinished details" step of
collectJobsandcollectWorkflowsselected every workflow in a non-terminal status, without an age limit. A workflow with an approval job that nobody approves stayson_holdfor ever, so DevLake collected it again on every run. Because the step appends to the raw tables,_raw_circleci_api_jobsgrew on every run.This PR selects only workflows created in the last 30 days:
UnfinishedJobsInputClausesjoins_tool_circleci_workflowsand filters on the workflowcreated_date. Jobs have no created date of their own (created_dateis empty for allon_holdjobs in our instance).UnfinishedWorkflowsInputClausesapplies the same filter to the workflow collector.UnfinishedDetailsLookback(30 days). The date is computed in Go, so the query works on MySQL and PostgreSQL.A workflow that gets its approval within 30 days is still collected again, so its deploy jobs after the approval are not lost. In our instance, all approvals except 1 of about 1,860 came within 30 days.
Tests
TestCircleciUnfinishedJobsInputIterator(updated) andTestCircleciUnfinishedWorkflowsInputIterator(new) seed a workflow older than 30 days and check that it is not selected. Both tests pass on MySQL 8 and PostgreSQL 14, and fail without the change.Result on real data (one instance, 2 CircleCI projects, same query as the collectors):
collectJobsunfinished details_raw_circleci_api_jobsper runcollectWorkflowsunfinished detailsDoes this close any open issues?
Closes #9304
Other Information