mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 01:54:43 +00:00
Formatted src/biergarten_pipeline_orchestrator
This commit is contained in:
@@ -24,7 +24,8 @@ void BiergartenPipelineOrchestrator::GenerateBreweries(
|
||||
[this, &skipped_count](
|
||||
const EnrichedCity& enriched_city) -> std::optional<BreweryRecord> {
|
||||
try {
|
||||
const BreweryResult brewery = generator_->GenerateBrewery(enriched_city);
|
||||
const BreweryResult brewery =
|
||||
generator_->GenerateBrewery(enriched_city);
|
||||
const std::string postal_code =
|
||||
postal_code_service_->GeneratePostalCode(enriched_city.location);
|
||||
return BreweryRecord{
|
||||
@@ -34,10 +35,10 @@ void BiergartenPipelineOrchestrator::GenerateBreweries(
|
||||
} catch (const std::exception& e) {
|
||||
++skipped_count;
|
||||
|
||||
logger_->Log(
|
||||
{.level = LogLevel::Warn,
|
||||
logger_->Log({.level = LogLevel::Warn,
|
||||
.phase = PipelinePhase::BreweryAndBeerGeneration,
|
||||
.message = std::format("[Pipeline] Skipping city '{}' ({}): brewery "
|
||||
.message = std::format(
|
||||
"[Pipeline] Skipping city '{}' ({}): brewery "
|
||||
"generation failed: {}",
|
||||
enriched_city.location.city,
|
||||
enriched_city.location.country, e.what())});
|
||||
@@ -45,13 +46,14 @@ void BiergartenPipelineOrchestrator::GenerateBreweries(
|
||||
}
|
||||
};
|
||||
|
||||
const auto export_record = [this, &export_failed_count](
|
||||
const BreweryRecord& record) {
|
||||
const auto export_record =
|
||||
[this, &export_failed_count](const BreweryRecord& record) {
|
||||
try {
|
||||
exporter_->ProcessRecord(record);
|
||||
} catch (const std::exception& export_exception) {
|
||||
++export_failed_count;
|
||||
logger_->Log({.level = LogLevel::Warn,
|
||||
logger_->Log(
|
||||
{.level = LogLevel::Warn,
|
||||
.phase = PipelinePhase::BreweryAndBeerGeneration,
|
||||
.message = std::format(
|
||||
"[Pipeline] Generated brewery for '{}' ({}) "
|
||||
@@ -62,7 +64,8 @@ void BiergartenPipelineOrchestrator::GenerateBreweries(
|
||||
};
|
||||
|
||||
for (const EnrichedCity& enriched_city : cities) {
|
||||
const std::optional<BreweryRecord> record = generate_record(enriched_city);
|
||||
const std::optional<BreweryRecord> record =
|
||||
generate_record(enriched_city);
|
||||
if (!record.has_value()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ std::string Sanitize(std::string_view value) {
|
||||
|
||||
std::string BuildEmail(const Name& name,
|
||||
std::unordered_set<std::string>& used_local_parts) {
|
||||
const std::string base =
|
||||
std::format("{}.{}", Sanitize(name.first_name), Sanitize(name.last_name));
|
||||
const std::string base = std::format("{}.{}", Sanitize(name.first_name),
|
||||
Sanitize(name.last_name));
|
||||
|
||||
std::string local_part = base;
|
||||
uint32_t suffix = 1;
|
||||
@@ -147,12 +147,13 @@ void BiergartenPipelineOrchestrator::GenerateUsers(
|
||||
};
|
||||
} catch (const std::exception& e) {
|
||||
++skipped_count;
|
||||
logger_->Log({.level = LogLevel::Warn,
|
||||
logger_->Log(
|
||||
{.level = LogLevel::Warn,
|
||||
.phase = PipelinePhase::UserGeneration,
|
||||
.message = std::format(
|
||||
"[Pipeline] Skipping city '{}' ({}): "
|
||||
.message = std::format("[Pipeline] Skipping city '{}' ({}): "
|
||||
"user generation failed: {}",
|
||||
city.location.city, city.location.country, e.what())});
|
||||
city.location.city, city.location.country,
|
||||
e.what())});
|
||||
return std::nullopt;
|
||||
}
|
||||
};
|
||||
@@ -164,7 +165,8 @@ void BiergartenPipelineOrchestrator::GenerateUsers(
|
||||
} catch (const std::exception& export_exception) {
|
||||
++export_failed_count;
|
||||
|
||||
logger_->Log({.level = LogLevel::Warn,
|
||||
logger_->Log(
|
||||
{.level = LogLevel::Warn,
|
||||
.phase = PipelinePhase::UserGeneration,
|
||||
.message = std::format(
|
||||
"[Pipeline] Generated user for '{}' ({}) but "
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
#include "services/curated_data/curated_json_data_service.h"
|
||||
#include "services/logging/logger.h"
|
||||
|
||||
std::vector<City>
|
||||
BiergartenPipelineOrchestrator::QueryLocations() {
|
||||
std::vector<City> BiergartenPipelineOrchestrator::QueryLocations() {
|
||||
logger_->Log({.level = LogLevel::Info,
|
||||
.phase = PipelinePhase::Startup,
|
||||
.message = "=== GEOGRAPHIC DATA OVERVIEW ==="});
|
||||
|
||||
@@ -21,7 +21,8 @@ bool BiergartenPipelineOrchestrator::Run() {
|
||||
size_t skipped_count = 0;
|
||||
for (auto& city : cities) {
|
||||
try {
|
||||
std::string region_context = context_service_->GetLocationContext(city);
|
||||
std::string region_context =
|
||||
context_service_->GetLocationContext(city);
|
||||
|
||||
enriched.push_back(
|
||||
EnrichedCity{.location = std::move(city),
|
||||
|
||||
Reference in New Issue
Block a user