Skip to content

Commit

Permalink
RSL 2021 AP4 (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablohoch authored Mar 1, 2022
1 parent 8ba519e commit d4621d4
Show file tree
Hide file tree
Showing 101 changed files with 5,129 additions and 1,195 deletions.
3 changes: 2 additions & 1 deletion .clang-tidy.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Checks: "*,\
-cppcoreguidelines-pro-bounds-constant-array-index,\
-*-avoid-c-arrays,\
-*-narrowing-conversions,\
-*-avoid-goto,
-*-avoid-goto,\
-hicpp-multiway-paths-covered,\
-clang-analyzer-cplusplus.NewDeleteLeaks,\
-clang-analyzer-cplusplus.NewDelete,\
Expand All @@ -73,6 +73,7 @@ Checks: "*,\
WarningsAsErrors: '*'
HeaderFilterRegex: '^${RELATIVE_SOURCE_DIR}(base|modules|test)/'
AnalyzeTemporaryDtors: false
UseColor: true
User: root
CheckOptions:
- key: cert-err61-cpp.CheckThrowTemporaries
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ jobs:
pnpm-${{ runner.os }}-
- name: Install RSL Web Interface Dependencies
uses: pnpm/action-setup@v2.0.1
uses: pnpm/action-setup@v2.2.0
with:
version: 6.25.1
version: ^6.32.2
run_install: |
- cwd: ui/rsl
Expand Down Expand Up @@ -348,7 +348,7 @@ jobs:
- name: Compile Web Interface
if: matrix.config.webui == 'On'
run: |
cmake --build build --target motis-web-ui
cmake --build build --target motis-web-ui || (sleep 10 && cmake --build build --target motis-web-ui)
rm -r ui/web/elm-stuff
rm -r ui/web/src
Expand All @@ -362,10 +362,10 @@ jobs:
pnpm-${{ runner.os }}-
- name: Install RSL Web Interface Dependencies
uses: pnpm/action-setup@v2.0.1
uses: pnpm/action-setup@v2.2.0
if: matrix.config.webui == 'On'
with:
version: 6.20.1
version: ^6.32.2
run_install: |
- cwd: ./ui/rsl
Expand All @@ -379,9 +379,11 @@ jobs:
if: matrix.config.artifact
run: |
mkdir motis
mv ui/web motis
mv ui/rsl/dist motis/rsl
mv build/motis motis
mkdir motis/web
mv ui/web/{external_lib,img,js,style} motis/web/
mv ui/web/{*.html,*.js,*.ico} motis/web/
mv ui/rsl/dist motis/web/rsl
mv build/motis motis/
cp -r deps/osrm-backend/profiles motis/osrm-profiles
cp -r deps/ppr/profiles motis/ppr-profiles
cp -r deps/tiles/profile motis/tiles-profiles
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ jobs:
pnpm-${{ runner.os }}-
- name: Install RSL Web Interface Dependencies
uses: pnpm/action-setup@v2.0.1
uses: pnpm/action-setup@v2.2.0
if: matrix.config.webui == 'On'
with:
version: 6.25.1
version: ^6.32.2
run_install: |
- cwd: ./ui/rsl
Expand All @@ -122,13 +122,17 @@ jobs:
- name: Move Profiles
if: matrix.config.mode == 'Release'
run: |
echo d | xcopy /s .\deps\osrm-backend\profiles .\osrm-profiles
echo d | xcopy /s .\deps\ppr\profiles .\ppr-profiles
echo d | xcopy /s .\deps\tiles\profile .\tiles-profiles
Copy-Item .\deps\osrm-backend\profiles .\osrm-profiles -Recurse
Copy-Item .\deps\ppr\profiles .\ppr-profiles -Recurse
Copy-Item .\deps\tiles\profile .\tiles-profiles -Recurse
- name: Move RSL UI
- name: Move Web UI
if: matrix.config.mode == 'Release'
run: echo d | xcopy /s .\ui\rsl\dist .\rsl
run: |
mkdir web
Copy-Item .\ui\web\external_lib,.\ui\web\img,.\ui\web\js,.\ui\web\style .\web\ -Recurse
Copy-Item .\ui\web\*.html,.\ui\web\*.js,.\ui\web\*.ico .\web\
Copy-Item .\ui\rsl\dist .\web\rsl -Recurse
- name: Create Distribution
if: matrix.config.mode == 'Release'
Expand All @@ -138,8 +142,7 @@ jobs:
.\osrm-profiles
.\ppr-profiles
.\tiles-profiles
.\ui\web
.\rsl
.\web
- name: Upload Distribution
if: matrix.config.mode == 'Release'
Expand Down
2 changes: 1 addition & 1 deletion .pkg
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
[net]
[email protected]:motis-project/net.git
branch=master
commit=9ea612ff034accbd01825959496ee03a3fece1ef
commit=126869fa3a2ea5c3024c44c180daf4031f802853
[osrm-backend]
[email protected]:motis-project/osrm-backend.git
branch=motis
Expand Down
2 changes: 2 additions & 0 deletions base/core/include/motis/core/common/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ struct scoped_timer final {
struct manual_timer final {
explicit manual_timer(std::string name);
void stop_and_print();
double duration_ms() const;

std::string name_;
std::chrono::time_point<std::chrono::steady_clock> start_;
std::chrono::time_point<std::chrono::steady_clock> stop_;
};

} // namespace motis::logging
129 changes: 129 additions & 0 deletions base/core/include/motis/core/debug/trip.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#pragma once

#include <iomanip>
#include <iostream>

#include "motis/core/schedule/schedule.h"

#include "motis/core/access/realtime_access.h"
#include "motis/core/access/trip_iterator.h"

namespace motis::debug {

struct station {
friend std::ostream& operator<<(std::ostream& out, station const& s) {
auto const& sched = s.sched_;
auto const idx = s.idx_;
auto const& st = sched.stations_[idx];
out << "{idx=" << idx << ", eva=" << st->eva_nr_ << ", name=" << st->name_
<< "}";
return out;
}

schedule const& sched_;
uint32_t idx_;
};

struct trip_id {
friend std::ostream& operator<<(std::ostream& out, trip_id const& t) {
auto const& sched = t.sched_;
auto const& id = t.id_;
if (id == full_trip_id{}) {
return out << "{expanded rule service trip}";
}
out << "{primary={station="
<< station{sched, static_cast<uint32_t>(id.primary_.station_id_)}
<< ", time=" << format_time(id.primary_.get_time())
<< ", train_nr=" << id.primary_.get_train_nr()
<< "}, secondary={station="
<< station{sched,
static_cast<uint32_t>(id.secondary_.target_station_id_)}
<< ", time=" << format_time(id.secondary_.target_time_) << ", line "
<< id.secondary_.line_id_ << "}}";
return out;
}

schedule const& sched_;
full_trip_id id_;
};

struct trip {
friend std::ostream& operator<<(std::ostream& out, trip const& t) {
auto const& sched = t.sched_;
auto const* trp = t.trp_;
out << "{"
<< "ptr=" << trp << ", id=" << trip_id{sched, trp->id_}
<< ", edges=" << trp->edges_->size() << ", lcon_idx=" << trp->lcon_idx_
<< ", dbg=" << trp->dbg_.str() << "}";
return out;
}

schedule const& sched_;
motis::trip const* trp_;
};

struct trip_with_sections {
friend std::ostream& operator<<(std::ostream& out,
trip_with_sections const& t) {
auto const& sched = t.sched_;
auto const* trp = t.trp_;

auto const print_event = [&](ev_key const& ek) {
auto const di = get_delay_info(sched, ek);
out << " " << (ek.is_departure() ? "dep" : "arr");
out << "={time=" << format_time(ek.get_time())
<< ", current=" << format_time(di.get_current_time())
<< ", schedule=" << format_time(di.get_schedule_time())
<< ", reason=" << di.get_reason() << ", canceled=" << ek.is_canceled()
<< ", station=" << station{sched, ek.get_station_idx()} << "}";
};

out << "trip " << trip{sched, trp} << ":\n";
auto sec_idx = 0U;
auto last_time = time{0};
auto last_merged_trips = 0U;
for (auto const& sec : access::sections{trp}) {
auto const kd = sec.ev_key_from();
auto const ka = sec.ev_key_to();

out << " section " << std::setw(2) << sec_idx
<< ": route_edge={ptr=" << sec.get_route_edge()
<< ", node=" << kd.route_edge_.route_node_
<< ", edge_idx=" << kd.route_edge_.outgoing_edge_idx_
<< "}, lcons=" << sec.get_route_edge()->m_.route_edge_.conns_.size()
<< ", route=" << kd.get_node()->route_
<< ", merged_trips=" << sec.lcon().trips_ << " [ ";
for (auto const& mt : *sched.merged_trips_[sec.lcon().trips_]) {
out << cista::ptr_cast(mt) << " ";
}
out << "]";
if (sec_idx != 0U && last_merged_trips != sec.lcon().trips_) {
out << " (merged trips change)";
}
out << "\n";

print_event(kd);
if (kd.get_time() < last_time) {
out << " !!! time < previous arrival time !!!";
}
out << "\n";

print_event(ka);
if (ka.get_time() < kd.get_time()) {
out << " !!! time < previous departure time !!!";
}
out << "\n\n";

++sec_idx;
last_time = ka.get_time();
last_merged_trips = sec.lcon().trips_;
}
out << "\n";
return out;
}

schedule const& sched_;
motis::trip const* trp_;
};

} // namespace motis::debug
10 changes: 7 additions & 3 deletions base/core/src/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ manual_timer::manual_timer(std::string name)

void manual_timer::stop_and_print() {
using namespace std::chrono;
auto stop = steady_clock::now();
double t = duration_cast<microseconds>(stop - start_).count() / 1000.0;
stop_ = steady_clock::now();
LOG(info) << "[" << name_ << "] finished"
<< " (" << t << "ms)";
<< " (" << duration_ms() << "ms)";
}

double manual_timer::duration_ms() const {
using namespace std::chrono;
return duration_cast<microseconds>(stop_ - start_).count() / 1000.0;
}

// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
Expand Down
1 change: 1 addition & 0 deletions base/module/src/dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ void dispatcher::dispatch(msg_ptr const& msg, callback const& cb, ctx::op_id id,
[op = remote_op.value(), msg, cb]() { op(msg, cb); });
return;
} else {
LOG(logging::warn) << "target not found: " << id.name;
return handle_no_target(msg, cb);
}
} catch (std::system_error const& e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ struct trip_recommendation {
std::vector<extern_trip> planned_trips_;
std::vector<std::uint32_t> planned_destinations_;
extern_trip recommended_trip_{};
std::uint32_t interchange_station_{};
};

} // namespace motis::paxforecast::measures
3 changes: 1 addition & 2 deletions modules/paxforecast/src/messages.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ measures::trip_recommendation from_fbs(schedule const& sched,
utl::to_vec(
*m->planned_destinations(),
[&](String const* eva) { return get_station_index(sched, eva); }),
to_extern_trip(m->recommended_trip()),
get_station_index(sched, m->interchange_station())};
to_extern_trip(m->recommended_trip())};
}

measures::trip_load_information from_fbs(schedule const& sched,
Expand Down
Loading

0 comments on commit d4621d4

Please sign in to comment.