2929// Qserv headers
3030#include " cconfig/CzarConfig.h"
3131#include " czar/Czar.h"
32- #include " protojson/JobReadyMsg.h"
32+ #include " protojson/UberJobErrorMsg.h"
33+ #include " protojson/UberJobReadyMsg.h"
3334#include " protojson/WorkerCzarComIssue.h"
3435#include " qdisp/Executive.h"
3536#include " qdisp/UberJob.h"
@@ -107,14 +108,14 @@ json HttpCzarWorkerModule::_handleJobError(string const& func) {
107108 // Parse and verify the json message and then kill the UberJob.
108109 json jsRet = {{" success" , 0 }, {" errortype" , " unknown" }, {" note" , " initialized" }};
109110 try {
110- // TODO:UJ see wbase::UberJobData::responseError for message construction
111- string const targetWorkerId = body (). required <string>( " workerid " );
112- string const czarName = body ().required <string>( " czar " ) ;
113- qmeta::CzarId const czarId = body (). required <qmeta::CzarId>( " czarid " );
114- QueryId const queryId = body (). required <QueryId>( " queryid " );
115- UberJobId const uberJobId = body (). required <UberJobId>( " uberjobid " );
116- int const errorCode = body (). required < int >( " errorCode " );
117- string const errorMsg = body (). required <string>( " errorMsg " );
111+ string const & repliInstanceId = cconfig::CzarConfig::instance ()-> replicationInstanceId ();
112+ string const & repliAuthKey = cconfig::CzarConfig::instance ()-> replicationAuthKey ( );
113+ auto const & jsReq = body ().objJson ;
114+ auto jrMsg = protojson::UberJobErrorMsg::createFromJson (jsReq, repliInstanceId, repliAuthKey );
115+
116+ auto const queryId = jrMsg-> getQueryId ( );
117+ auto const czarId = jrMsg-> getCzarId ( );
118+ auto const uberJobId = jrMsg-> getUberJobId ( );
118119
119120 // Find UberJob
120121 qdisp::Executive::Ptr exec = czar::Czar::getCzar ()->getExecutiveFromMap (queryId);
@@ -129,9 +130,8 @@ json HttpCzarWorkerModule::_handleJobError(string const& func) {
129130 " czar=" + to_string (czarId));
130131 }
131132
132- auto importRes = uj->workerError (errorCode, errorMsg );
133+ auto importRes = uj->workerError (jrMsg-> getErrorCode (), jrMsg-> getErrorMsg () );
133134 jsRet = importRes;
134-
135135 } catch (std::invalid_argument const & iaEx) {
136136 LOGS (_log, LOG_LVL_ERROR,
137137 " HttpCzarWorkerModule::_handleJobError received " << iaEx.what () << " js=" << body ().objJson );
@@ -148,10 +148,8 @@ json HttpCzarWorkerModule::_handleJobReady(string const& func) {
148148 // Parse and verify the json message and then have the uberjob import the file.
149149 json jsRet = {{" success" , 1 }, {" errortype" , " unknown" }, {" note" , " initialized" }};
150150 try {
151- string const repliInstanceId = cconfig::CzarConfig::instance ()->replicationInstanceId ();
152- string const repliAuthKey = cconfig::CzarConfig::instance ()->replicationAuthKey ();
153151 auto const & jsReq = body ().objJson ;
154- auto jrMsg = protojson::JobReadyMsg ::createFromJson (jsReq, repliInstanceId, repliAuthKey );
152+ auto jrMsg = protojson::UberJobReadyMsg ::createFromJson (jsReq);
155153
156154 // Find UberJob
157155 auto queryId = jrMsg->getQueryId ();
@@ -212,7 +210,7 @@ json HttpCzarWorkerModule::_handleWorkerCzarComIssue(string const& func) {
212210 execPtr->killIncompleteUberJobsOnWorker (wId);
213211 }
214212 }
215- jsRet = wccIssue->serializeResponseJson ();
213+ jsRet = wccIssue->responseToJson ();
216214 LOGS (_log, LOG_LVL_TRACE, " HttpCzarWorkerModule::_handleWorkerCzarComIssue jsRet=" << jsRet.dump ());
217215
218216 } catch (std::invalid_argument const & iaEx) {
0 commit comments