int main()

in fbpcs/emp_games/attribution/shard_aggregator/main.cpp [43:105]


int main(int argc, char* argv[]) {
  fbpcs::performance_tools::CostEstimation cost{"shard_aggregator"};
  cost.start();

  folly::init(&argc, &argv);
  gflags::ParseCommandLineFlags(&argc, &argv, true);
  fbpcf::AwsSdk::aquire();

  XLOGF(INFO, "Party: {}", FLAGS_party);
  XLOGF(INFO, "Visibility: {}", FLAGS_visibility);
  XLOGF(INFO, "Server IP: {}", FLAGS_server_ip);
  XLOGF(INFO, "Port: {}", FLAGS_port);
  XLOGF(INFO, "Input path: {}", FLAGS_input_base_path);
  XLOGF(INFO, "Number of shards: {}", FLAGS_num_shards);
  XLOGF(INFO, "Output path: {}", FLAGS_output_path);
  XLOGF(INFO, "K-anonymity threshold: {}", FLAGS_threshold);

  XLOG(INFO) << "Start aggregating...";

  auto party = static_cast<fbpcf::Party>(FLAGS_party);
  auto visibility = static_cast<fbpcf::Visibility>(FLAGS_visibility);

  try {
    measurement::private_attribution::ShardAggregatorApp(
        party,
        visibility,
        FLAGS_server_ip,
        FLAGS_port,
        FLAGS_first_shard_index,
        FLAGS_num_shards,
        FLAGS_threshold,
        FLAGS_input_base_path,
        FLAGS_output_path,
        FLAGS_metrics_format_type)
        .run();
  } catch (const fbpcf::ExceptionBase& e) {
    XLOGF(ERR, "Some error occurred: {}", e.what());
    return 1;
  } catch (const std::exception& e) {
    XLOGF(ERR, "Some unknown error occurred: {}", e.what());
    return -1;
  }

  XLOGF(
      INFO,
      "Aggregation is completed. Please find the metrics at {}",
      FLAGS_output_path);

  cost.end();
  XLOG(INFO) << cost.getEstimatedCostString();
  if (FLAGS_run_name != "") {
    std::string runName = folly::to<std::string>(
        cost.getApplication(),
        "_",
        FLAGS_run_name,
        "_",
        measurement::private_attribution::getDateString());
    XLOG(INFO) << cost.writeToS3(
        runName, cost.getEstimatedCostDynamic(runName));
  }

  return 0;
}