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: include an optional list of tags when deploying a compute graph #1083

Merged
merged 15 commits into from
Dec 6, 2024

Conversation

miguelhrocha
Copy link
Collaborator

@miguelhrocha miguelhrocha commented Dec 5, 2024

Context

This PR comes from a need for a visual aid to understand which compute graph is being currently deployed on Indexify.

This can be considered a short-term solution, as there is no constraint on creating graphs with the same tags collection. However, this can enable CI/CD to automatically generate tags based on commit SHAs.

What

Adds an optional list of tags which are displayed on the Indexify UI.

Bonus

Sorts the invocations of a compute graph by creation date because that was driving me crazy.

Contribution Checklist

  • If the python-sdk was changed, please run make fmt in python-sdk/.
  • If the server was changed, please run make fmt in server/.
  • Make sure all PR Checks are passing.

@miguelhrocha miguelhrocha added ci_compat_test Trigger testing previous SDK versions against the current server and removed ci_compat_test Trigger testing previous SDK versions against the current server labels Dec 5, 2024
@@ -345,6 +345,7 @@ pub struct ComputeGraph {
pub name: String,
pub description: String,
pub version: GraphVersion, // Version incremented with code update
pub tags: Vec<String>,
Copy link
Member

Choose a reason for hiding this comment

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

Can you check the behavior when there are no tags in storage?

I believe this will need #[serde(default)]

Copy link
Member

Choose a reason for hiding this comment

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

We want all existing graphs to default to an empty Vec without erroring out.

Copy link
Member

@seriousben seriousben left a comment

Choose a reason for hiding this comment

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

Please make sure:

  1. An older python-sdk can create and update graphs (it won't know about tags)
  2. Graphs existing on an older server can be fetched with a default of no tags

This is to make sure we don't require wiping storage or force everyone to upgrade their SDK version on deploy.

):
self.name = name
self.description = description
self.nodes: Dict[str, Union[IndexifyFunction, IndexifyRouter]] = {}
self.routers: Dict[str, List[str]] = defaultdict(list)
self.edges: Dict[str, List[str]] = defaultdict(list)
self.accumulator_zero_values: Dict[str, Any] = {}
self.tags = tags or []
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we rename these to user tags or deployment tags?

Copy link
Member

Choose a reason for hiding this comment

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

Can you describe why it would be preferable?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would like it to be very obvious what tags here is to avoid any confusion. Making the naming as obvious as possible helps.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe adding comments would help with removing any confusion.

Copy link
Collaborator

Choose a reason for hiding this comment

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

May I suggest creating a Dictionary, K -> V for these things? Name - Tags, Metadata or Labels are all fine.

):
self.name = name
self.description = description
self.nodes: Dict[str, Union[IndexifyFunction, IndexifyRouter]] = {}
self.routers: Dict[str, List[str]] = defaultdict(list)
self.edges: Dict[str, List[str]] = defaultdict(list)
self.accumulator_zero_values: Dict[str, Any] = {}
self.tags = tags or []
Copy link
Collaborator

Choose a reason for hiding this comment

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

May I suggest creating a Dictionary, K -> V for these things? Name - Tags, Metadata or Labels are all fine.

@miguelhrocha miguelhrocha requested a review from diptanu December 6, 2024 17:23
@miguelhrocha miguelhrocha added the ci_compat_test Trigger testing previous SDK versions against the current server label Dec 6, 2024
…ensorlakeai/indexify into miguelhrocha/add-tags-to-compute-graph
@miguelhrocha miguelhrocha merged commit 855b4c9 into main Dec 6, 2024
6 checks passed
@miguelhrocha miguelhrocha deleted the miguelhrocha/add-tags-to-compute-graph branch December 6, 2024 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci_compat_test Trigger testing previous SDK versions against the current server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants