Skip to content

Commit ed7f592

Browse files
committed
Add conf param job_url_root for JobUrl()
1 parent 69e63b3 commit ed7f592

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/dcompact/dcompact_etcd.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ class DcompactEtcdExecFactory final : public CompactExecFactoryCommon {
479479
std::string alert_http;
480480
uint32_t alert_interval = 60; // seconds
481481
std::string web_domain; // now just for iframe auto height
482+
std::string job_url_root;
482483
std::string m_start_time;
483484
uint64_t m_start_time_epoch; // for ReportFee
484485
size_t estimate_speed = 10e6; // speed in bytes-per-second
@@ -538,6 +539,7 @@ class DcompactEtcdExecFactory final : public CompactExecFactoryCommon {
538539
ROCKSDB_JSON_OPT_PROP(js, alert_email);
539540
ROCKSDB_JSON_OPT_PROP(js, alert_http);
540541
ROCKSDB_JSON_OPT_PROP(js, web_domain);
542+
ROCKSDB_JSON_OPT_PROP(js, job_url_root);
541543
ROCKSDB_JSON_OPT_PROP(js, etcd_root);
542544
Update(js);
543545
if (!js.contains("http_workers")) {
@@ -656,6 +658,17 @@ class DcompactEtcdExecFactory final : public CompactExecFactoryCommon {
656658
#endif
657659
}
658660
std::string WorkersView(const json& dump_options, int cols) const;
661+
std::string JobUrl(const std::string& dbname, int job_id, int attempt) const final {
662+
std::string str;
663+
if (!job_url_root.empty()) {
664+
char buf[64];
665+
auto len = snprintf(buf, sizeof(buf), "job-%05d/att-%02d", job_id, attempt);
666+
str.reserve(job_url_root.size() + instance_name.size() + m_start_time.size() + dbname.size() + len + 20);
667+
(string_appender<>&)(str)
668+
|job_url_root|"/"|instance_name|"/"|m_start_time|"/"|dbname|"/"|fstring(buf, len)|"/summary.html";
669+
}
670+
return str;
671+
}
659672
void Update(const json& js) final {
660673
CompactExecFactoryCommon::Update(js);
661674
ROCKSDB_JSON_OPT_PROP(js, timeout_multiplier);
@@ -788,6 +801,11 @@ try
788801
#ifdef TOPLING_DCOMPACT_USE_ETCD
789802
auto pEtcd = f->m_etcd;
790803
#endif
804+
for (auto& level_inputs : *params.inputs) {
805+
for (auto& file : level_inputs.files) {
806+
file->job_attempt = m_attempt;
807+
}
808+
}
791809
char buf[64];
792810
results->status = Status::Incomplete("executing command: " + f->etcd_url);
793811
const std::string& dbpath = params.dbname;

0 commit comments

Comments
 (0)