-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Normalize config files #3920
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
Normalize config files #3920
Conversation
|
Currently pointed config files to use storage_config. This is slightly confusing as Alternatively we can create an |
|
What is the motivation for using |
|
No motivation - I misunderstood it at the start and then just got it to a working situation. I will replace that. What's your opinion of using |
9502ca7 to
1416aea
Compare
b125b82 to
c8a68e5
Compare
f4449fb to
447b534
Compare
|
Ready for review! |
daniel-j-h
left a comment
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.
What do we guarantee wrt. our public headers? (cc @TheMarex) I can see some modifications in publicly exposed config headers - not sure if this is fine for compatibility.
include/storage/io_config.hpp
Outdated
| @@ -0,0 +1,82 @@ | |||
| #ifndef IO_CONFIG_HPP | |||
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.
Should probably be prefix with OSRM_
include/storage/io_config.hpp
Outdated
| { | ||
| struct IOConfig | ||
| { | ||
| IOConfig() = default; |
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.
Why is the default constructor needed? A default constructed IOConfig can't do anything, no?
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.
Yes, I would prefer to drop this as a constructor, but in practice it doesn't work:
osrm-backend/src/tools/extract.cpp
Line 27 in bf6698f
| return_code parseArguments(int argc, char *argv[], extractor::ExtractorConfig &extractor_config) |
UseDefaultOutputNames function, but I couldn't get it to work like that.
include/storage/io_config.hpp
Outdated
| compressed_node_based_graph_path = {osrm_path.string() + ".cnbg"}; | ||
| cnbg_ebg_mapping_path = {osrm_path.string() + ".cnbg_to_ebg"}; | ||
| restriction_path = {osrm_path.string() + ".restrictions"}; | ||
| intersection_class_data_path = {osrm_path.string() + ".icd"}; |
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.
Hm is there a way we can make it so that we get a warning if we forget to initialize a path below?
Should this e.g. all be done in the constructor, as in
struct io {
io(path base)
: a(base + '.a'),
b(base + '.b') { }
path a;
path b;
};?
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.
See above - yes, should be the case, but didn't work out in practice.
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.
Ok I see. Thanks for explaining! :)
|
Also needs a rebase onto master before we can merge 🎄 |
9c94502 to
80c30b4
Compare
|
From IRC: |
|
Ping @daniel-j-h |
example/example.cpp
Outdated
| // Configure based on a .osrm base path, and no datasets in shared mem from osrm-datastore | ||
| EngineConfig config; | ||
| config.storage_config = {argv[1]}; | ||
| config.storage_config.UseDefaultOutputNames(argv[1]); |
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.
Hm user coder here needs to change this is still breaking the api
include/nodejs/node_osrm_support.hpp
Outdated
| *v8::String::Utf8Value(Nan::To<v8::String>(args[0]).ToLocalChecked())); | ||
| std::string base_path(*v8::String::Utf8Value(args[0]->ToString())); | ||
| engine_config->storage_config = osrm::StorageConfig(); | ||
| engine_config->storage_config.UseDefaultOutputNames(base_path); |
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.
Same here
include/nodejs/node_osrm_support.hpp
Outdated
| osrm::StorageConfig(*v8::String::Utf8Value(Nan::To<v8::String>(path).ToLocalChecked())); | ||
| std::string base_path(*v8::String::Utf8Value(path->ToString())); | ||
| engine_config->storage_config = osrm::StorageConfig(); | ||
| engine_config->storage_config.UseDefaultOutputNames(base_path); |
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.
And here
src/benchmarks/match.cpp
Outdated
| // Configure based on a .osrm base path, and no datasets in shared mem from osrm-datastore | ||
| EngineConfig config; | ||
| config.storage_config = {argv[1]}; | ||
| config.storage_config.UseDefaultOutputNames(argv[1]); |
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.
And here
|
Ah I've just seen you added a constructor calling |
|
But in previous versions most subclasses had |
|
Yeah the user should not see the |
3224072 to
c2dbf22
Compare
… to use new io_config constructor
c2dbf22 to
3c2c1a5
Compare
|
Addressed comments (waiting for builds to pass, might have to do some clang-formatting, feel free to leave additional comments) |
|
Yep Travis complains about clang-formating |
|
👍 formatted the file, now waiting for 📗 🍏 |
3c2c1a5 to
5c520e4
Compare
|
One test seemed to have timed out, could you restart? |
|
Thanks for this - it's making some I/O parts nicer for sure! I just merged it into master. ✨ |
Issue
Normalizing the usage & file names across config files by referring to a single config file.
Tasklist
GetPath