Skip to content

Add new functionality to calculate chunk size dynamically#277

Merged
AidasK merged 4 commits intoflowjs:masterfrom
aayusharyan:patch-3
Jan 7, 2020
Merged

Add new functionality to calculate chunk size dynamically#277
AidasK merged 4 commits intoflowjs:masterfrom
aayusharyan:patch-3

Conversation

@aayusharyan
Copy link
Copy Markdown
Collaborator

Add calculateChunkSize option when the chunkSize cannot be predecided for all the files... So, this will be called if it is defined and fileObject is passed as a parameter, so the chunk size can be set for each file without creating a new instance of Flow.

@aayusharyan aayusharyan changed the title Update flow.js Add new functionality to calculate chunk size dynamically Jan 6, 2020
@aayusharyan
Copy link
Copy Markdown
Collaborator Author

@AidasK
Hi, when you have time. Please check this. 🙇

@AidasK
Copy link
Copy Markdown
Member

AidasK commented Jan 6, 2020

I think solution could be a bit cleaner.

Maybe chunkSize option itself could be a function?
And chunkSize in FlowChunk is no longer valid

this.chunkSize = this.flowObj.opts.chunkSize;

So this value might be changed via constructor params

get params too:

flowChunkSize: this.flowObj.opts.chunkSize,

@aayusharyan
Copy link
Copy Markdown
Collaborator Author

Okay.
@AidasK I have changed the opts chunkSize to work as a function also. There is no BC. I have checked everything including the getParams method response for each chunk. Attaching one evidence for your peace of mind. (This is the response of getParams) 😅
Screenshot 2020-01-07 at 12 19 25 AM

@akshay-kh
Copy link
Copy Markdown
Contributor

@aayusharyan @AidasK is there any update related to this PR.

@AidasK AidasK merged commit eb2ed8e into flowjs:master Jan 7, 2020
@AidasK
Copy link
Copy Markdown
Member

AidasK commented Jan 7, 2020

That looks cleaner! @aayusharyan @akshay-kh can you tell me more about the use case of this feature? Why do we need this?

@aayusharyan
Copy link
Copy Markdown
Collaborator Author

The use-case will be when we need to have a chunk size dynamically for each individual file... For example, I can say in my use-case GCS Takes 32 chunks in a single merge request. And due to backend limitations, I can perform only 32 chunks and my files can be anywhere from 500KB to 30GB and thus, I want to make chunkSize dynamic for each individual file.

@aayusharyan
Copy link
Copy Markdown
Collaborator Author

@AidasK,
Thanks for the Merge. I have one more suggestion. I'll make that improvement soon. 😅

@AidasK
Copy link
Copy Markdown
Member

AidasK commented Jan 7, 2020

Oh, sounds super useful then 👍

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.

3 participants