-
Notifications
You must be signed in to change notification settings - Fork 4
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
CONJUBILEE-2783: SaaS Connectors: Support for Partitioning Aggregation #60
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
aa3f9b4
CONJUBILEE-2783: SaaS Connectors: Support for Partitioning Aggregation
abhishek-hedaoo-sp 437aef2
Misc changes
abhishek-hedaoo-sp 00871a1
Misc changes
abhishek-hedaoo-sp 2d264cd
Adding loggers
abhishek-hedaoo-sp e304cd8
Addressing review comment
abhishek-hedaoo-sp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export class Partition { | ||
public name: string | ||
public size: number | ||
public attributes: Map<string, any> | ||
public objectType: string | ||
|
||
constructor(name: string, size: number, attributes: Map<string, any>, objectType: string) { | ||
this.name = name; | ||
this.size = size; | ||
this.attributes = attributes; | ||
this.objectType = objectType; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Context, readConfig, Response, StdAccountListInput, StdAccountListOutput } from "."; | ||
import { Partition } from "./partition"; | ||
|
||
export interface PartitionedAdapter { | ||
getPartitions(context: Context, input: StdAccountListInput): Promise<Array<Partition>> | ||
list(context: Context, input: StdAccountListInput, res: Response<StdAccountListOutput>, partition?: Partition): Promise<void> | ||
} | ||
|
||
export class Partitioned { | ||
public h; | ||
|
||
constructor(h: PartitionedAdapter) { | ||
this.h = h; | ||
} | ||
|
||
async handler(context: Context, input: StdAccountListInput, res: Response<StdAccountListOutput>): Promise<void> { | ||
|
||
const config = await readConfig(); | ||
const isPatitionEnabled = config.partitionAggregationEnabled; | ||
var partitionList: Array<Partition> | undefined; | ||
|
||
if (isPatitionEnabled) { | ||
partitionList = await this.h.getPartitions(context, input); | ||
} | ||
|
||
if (!partitionList) { | ||
let promises = []; | ||
for (const partition of partitionList!) { | ||
promises.push(this.h.list(context, input, res, partition)); | ||
} | ||
await Promise.all(promises); | ||
} else { | ||
return await this.h.list(context, input, res, undefined); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we add logging here to allow troubleshooters to determine if:
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.
Point 1-3 addressed.
Point 4 - Shouldn't this get logged at the connector level? I think we do not have control to check when a particular partition is finishing.
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.
For 4 I was thinking we could do something like:
The reason I think this is valuable at the library level is because it gives us a good idea of how good of a job the connector is doing at creating equally sized partitions. I remember seeing a case of partitioning on java connectors where one of the partitions ended up being much larger than the others so we weren't taking advantage of as much parallelism as we could have.
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.
Makes sense. Updated the code.