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.
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
Refactor GCBM API #163
base: master
Are you sure you want to change the base?
Refactor GCBM API #163
Changes from 1 commit
8fa8826
322dd11
32fcfd0
cecca2c
f25da75
7c6a62d
1436a61
eb62553
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
We need to support input databases also. If you rename$\rightarrow$
/tests/tiffs/new_demo_run
tests/reference/new_demo_run
then it makes sense to include files in addition totiffs
.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.
PS. thank you for changing this to lowercase - CamelCase filenames drive me nuts.
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.
P.P.S I also got sick of the unnecessary
_moja
suffix and removed it from thelinux-demo
reference simulation on #165There 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.
Got it! I understand that it's a TODO, and I'll add this feature in the next commit. Thanks for letting me know about the
_moja
suffix removal, since it's merged now - I'll rebase and fix these suffixes.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.
Fixed! :)
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.
Another scenario is that categories are provided as part of an HTTP request, via call to the
/gcbm/upload
REST endpoint.@YashKandalkar - would you prefer to support individual file uploads on the front end, or the bulk
upload
option we currently use an an example (see:curl.md
)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.
@aornugent - Thanks for adding these TODOs in the code, they are extremely useful for me to track what needs to be done. However, I'm a bit confused about this one - do we want to just read these files, and store them in another folder? Or in a JSON? Or do we want to extract any information, and use it somewhere else? I'm not sure as I couldn't find a relevant part of it in
app.py
, so I'll really appreciate it if you can help me with this.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.
Hi @ankitaS11 - this one is a little cryptic. The two files need to be copied from
templates
and the default behaviour was to traverse all the config. files in the folder withsafe_read_json
, read their contents into thefiles
dictionary, and then save a copy in the simulation folder.But
safe_read_json()
only reads JSON, and was erroring out when given the.cfg
and.conf
files.The contents of these files don't change very often (if ever!) but presently we have no way of reading them as part of the simulation configuration.
I'd appreciate your advice on how they can be handled.
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.
Hi @aornugent. I'm not Ankita, but I think configparser library would be a good choice for parsing the
.conf
files. They provide easy parsing for.ini
style syntax.For
.cfg
files, we can prepend a pseduo-section and then useconfigparser
.The code would look something like this:
The problem is that all keys in the
gcbm_config.cfg
have the same name. This causes an error too.we can maybe rename some fields? Like
localdomain_config=localdomain.json
? :)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.
Thanks @Crystalsage - that's a good suggestion. I don't think we can change the field names, because they're in the format that the GCBM understands.
Maybe we can just read these files in as strings for now?
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.
@aornugent Ah I see. In that case - what do you think about preparing a makeshift
.cfg
config in memory for better parsing and using that throughout the API? This way, we won't need to restructure the config file - and we can always change a few things around the API. A very rough sketch looks something like this: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.
Hi @Crystalsage - sorry for the delay. Your proposal looks great!
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.
Hi @Crystalsage - are you append your suggested changes to this branch please?