-
Notifications
You must be signed in to change notification settings - Fork 0
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
Bep031 review updates #7
Bep031 review updates #7
Conversation
I think keeping it as readBuffer is better for now, this kind of readFile call I think is something we'll replace soon but with one use of it here - keeping them separate makes it clear which behavior is expected when refactoring it 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.
Ran through this, tried breaking some of tests and that worked as expected. 👍
I do have concerns about the memory usage if the dataset is too large, but currently have no good ideas on how to optimize this yet. I suggest leaving |
Hi @rwblair and @nellh, thank you for making corrections and reviewing this PR! I tried testing it but I get an ENOBUF error with both our examples datasets (micr_spim and micr_sem) on this branch (that I don't have on bep031).
|
This is the issue discussed in https://github.com/bids-standard/bids-validator/issues/1399 does the ESBUILD_MAX_BUFFER=33554432 workaround solve it for you? |
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.
Thank you @nellh and @konantian.
I was able to run the validator without the ENOBUF error using either of your suggestions.
set ESBUILD_MAX_BUFFER=33554432
or- moving
exifreader
andxml2js
frombids-validator/bids-validator/package.json
tobids-validator/package.json
So I tested the branch, everything is working great with the micr_SPIM
dataset, except the filename embedded in the ChunkTransformationMatrix warning.
Similarly, the error we get with the micr_SEM
dataset seems also related to this error, but I don't understand why and why only for PNG files.
I have no experience in Javascript (only python) so I hope my comments make sense. Thank you for your help!
file: { | ||
path: file, | ||
}, | ||
code: 223, |
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.
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.
It also seems to be related to the issue with the micr_SEM
dataset. This function returns the issues [ undefined, undefined ]
causing the "Unhandled rejection". (but only for PNG files?)
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.
Good catch, I forgot that the result of the json check function was being directly concatenated to the issues list. If there were no problems it returned undefined by default. I added a base return with an empty list to handle this.
The ENOBUF is related to esbuild-runner some how. If the exifreader and xml dependencies are in bids-validator/bids-validator/package.json, and the validator is called with bids-validator/bids-validator/ being the current working directory I don't get the error. If while in bids-validator/bids-validator/ I call So at least thats only an error for development, not sure how best to resolve that issue though. Would be nice to keep the dependency in just the validators package.json and be able to call the cli without having to rebuild every time (though esbuild is so fast maybe the call to the cli could just kick off the build process if it detects its in a dev environment?) I'm not able to build the website currently with
I'll update here when I find a fix for this as well. |
Putting the dependencies in the root package will incidentally work since they exist in node_modules but it will fail when bundled (esbuild or webpack) because they are not included in the output and not present at runtime. The ENOBUFS error is caused when esbuild's output buffer for the full bundle (bids-validator and all deps) is exceeding the buffer size. These dependencies aren't terribly large (about 150kB minified together), I think we can temporarily raise the buffer limit and try to solve this separately. |
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.
@mariehbourget ENOBUF and web issue should fixed from my past couple of commits. Feel free to merge and any further issues I can push directly to the main PR. |
Few proposed changes to the bep031 PR.
For the error generated from missing the chunk matrix, I use the data file in the error instead of the json file returned by generateMergedSidecarDictWithPath. generateMergedSidecarDictWithPath only returned the last json file validated, where the value could be and could go in any inherited json file for the data file.
I tried to rewrite without using the new readBuffer function and only using readFile. Its possible, we can decode the string returned by readFile back into a buffer, but this makes our potential memory issues worse by making a new copy of the files contents.
@nellh what do you think about adding a flag on readFile to return a buffer? or would leaving readBuffer as is in place be better?
Leaving as WIP until @nellh gets a chance to review.
Let me know what yall think @etiennebergeron and @konantian.