Skip to content

IFC-1436 Make work pools configurable #6346

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

Draft
wants to merge 13 commits into
base: develop
Choose a base branch
from
Draft

Conversation

gmazoyer
Copy link
Contributor

This will allow to create and use more work pools than the only one defined so far. Pools now define the type of workflows they are able to process.

There can be more than one workflow type per pool, they can be combined using the or logical operator.

If a workflow type is set in multiple pools, the last pool referencing will take precedence over the other ones. This means that only one work pool can handle a given type of workflows.

@github-actions github-actions bot added the group/backend Issue related to the backend (API Server, Git Agent) label Apr 23, 2025
Copy link

codspeed-hq bot commented Apr 23, 2025

CodSpeed Performance Report

Merging #6346 will not alter performance

Comparing gma-20250422-ifc1436 (b089120) with develop (12481ec)

Summary

✅ 10 untouched benchmarks

default=[
WorkerPoolDefinition(
name="infrahub-worker",
workflow_type=WorkflowType.INTERNAL | WorkflowType.CORE | WorkflowType.USER,
Copy link
Collaborator

Choose a reason for hiding this comment

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

How would the configuration looks like when using environment variables if we want to configure multiple work_pools ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, not sure if having that as part of the configuration will work well .. ideally the worker pools should be pre-defined by the community and the enterprise version

Copy link
Contributor Author

@gmazoyer gmazoyer May 2, 2025

Choose a reason for hiding this comment

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

IIRC Pydantic is able to figure out these complex settings given a valid string representation of them. So in this case, it would be:

INFRAHUB_WORKFLOW_WORK_POOLS='[
  {
    "name": "infrahub-worker",
    "workflow_type": 7,
    "worker_type": "INFRAHUB_ASYNC",
    "description": "Default Pool for internal tasks"
  }
]'

The workflow type is more abstract as it's a int flag, but maybe this could be worked around by a validator for WorkerPoolDefinition.workflow_type.

The idea of making this a setting was it should be easy to change so we could have different values for community and enterprise without involving actual code change.

gmazoyer added 12 commits May 2, 2025 10:26
This will allow to create and use more work pools than the only one
defined so far. Pools now define the type of workflows they are able to
process.

There can be more than one workflow type per pool, they can be combined
using the `or` logical operator.

If a workflow type is set in multiple pools, the last pool referencing
will take precedence over the other ones. This means that only one work
pool can handle a given type of workflows.
@gmazoyer gmazoyer force-pushed the gma-20250422-ifc1436 branch from de26125 to 6d1593d Compare May 2, 2025 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants