|
48 | 48 | using namespace std; |
49 | 49 | using namespace nlohmann; |
50 | 50 |
|
| 51 | +namespace fs = boost::filesystem; |
| 52 | + |
51 | 53 | namespace { |
52 | 54 |
|
53 | 55 | LOG_LOGGER _log = LOG_GET("lsst.qserv.wbase.UberJobData"); |
@@ -180,35 +182,28 @@ void UberJobData::_queueUJResponse(http::Method method_, std::vector<std::string |
180 | 182 | } |
181 | 183 | } |
182 | 184 |
|
183 | | -string UberJobData::buildUjResultFilePath(string const& resultsDirname) { |
184 | | - if (resultsDirname.empty()) return resultsDirname; |
185 | | - boost::filesystem::path path(resultsDirname); |
| 185 | +string UberJobData::_resultFileName() const { |
186 | 186 | // UberJobs have multiple chunks which can each have different attempt numbers. |
187 | 187 | // However, each CzarID + UberJobId should be unique as UberJobs are not retried. |
188 | | - path /= to_string(getCzarId()) + "-" + to_string(getQueryId()) + "-" + to_string(getUberJobId()) + "-0" + |
189 | | - ".proto"; |
190 | | - return path.string(); |
| 188 | + return to_string(getCzarId()) + "-" + to_string(getQueryId()) + "-" + to_string(getUberJobId()) + "-0" + |
| 189 | + ".proto"; |
191 | 190 | } |
192 | 191 |
|
193 | | -string UberJobData::resultFilePath() { |
194 | | - auto const workerConfig = wconfig::WorkerConfig::instance(); |
195 | | - string resultFilePath = buildUjResultFilePath(workerConfig->resultsDirname()); |
196 | | - return resultFilePath; |
| 192 | +string UberJobData::resultFilePath() const { |
| 193 | + string const resultsDirname = wconfig::WorkerConfig::instance()->resultsDirname(); |
| 194 | + if (resultsDirname.empty()) return resultsDirname; |
| 195 | + return (fs::path(resultsDirname) / _resultFileName()).string(); |
197 | 196 | } |
198 | 197 |
|
199 | | -std::string UberJobData::resultFileHttpUrl() { |
| 198 | +std::string UberJobData::resultFileHttpUrl() const { |
200 | 199 | auto const workerConfig = wconfig::WorkerConfig::instance(); |
201 | 200 | auto const resultDeliveryProtocol = workerConfig->resultDeliveryProtocol(); |
202 | | - |
203 | | - string resFilePath = resultFilePath(); |
204 | | - auto const fqdn = _foreman->getFqdn(); |
205 | 201 | if (resultDeliveryProtocol != wconfig::ConfigValResultDeliveryProtocol::HTTP) { |
206 | 202 | throw runtime_error("wbase::Task::Task: unsupported results delivery protocol: " + |
207 | 203 | wconfig::ConfigValResultDeliveryProtocol::toString(resultDeliveryProtocol)); |
208 | 204 | } |
209 | 205 | // TODO:UJ it seems like this should just be part of the FileChannelShared??? |
210 | | - string resultFileHttpUrl = "http://" + fqdn + ":" + to_string(_resultsHttpPort) + resFilePath; |
211 | | - return resultFileHttpUrl; |
| 206 | + return "http://" + _foreman->getFqdn() + ":" + to_string(_resultsHttpPort) + "/" + _resultFileName(); |
212 | 207 | } |
213 | 208 |
|
214 | 209 | void UberJobData::cancelAllTasks() { |
|
0 commit comments