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: peer review backend endpoints #20

Merged
merged 5 commits into from
Dec 18, 2024
Merged

Conversation

zhangvi7
Copy link
Owner

Changes

  • Refactor create_query_execution() to handle peer review workflow and delayed executions
  • Delayed executions will be continue on reviewer approval

)
data_cell = datadoc_logic.get_data_cell_by_id(data_cell_id, session=session)
data_doc = data_cell.doc
data_doc = process_query_execution(

Choose a reason for hiding this comment

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

the name process_query_execution sounds like it is executing the query, maybe process_query_execution_metadata?

Comment on lines 536 to 569
trackClick({
component: ComponentType.DATADOC_QUERY_CELL,
element: ElementType.PEER_REVIEW_QUERY_BUTTON,
aux: {
lintError: this.state.hasLintError,
sampleRate: this.sampleRate,
},
});

const transformedQuery = await this.getTransformedQuery();
if (!transformedQuery) {
return null;
}

const executionMetadata =
this.sampleRate > 0 ? { sample_rate: this.sampleRate } : null;

const peerReviewParams = {
reviewer_ids: reviewerIds,
external_recipients: externalRecipients,
notifier_name: notifierName,
review_request_reason: justification,
};

const delayExecution = true;

await this.props.createQueryExecution(
transformedQuery,
this.engineId,
this.props.cellId,
executionMetadata,
peerReviewParams,
delayExecution
);

Choose a reason for hiding this comment

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

this is quite similar to onRunButtonClick, can we refactor a bit to reuse and serve both?

querybook/server/datasources/query_execution.py Outdated Show resolved Hide resolved
session=session,
)
# TODO: Implement notification logic for reviewers
print(external_recipients)
Copy link
Owner Author

Choose a reason for hiding this comment

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

Will remove prints in next PR and add notification logic

@zhangvi7
Copy link
Owner Author

Changes: refactored into onRunButtonClick() and onPeerReviewSubmit() to use helper executeQuery()

@zhangvi7 zhangvi7 force-pushed the peer-review/backend branch from 1849b09 to 0ccbfc3 Compare December 16, 2024 21:52
@@ -446,40 +446,93 @@ class DataDocQueryCellComponent extends React.PureComponent<IProps, IState> {
}

@bind
public async onRunButtonClick() {
public async executeQuery(options: {

Choose a reason for hiding this comment

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

are we going to support the review request in the adhoc page as well? or we can have some pointer to let user to use datadocs if they see those errors.

Copy link
Owner Author

Choose a reason for hiding this comment

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

added for adhoc page as well

Comment on lines 533 to 534
peerReviewParams,
delayExecution: true,

Choose a reason for hiding this comment

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

isn't delayExecution kind of unnecessary? it will be always true if peerReviewParams is not null?

Copy link
Owner Author

Choose a reason for hiding this comment

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

agreed, just added delayExecution flag in case we have future feature that require delay execution, removed for now

@zhangvi7 zhangvi7 force-pushed the peer-review/backend branch from b515d87 to 6fded45 Compare December 17, 2024 23:13
@zhangvi7 zhangvi7 force-pushed the peer-review/backend branch from 6fded45 to 9d933b0 Compare December 17, 2024 23:16
@zhangvi7 zhangvi7 merged commit 93bab9b into peer-review/db Dec 18, 2024
@zhangvi7 zhangvi7 deleted the peer-review/backend branch December 18, 2024 15:24
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.

2 participants