Skip to content
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

Allow to disable importing #492

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jbruechert
Copy link
Contributor

I haven't thoroughly tested this yet

@felixguendling
Copy link
Member

This will not work this way as most modules initialize data in the import method.

At least this needs to run for the nigiri module to work:

impl_->tt_ = std::make_shared<cista::wrapped<n::timetable>>(
n::timetable::read(cista::memory_holder{
cista::file{dump_file_path.string().c_str(), "r"}
.content()}));
(**impl_->tt_).locations_.resolve_timezones();
if (!gtfsrt_urls_.empty() || !gtfsrt_paths_.empty()) {
impl_->update_rtt(std::make_shared<n::rt_timetable>(
n::rt::create_rt_timetable(**impl_->tt_, today)));
}

if (lookup_) {
impl_->station_lookup_ = std::make_shared<nigiri_station_lookup>(
impl_->tags_, **impl_->tt_);
auto copy = impl_->station_lookup_;
add_shared_data(to_res_id(mm::global_res_id::STATION_LOOKUP),
std::move(copy));
}
if (guesser_) {
impl_->guesser_ =
std::make_unique<guesser>(impl_->tags_, (**impl_->tt_));
}
if (railviz_) {
impl_->initial_permalink_ = get_initial_permalink(**impl_->tt_);
impl_->railviz_ =
std::make_unique<railviz>(impl_->tags_, (**impl_->tt_));
}
add_shared_data(to_res_id(mm::global_res_id::NIGIRI_TIMETABLE),
impl_->tt_->get());
add_shared_data(to_res_id(mm::global_res_id::NIGIRI_TAGS),
&impl_->tags_);

Same for the osr module:

auto w = std::make_unique<o::ways>(dir, cista::mmap::protection::READ);
if (lock_) {
w->lock();
}
auto l = std::make_unique<o::lookup>(*w);
impl_ = std::make_unique<impl>(std::move(w), std::move(l));

I guess the only option is to have a additional parameter to the import() function that indicates if it's allowed to do preprocessing if the hash does not match.

@felixguendling
Copy link
Member

I guess another option would be to split the import functionality into preprocessing the data and actually loading the data. My plan is to address this and many other issues mentioned in #452 (such as a stable API + versioning, running MOTIS without the input folder, etc.) in one go by creating something like "MOTIS 2.0". My plan is to start working on this big refactoring in one month.

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.

None yet

2 participants