diff --git a/scheduler/OStoreDB/OStoreDB.cpp b/scheduler/OStoreDB/OStoreDB.cpp index e1f4d7013dcbda97d672c349f6d2a65ab63763f0..f86b8d66407283aab709a9f924893f583433a0eb 100644 --- a/scheduler/OStoreDB/OStoreDB.cpp +++ b/scheduler/OStoreDB/OStoreDB.cpp @@ -1090,6 +1090,7 @@ void OStoreDB::setRetrieveJobBatchReportedToUser(std::list<cta::SchedulerDatabas for(auto &j : jobsBatch) { switch(j->reportType) { case SchedulerDatabase::RetrieveJob::ReportType::FailureReport: { + j->fail(); auto &vid = j->archiveFile.tapeFiles.at(j->selectedCopyNb).vid; failedQueues[vid].push_back(FailedJobToQueue{ castFromSchedDBJob(j) }); break; @@ -5306,4 +5307,15 @@ void OStoreDB::RetrieveJob::asyncSetSuccessful() { } } +void OStoreDB::RetrieveJob::fail() { + if(!m_jobOwned) + throw JobNotOwned("In OStoreDB::RetrieveJob::failReport: cannot fail a job not owned"); + + // Lock the retrieve request. Change the status of the job. + objectstore::ScopedExclusiveLock rrl(m_retrieveRequest); + m_retrieveRequest.fetch(); + m_retrieveRequest.setJobStatus(this->selectedCopyNb,serializers::RetrieveJobStatus::RJS_Failed); + m_retrieveRequest.commit(); +} + } // namespace cta diff --git a/scheduler/OStoreDB/OStoreDB.hpp b/scheduler/OStoreDB/OStoreDB.hpp index 53f8e540dbe3bc5b3fefc5587222c7c1d24be485..2a4dfa6fb6ddab259c8267eb82571dcf08951851 100644 --- a/scheduler/OStoreDB/OStoreDB.hpp +++ b/scheduler/OStoreDB/OStoreDB.hpp @@ -255,6 +255,7 @@ public: void failTransfer(const std::string& failureReason, log::LogContext& lc) override; void failReport(const std::string& failureReason, log::LogContext& lc) override; void abort(const std::string& abortReason, log::LogContext &lc) override; + void fail() override; virtual ~RetrieveJob() override; private: // Can be instantiated from a mount (queue to transfer) or a report queue diff --git a/scheduler/SchedulerDatabase.hpp b/scheduler/SchedulerDatabase.hpp index 9b2131cce41fc0b012fc7bf51dd0f12401953d3a..18f37a09039538e72827322b04f11dbe5832c29e 100644 --- a/scheduler/SchedulerDatabase.hpp +++ b/scheduler/SchedulerDatabase.hpp @@ -402,6 +402,7 @@ public: virtual void failTransfer(const std::string &failureReason, log::LogContext &lc) = 0; virtual void failReport(const std::string &failureReason, log::LogContext &lc) = 0; virtual void abort(const std::string &abortReason, log::LogContext &lc) = 0; + virtual void fail() = 0; virtual ~RetrieveJob() {} private: };