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

feat(execution): Exclude execution retrieval for Disabled Front50 pipelines #4819

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

christosarvanitis
Copy link
Member

@christosarvanitis christosarvanitis commented Dec 19, 2024

Adding an opt-in feature to exclude Execution Retrieval for Disabled Front50 pipelines. This can be configured via:

tasks:
   controller:
      excludeExecutionsOfDisabledPipelines: true #(defaults to false) 

When enabled Orca calls the Front50 with a query parameter enabledPipelines=true. Front50 responds only with the enabled pipelines of the application.

This feature aims to ease the load on the execution retrieval for applications that have a lot of pipelines and for historical reasons users dont want to delete the obsolete pipelines that are disabled.

Additionally an agent is implemented to check for unused/unexecuted pipelines per application for the past X days and disable them in Front50. This is only applicable for SQL execution repository and can be configured via:

pollers:
  unused-pipelines-disable:
    enabled: false|true #default value false
    intervalSec: 3600 #default value 3600
    thresholdDays: 365 #default value 365
    dryRun: false|true #default value true

Related Front50 change spinnaker/front50#1520

@christosarvanitis christosarvanitis force-pushed the feat/excludeExecutionForDisabledPipelines branch from 5c86e68 to f849250 Compare December 30, 2024 15:49
@christosarvanitis christosarvanitis force-pushed the feat/excludeExecutionForDisabledPipelines branch from f849250 to 086a55d Compare December 30, 2024 16:19
@christosarvanitis christosarvanitis marked this pull request as ready for review December 30, 2024 16:39
@Component
@ConditionalOnExpression(
"${pollers.unused-pipelines-disable.enabled:false} && ${execution-repository.sql.enabled:false}")
public class UnusedPipelineDisablePollingNotificationAgent
Copy link
Contributor

Choose a reason for hiding this comment

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

javadoc please. What does this class do, and why do we need it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@christosarvanitis christosarvanitis force-pushed the feat/excludeExecutionForDisabledPipelines branch from e5a4857 to 412524c Compare January 3, 2025 11:58
@Nonnull criteria: ExecutionCriteria
): List<String> {
return (
primary.retrievePipelineConfigIdsForApplicationWithCriteria(application, criteria) +
Copy link
Member

Choose a reason for hiding this comment

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

Think his needs a .distinct()...

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch! Done

.filter(p -> !orcaExecutionsPipelineConfigIds.contains(p))
.collect(Collectors.toList());

log.info(
Copy link
Member

Choose a reason for hiding this comment

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

Does this need to be a .info level log?

Copy link
Member Author

Choose a reason for hiding this comment

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

I switched to info only in DryRun mode and on normal operation to debug.

criteria: ExecutionCriteria
): List<String> {
var baseQueryPredicate = field("application").eq(application)
var table = if (jooq.dialect() == SQLDialect.MYSQL) PIPELINE.tableName.forceIndex("pipeline_application_idx")
Copy link
Member

Choose a reason for hiding this comment

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

As a rule, try to avoid force indexes - let the database optimize as needed as if new indexes come online or old ones get removed this would require work here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Following the optimised retrieval from this PR #4804 I can revert to a simple query. What do you think?

@@ -248,7 +248,7 @@ class TaskControllerSpec extends Specification {
pipelineConfigId = config.pipelineConfigId
}
})
front50Service.getPipelines(app, false) >> [[id: "1"], [id: "2"]]
front50Service.getPipelines(app, false, null) >> [[id: "1"], [id: "2"]]
Copy link
Member

Choose a reason for hiding this comment

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

I see null tests, but be nice to verify that it's reading the values & passing them downstream as planned. Not "critical" though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, pushed an updated test that shows every scenario

@christosarvanitis christosarvanitis force-pushed the feat/excludeExecutionForDisabledPipelines branch 2 times, most recently from a838fe7 to 1a280e1 Compare January 17, 2025 12:41
@christosarvanitis christosarvanitis force-pushed the feat/excludeExecutionForDisabledPipelines branch from 1a280e1 to c3e3f22 Compare January 17, 2025 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants