-
Notifications
You must be signed in to change notification settings - Fork 902
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: Add indices migration #942
Conversation
also - it needs two colons, |
9c7278c
to
f662a76
Compare
agents-api/agents_api/models/execution/create_execution_transition.py
Outdated
Show resolved
Hide resolved
also these (and we have to be mindful of the order of fields):
|
fe0a6ae
to
2f88b8c
Compare
# Make sure the current/next targets are valid | ||
match data.type: | ||
case "finish_branch": | ||
pass # TODO: Implement | ||
case "finish" | "error" | "cancelled": | ||
pass | ||
|
||
last_transition_type[min_cost(type_created_at)] := | ||
*transitions {{ | ||
execution_id: to_uuid("{str(execution_id)}"), | ||
type, | ||
created_at, | ||
}}, | ||
type_created_at = [type, -created_at] | ||
### FIXME: HACK: Fix this and uncomment | ||
|
||
matched[collect(last_type)] := | ||
last_transition_type[data], | ||
last_type_data = first(data), | ||
last_type = if(is_null(last_type_data), "init", last_type_data), | ||
valid_transition[last_type, $next_type] | ||
### assert ( | ||
### data.next is None | ||
### ), "Next target must be None for finish/finish_branch/error/cancelled" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Make sure the current/next targets are valid | |
match data.type: | |
case "finish_branch": | |
pass # TODO: Implement | |
case "finish" | "error" | "cancelled": | |
pass | |
last_transition_type[min_cost(type_created_at)] := | |
*transitions {{ | |
execution_id: to_uuid("{str(execution_id)}"), | |
type, | |
created_at, | |
}}, | |
type_created_at = [type, -created_at] | |
### FIXME: HACK: Fix this and uncomment | |
matched[collect(last_type)] := | |
last_transition_type[data], | |
last_type_data = first(data), | |
last_type = if(is_null(last_type_data), "init", last_type_data), | |
valid_transition[last_type, $next_type] | |
### assert ( | |
### data.next is None | |
### ), "Next target must be None for finish/finish_branch/error/cancelled" | |
"""Validates the transition targets based on the transition type. | |
Args: | |
data (CreateTransitionRequest): The transition request data to validate. | |
Raises: | |
ValueError: If the transition type is invalid. | |
AssertionError: If the transition targets are not valid for the given type. | |
""" | |
match data.type: | |
case "finish_branch": | |
pass # TODO: Implement | |
case "finish" | "error" | "cancelled": | |
assert ( | |
data.next is None | |
), "Next target must be None for finish/finish_branch/error/cancelled" |
add docstring to validate_transition_targets function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Reviewed everything up to 2f88b8c in 36 seconds
More details
- Looked at
538
lines of code in13
files - Skipped
0
files when reviewing. - Skipped posting
7
drafted comments based on config settings.
1. agents-api/agents_api/models/docs/search_docs_by_embedding.py:91
- Draft comment:
The PR lacks a description, which makes it difficult to understand the full context and intent of the changes. Please provide a description for better clarity. - Reason this comment was not posted:
Confidence changes required:50%
The PR introduces new indices in the database queries, which is a good practice for performance optimization. However, the PR description is missing, which makes it difficult to understand the full context and intent of the changes. The code changes seem consistent with the migration script, but without a description, it's hard to verify if all necessary changes are included.
2. agents-api/agents_api/models/docs/search_docs_by_text.py:90
- Draft comment:
The PR lacks a description, which makes it difficult to understand the full context and intent of the changes. Please provide a description for better clarity. - Reason this comment was not posted:
Confidence changes required:50%
The PR introduces new indices in the database queries, which is a good practice for performance optimization. However, the PR description is missing, which makes it difficult to understand the full context and intent of the changes. The code changes seem consistent with the migration script, but without a description, it's hard to verify if all necessary changes are included.
3. agents-api/agents_api/models/execution/count_executions.py:42
- Draft comment:
The PR lacks a description, which makes it difficult to understand the full context and intent of the changes. Please provide a description for better clarity. - Reason this comment was not posted:
Confidence changes required:50%
The PR introduces new indices in the database queries, which is a good practice for performance optimization. However, the PR description is missing, which makes it difficult to understand the full context and intent of the changes. The code changes seem consistent with the migration script, but without a description, it's hard to verify if all necessary changes are included.
4. agents-api/agents_api/models/execution/create_execution_transition.py:90
- Draft comment:
The PR lacks a description, which makes it difficult to understand the full context and intent of the changes. Please provide a description for better clarity. - Reason this comment was not posted:
Confidence changes required:50%
The PR introduces new indices in the database queries, which is a good practice for performance optimization. However, the PR description is missing, which makes it difficult to understand the full context and intent of the changes. The code changes seem consistent with the migration script, but without a description, it's hard to verify if all necessary changes are included.
5. agents-api/agents_api/models/execution/get_execution.py:56
- Draft comment:
The PR lacks a description, which makes it difficult to understand the full context and intent of the changes. Please provide a description for better clarity. - Reason this comment was not posted:
Confidence changes required:50%
The PR introduces new indices in the database queries, which is a good practice for performance optimization. However, the PR description is missing, which makes it difficult to understand the full context and intent of the changes. The code changes seem consistent with the migration script, but without a description, it's hard to verify if all necessary changes are included.
6. agents-api/agents_api/models/execution/get_paused_execution_token.py:42
- Draft comment:
The PR lacks a description, which makes it difficult to understand the full context and intent of the changes. Please provide a description for better clarity. - Reason this comment was not posted:
Confidence changes required:50%
The PR introduces new indices in the database queries, which is a good practice for performance optimization. However, the PR description is missing, which makes it difficult to understand the full context and intent of the changes. The code changes seem consistent with the migration script, but without a description, it's hard to verify if all necessary changes are included.
7. agents-api/agents_api/models/execution/list_execution_transitions.py:38
- Draft comment:
The PR lacks a description, which makes it difficult to understand the full context and intent of the changes. Please provide a description for better clarity. - Reason this comment was not posted:
Confidence changes required:50%
The PR introduces new indices in the database queries, which is a good practice for performance optimization. However, the PR description is missing, which makes it difficult to understand the full context and intent of the changes. The code changes seem consistent with the migration script, but without a description, it's hard to verify if all necessary changes are included.
Workflow ID: wflow_4qmJnZjnq7t1BR32
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Important
Adds migration for indices and updates model queries to utilize these indices for improved performance.
migrate_1733755642_transition_indices.py
to create/drop indices forexecutions
,tasks
,agents
,sessions
,docs
,users
, andtransitions
tables.search_docs_by_embedding.py
andsearch_docs_by_text.py
to usedocs:owner_id_metadata_doc_id_idx
.count_executions.py
to useexecutions:task_id_execution_id_idx
.create_execution_transition.py
,get_paused_execution_token.py
, andlist_execution_transitions.py
to usetransitions:execution_id_type_created_at_idx
.get_execution.py
andupdate_execution.py
to useexecutions:execution_id_status_idx
.get_task.py
to usetasks:task_id_agent_id_idx
.get_user.py
,list_users.py
, andpatch_user.py
to useusers:developer_id_metadata_user_id_idx
.This description was created by for 2f88b8c. It will automatically update as commits are pushed.