mirror of https://github.com/1okko/openpilot.git
timeless routes (#31119)
* timeless route * update sort * update test * fix param name
This commit is contained in:
parent
ed39519014
commit
7cfc571f56
|
@ -188,6 +188,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
|||
{"RecordFront", PERSISTENT},
|
||||
{"RecordFrontLock", PERSISTENT}, // for the internal fleet
|
||||
{"ReplayControlsState", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
|
||||
{"RouteCount", PERSISTENT},
|
||||
{"SnoozeUpdate", CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION},
|
||||
{"SshEnabled", PERSISTENT},
|
||||
{"TermsVersion", PERSISTENT},
|
||||
|
|
|
@ -89,15 +89,6 @@ kj::Array<capnp::word> logger_build_init_data() {
|
|||
return capnp::messageToFlatArray(msg);
|
||||
}
|
||||
|
||||
std::string logger_get_route_name() {
|
||||
char route_name[64] = {'\0'};
|
||||
time_t rawtime = time(NULL);
|
||||
struct tm timeinfo;
|
||||
localtime_r(&rawtime, &timeinfo);
|
||||
strftime(route_name, sizeof(route_name), "%Y-%m-%d--%H-%M-%S", &timeinfo);
|
||||
return route_name;
|
||||
}
|
||||
|
||||
std::string logger_get_identifier(std::string key) {
|
||||
// a log identifier is a 32 bit counter, plus a 10 character unique ID.
|
||||
// e.g. 000001a3--c20ba54385
|
||||
|
@ -131,7 +122,7 @@ static void log_sentinel(LoggerState *log, SentinelType type, int eixt_signal =
|
|||
}
|
||||
|
||||
LoggerState::LoggerState(const std::string &log_root) {
|
||||
route_name = logger_get_route_name();
|
||||
route_name = logger_get_identifier("RouteCount");
|
||||
route_path = log_root + "/" + route_name;
|
||||
init_data = logger_build_init_data();
|
||||
}
|
||||
|
|
|
@ -52,5 +52,4 @@ protected:
|
|||
};
|
||||
|
||||
kj::Array<capnp::word> logger_build_init_data();
|
||||
std::string logger_get_route_name();
|
||||
std::string logger_get_identifier(std::string key);
|
||||
|
|
|
@ -72,8 +72,8 @@ class UploaderTestCase(unittest.TestCase):
|
|||
uploader.force_wifi = True
|
||||
uploader.allow_sleep = False
|
||||
self.seg_num = random.randint(1, 300)
|
||||
self.seg_format = "2019-04-18--12-52-54--{}"
|
||||
self.seg_format2 = "2019-05-18--11-22-33--{}"
|
||||
self.seg_format = "00000004--0ac3964c96--{}"
|
||||
self.seg_format2 = "00000005--4c4e99b08b--{}"
|
||||
self.seg_dir = self.seg_format.format(self.seg_num)
|
||||
|
||||
self.params = Params()
|
||||
|
|
|
@ -263,6 +263,10 @@ class SegmentRange:
|
|||
def timestamp(self) -> str:
|
||||
return self.m.group("timestamp")
|
||||
|
||||
@property
|
||||
def log_id(self) -> str:
|
||||
return self.m.group("log_id")
|
||||
|
||||
@property
|
||||
def slice(self) -> str:
|
||||
return self.m.group("slice") or ""
|
||||
|
@ -291,7 +295,7 @@ class SegmentRange:
|
|||
return list(range(end + 1))[s]
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.dongle_id}/{self.timestamp}" + (f"/{self.slice}" if self.slice else "") + (f"/{self.selector}" if self.selector else "")
|
||||
return f"{self.dongle_id}/{self.log_id}" + (f"/{self.slice}" if self.slice else "") + (f"/{self.selector}" if self.selector else "")
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return self.__str__()
|
||||
|
|
Loading…
Reference in New Issue